/*
 * File Name    : siak-components.css
 * Description  : Shared layout helpers — CSS grid tiles, glass cards, shell sidebar, modal chrome.
 * Author       : Erwin Youfilandy
 * Date         : 02/05/2026
 * Version      : 1.0.5
 *
 * Revision History :
 * Date        Comments
 * ------------------------------------------------------------------
 * 02/05/2026  Shell akun: sidebar tinggi penuh, strip hijau, nav/header portal, Keluar di bawah
 * 02/05/2026  Header body.siak-admin: strip hijau + chip putih (selaras portal)
 * 02/05/2026  Kelas .siak-brand-logo untuk lambang Kab. Fakfak di shell akun/tamu
 * 02/05/2026  Shell auth (login), header akun/admin, nav aktif sidebar
 * 02/05/2026  Initial release
 * 02/05/2026  Latar portal: lapisan radial tambahan untuk kedalaman visual
 */

/* --- Brand logo (PNG resmi) --- */
.siak-brand-logo {
    object-fit: contain;
    flex-shrink: 0;
}

.siak-brand-logo--account-sidebar {
    border-radius: 0.35rem;
    background: rgba(255, 255, 255, 0.07);
    padding: 0.15rem;
}

.siak-brand-logo--guest-marketing,
.siak-brand-logo--guest-mobile {
    display: block;
}

/* --- Account / admin shell --- */
body.siak-shell aside.siak-sidebar-account,
.siak-shell .siak-sidebar-account {
    width: var(--siak-sidebar-width-account);
    background-color: var(--siak-sidebar-bg) !important;
    position: sticky;
    top: 0;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 100vh;
    max-height: 100vh;
    min-height: 100dvh;
    max-height: 100dvh;
    box-shadow: inset 0 3px 0 0 var(--siak-brand-5);
}

body.siak-shell .siak-sidebar-account__scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

body.siak-shell .siak-sidebar-account__scroll::-webkit-scrollbar {
    width: 6px;
}

body.siak-shell .siak-sidebar-account__scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.22);
    border-radius: 6px;
}

body.siak-shell .siak-sidebar-account__brand-text {
    color: rgba(255, 255, 255, 0.92);
    letter-spacing: 0.04em;
}

body.siak-shell .siak-sidebar-account .siak-shell-account-navlink {
    color: rgba(255, 255, 255, 0.92) !important;
    font-size: 0.8125rem;
}

body.siak-shell .siak-sidebar-account .siak-shell-account-navlink:hover,
body.siak-shell .siak-sidebar-account .siak-shell-account-navlink:focus {
    color: #fff !important;
}

body.siak-shell .siak-sidebar-account .nav-link.siak-nav-link-active {
    background: rgba(255, 255, 255, 0.12) !important;
    box-shadow: inset 3px 0 0 var(--siak-brand-3) !important;
    color: #fff !important;
}

body.siak-shell .siak-sidebar-account__foot {
    flex-shrink: 0;
    margin-top: auto;
    padding-top: 0.65rem;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.22) 35%, rgba(0, 0, 0, 0.35) 100%);
    margin-left: calc(-1 * var(--siak-gap-compact, 0.65rem));
    margin-right: calc(-1 * var(--siak-gap-compact, 0.65rem));
    margin-bottom: calc(-1 * var(--siak-gap-compact, 0.65rem));
    padding-left: var(--siak-gap-compact, 0.65rem);
    padding-right: var(--siak-gap-compact, 0.65rem);
    padding-bottom: var(--siak-gap-compact, 0.65rem);
    border-top: 1px solid rgba(255, 255, 255, 0.14);
}

body.siak-shell .siak-sidebar-account__logout {
    font-weight: 600;
}

body.siak-admin aside.siak-admin-sidebar,
.siak-admin .siak-admin-sidebar {
    width: var(--siak-sidebar-width-admin) !important;
    flex: 0 0 var(--siak-sidebar-width-admin);
    min-width: var(--siak-sidebar-width-admin);
    max-width: 100%;
    background-color: var(--siak-sidebar-bg) !important;
}

/* --- Auto-fit grid (modul / kartu layanan) --- */
.siak-content-grid {
    display: grid;
    gap: var(--siak-gap);
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.siak-content-grid--compact {
    gap: var(--siak-gap-sm);
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Tile: flex column; neutral surface; accent = left border */
.siak-tile-card {
    position: relative;
    z-index: var(--siak-z-surface);
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--siak-radius);
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.siak-tile-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.siak-tile-card .siak-tile-icon {
    color: var(--siak-accent-admin);
    font-size: 1.35rem;
    line-height: 1;
    margin-bottom: 0.35rem;
}

.siak-tile--admin {
    border-left: 4px solid var(--siak-accent-admin);
}

.siak-tile--admin .siak-tile-icon {
    color: var(--siak-accent-admin);
}

.siak-tile--economy {
    border-left: 4px solid var(--siak-accent-economy);
}

.siak-tile--economy .siak-tile-icon {
    color: var(--siak-accent-economy);
}

.siak-tile--emergency {
    border-left: 4px solid var(--siak-accent-emergency);
}

.siak-tile--emergency .siak-tile-icon {
    color: var(--siak-accent-emergency);
}

.siak-tile--public {
    border-left: 4px solid var(--siak-accent-public);
}

.siak-tile--public .siak-tile-icon {
    color: var(--siak-accent-public);
}

.siak-tile--civil {
    border-left: 4px solid var(--siak-accent-civil);
}

.siak-tile--civil .siak-tile-icon {
    color: var(--siak-accent-civil);
}

a.siak-tile-card.siak-tile--admin .siak-tile-cta {
    color: var(--siak-accent-admin);
}

a.siak-tile-card.siak-tile--economy .siak-tile-cta {
    color: var(--siak-accent-economy);
}

a.siak-tile-card.siak-tile--public .siak-tile-cta {
    color: var(--siak-accent-public);
}

a.siak-tile-card.siak-tile--civil .siak-tile-cta {
    color: var(--siak-accent-civil);
}

/* --- Portal shell: background + stacking --- */
body.portal-body-siak {
    position: relative;
    background-color: #e8eef5;
}

body.portal-body-siak::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: var(--siak-z-deco);
    pointer-events: none;
    opacity: 0.55;
    background-image:
        radial-gradient(ellipse 90% 50% at 50% -10%, rgba(0, 146, 213, 0.14) 0%, transparent 55%),
        radial-gradient(circle at 18% 22%, rgba(97, 83, 143, 0.1) 0%, transparent 42%),
        radial-gradient(circle at 82% 18%, rgba(109, 190, 79, 0.1) 0%, transparent 38%),
        repeating-linear-gradient(
            -12deg,
            rgba(255, 255, 255, 0.04) 0 2px,
            transparent 2px 12px
        );
}

body.portal-body-siak > .navbar {
    z-index: var(--siak-z-sticky);
}

body.portal-body-siak > .portal-skip-link {
    z-index: calc(var(--siak-z-sticky) + 5);
}

body.portal-body-siak > main,
body.portal-body-siak > footer {
    position: relative;
    z-index: var(--siak-z-content);
}

/* --- Glass card (portal) + fallback --- */
.portal-glass-card {
    position: relative;
    z-index: var(--siak-z-surface);
    border-radius: var(--siak-radius);
    border: 1px solid rgba(255, 255, 255, 0.65);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
}

@supports (backdrop-filter: blur(8px)) {
    .portal-glass-card {
        background: rgba(255, 255, 255, 0.78);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }
}

/* --- CMS prose wrapper --- */
.portal-cms-prose {
    max-width: 52rem;
}

.portal-cms-prose h1,
.portal-cms-prose h2,
.portal-cms-prose h3 {
    margin-top: 1.25rem;
    margin-bottom: 0.75rem;
}

.portal-cms-prose p,
.portal-cms-prose li {
    line-height: 1.65;
}

/* --- Auth marketing panel (guest) --- */
.guest-marketing-panel {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    width: 42%;
    max-width: 28rem;
    color: #fff;
    background: linear-gradient(
        145deg,
        var(--siak-login-gradient-start) 0%,
        #0a3d91 55%,
        var(--siak-login-gradient-end) 100%
    );
}

.guest-marketing-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.18;
    background-image:
        radial-gradient(circle at 18% 28%, rgba(255, 255, 255, 0.45) 0%, transparent 42%),
        radial-gradient(circle at 88% 12%, rgba(255, 255, 255, 0.2) 0%, transparent 35%);
}

.guest-marketing-panel > * {
    position: relative;
    z-index: var(--siak-z-surface);
}

/* --- Auth page (form sisi kanan / mobile) --- */
body.siak-auth-page,
body.siak-shell {
    font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body.siak-shell .flex-grow-1.d-flex.flex-column.min-vw-0 > main.flex-grow-1 {
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 40%, #f1f5f9 100%);
}

.siak-auth-page .guest-auth-panel {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 100vh;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 40%, #f1f5f9 100%);
}

.siak-auth-page .guest-auth-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.55;
    background-image: radial-gradient(ellipse 85% 50% at 75% -15%, rgba(0, 146, 213, 0.14) 0%, transparent 52%);
}

.siak-auth-page .guest-auth-panel > .d-flex {
    position: relative;
    z-index: var(--siak-z-content);
}

.siak-auth-card.card {
    border-radius: 0.9rem !important;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.07) !important;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.1) !important;
}

.siak-auth-card .card-body {
    border-top: 4px solid var(--siak-accent-admin);
}

.guest-auth-foot {
    font-size: 0.8125rem;
}

.guest-auth-foot a {
    font-weight: 600;
    text-decoration: none;
}

.guest-auth-foot a:hover {
    text-decoration: underline;
}

/* --- Account + admin shell: top header --- */
header.siak-shell-header {
    background: linear-gradient(90deg, #ffffff 0%, #f8fafc 55%, #f1f5f9 100%);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85) inset;
}

header.siak-shell-header .siak-shell-userchip {
    padding: 0.28rem 0.75rem;
    border-radius: 999px;
    background: rgba(0, 146, 213, 0.1);
    color: #0f172a !important;
    font-weight: 600;
    font-size: 0.8125rem;
    max-width: 16rem;
}

/* Header admin: strip brand + latar brand utama (selaras portal) */
body.siak-admin header.siak-shell-header.siak-admin-shell-header {
    background: #0092d5 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: none;
    color: #fff;
}

body.siak-admin header.siak-shell-header.siak-admin-shell-header .siak-shell-userchip {
    background: rgba(255, 255, 255, 0.14);
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.22);
}

/* Header shell akun (Dasbor akun, profil, dll.) — sama dengan panel admin */
body.siak-shell header.siak-shell-header.siak-shell-header--portal {
    background: #0092d5 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: none;
    color: #fff;
}

body.siak-shell header.siak-shell-header--portal .siak-shell-header--portal__icon {
    color: rgba(255, 255, 255, 0.88);
    font-size: 1.1rem;
}

body.siak-shell header.siak-shell-header--portal .siak-shell-userchip--portal {
    background: rgba(255, 255, 255, 0.14);
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.22);
}

body.siak-shell header.siak-shell-header--portal h1,
body.siak-shell header.siak-shell-header--portal .h5,
body.siak-shell header.siak-shell-header--portal .h6 {
    color: #fff !important;
}

body.siak-shell header.siak-shell-header--portal .text-primary {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* --- Sidebar navigation (akun + admin) --- */
.siak-admin-sidebar .nav-link,
.siak-sidebar-account .nav-link {
    border: 1px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.siak-admin-sidebar .nav-link:hover,
.siak-sidebar-account .nav-link:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #fff !important;
}

.siak-admin-sidebar .nav-link.siak-nav-link-active,
.siak-sidebar-account .nav-link.siak-nav-link-active {
    background: rgba(0, 146, 213, 0.32) !important;
    color: #fff !important;
    box-shadow: inset 3px 0 0 var(--siak-accent-admin);
    border-color: rgba(255, 255, 255, 0.08);
    font-weight: 600;
}

.siak-sidebar-section-label {
    font-size: 0.65rem !important;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.42) !important;
    padding: 0.65rem 0.5rem 0.35rem !important;
    margin-top: 0.15rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.siak-admin-sidebar .btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

/* --- Modal (account shell) --- */
.siak-modal-root {
    position: fixed;
    inset: 0;
    z-index: 1050;
    overflow-y: auto;
    padding: 1rem;
}

.siak-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(33, 37, 41, 0.55);
}

.siak-modal-panel {
    position: relative;
    z-index: 1051;
    width: 100%;
    max-width: 28rem;
    margin: 2rem auto;
    background: #fff;
    border-radius: var(--siak-radius);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.18);
}

/* --- Portal navbar link emphasis --- */
.portal-body-siak .navbar-nav .nav-link.active {
    box-shadow: inset 0 -3px 0 rgba(255, 255, 255, 0.85);
}
