/* =========================================================
   Layout: topbar, drawer, main, footer
   Mobile-first responsive
   ========================================================= */

/* ============== TOPBAR ============== */
.topbar {
    position: sticky; top: 0; z-index: 100;
    background: var(--ink);
    color: var(--ivory);
    border-bottom: 2px solid var(--gold);
    box-shadow: 0 2px 0 var(--gold-deep), 0 8px 24px rgba(0,0,0,.18);
}
.topbar-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 10px 16px;
    min-height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Hamburger (mobile only) */
.menu-toggle {
    display: none;
    background: transparent; border: 0; padding: 8px;
    color: var(--ivory); cursor: pointer; border-radius: var(--r);
}
.menu-toggle:hover { background: rgba(201,162,39,.15); }
.menu-toggle i { width: 24px; height: 24px; }

/* Brand */
.brand {
    display: flex; align-items: center; gap: 10px;
    color: var(--ivory);
    flex-shrink: 0;
    min-width: 0;
}
.brand:hover { color: var(--gold-soft); }
.brand-logo svg { display: block; filter: drop-shadow(0 4px 8px rgba(201,162,39,.3)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-name {
    font-family: var(--font-serif); font-size: 1.25rem; font-weight: 800;
    color: var(--gold-soft); white-space: nowrap;
}
.brand-tag {
    font-family: var(--font-body); font-style: italic; font-size: .75rem;
    color: rgba(251,249,243,.65); white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; max-width: 200px;
}

/* Top navigation */
.topnav {
    display: flex; gap: 2px; flex: 1;
    justify-content: center;
    overflow: hidden;
}
.topnav a {
    color: var(--ivory);
    padding: 8px 12px;
    border-radius: var(--r);
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: .88rem;
    display: inline-flex; align-items: center; gap: 6px;
    white-space: nowrap;
    transition: background .15s, color .15s;
}
.topnav a i { width: 16px; height: 16px; }
.topnav a:hover { background: rgba(201,162,39,.12); color: var(--gold-soft); }

/* Right side */
.topbar-right {
    display: flex; align-items: center; gap: 6px; justify-content: flex-end;
    flex-shrink: 0;
}

.search-mini {
    display: flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(201,162,39,.3);
    padding: 7px 14px; border-radius: 999px;
    width: 220px;
    transition: border-color .15s, background .15s;
}
.search-mini:focus-within { border-color: var(--gold); background: rgba(255,255,255,.12); }
.search-mini i { width: 16px; height: 16px; color: var(--gold-soft); flex-shrink: 0; }
.search-mini input {
    background: transparent; border: 0; outline: none;
    color: var(--ivory); font-family: var(--font-ui); font-size: .88rem;
    width: 100%;
}
.search-mini input::placeholder { color: rgba(251,249,243,.5); }

/* Search trigger button (mobile) */
.search-trigger {
    display: none;
}

.icon-btn {
    position: relative;
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--ivory);
    border-radius: 50%;
    background: transparent; border: 0; cursor: pointer;
    transition: background .15s;
    flex-shrink: 0;
}
.icon-btn:hover { background: rgba(201,162,39,.15); color: var(--gold-soft); }
.icon-btn i { width: 20px; height: 20px; }
.icon-btn .dot {
    position: absolute; top: 2px; right: 2px;
    background: var(--burgundy); color: white;
    font-family: var(--font-ui); font-size: .65rem; font-weight: 700;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
    border: 2px solid var(--ink);
}

.profile-dd { position: relative; }
.profile-btn {
    display: flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(201,162,39,.3);
    color: var(--ivory);
    padding: 4px 10px 4px 4px;
    border-radius: 999px;
    cursor: pointer;
    font-family: var(--font-ui); font-size: .88rem;
    transition: background .15s, border-color .15s;
    max-width: 180px;
}
.profile-btn:hover { background: rgba(201,162,39,.12); border-color: var(--gold); }
.profile-btn img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 1px solid var(--gold); flex-shrink: 0; }
.profile-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-btn i { width: 14px; height: 14px; flex-shrink: 0; }

.profile-menu {
    position: absolute; right: 0; top: calc(100% + 8px);
    background: var(--surface); color: var(--ink);
    min-width: 240px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 8px;
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
}
.profile-menu a, .profile-menu .role-badge {
    padding: 10px 12px; border-radius: var(--r); display: flex; align-items: center; gap: 10px;
    font-family: var(--font-ui); font-size: .9rem; color: var(--text);
}
.profile-menu a:hover { background: var(--parchment); }
.profile-menu a.danger { color: var(--burgundy); }
.profile-menu a.danger:hover { background: rgba(122,31,43,.08); }
.profile-menu a i { width: 16px; height: 16px; }
.profile-menu hr { margin: 6px 4px; }
.profile-dd.open .profile-menu { display: flex; }

/* ============== MOBILE DRAWER ============== */
.drawer-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(11,27,43,.55);
    backdrop-filter: blur(2px);
    z-index: 199;
}
.drawer-backdrop.show { display: block; }

.drawer {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 86%; max-width: 320px;
    background: var(--ink);
    color: var(--ivory);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .25s ease;
    display: flex; flex-direction: column;
    border-right: 2px solid var(--gold);
    box-shadow: 12px 0 40px rgba(0,0,0,.4);
}
.drawer.show { transform: translateX(0); }
.drawer-head {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(201,162,39,.3);
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
}
.drawer-head .brand-name { font-size: 1.2rem; }
.drawer-head .brand-tag { font-size: .72rem; }
.drawer-close {
    background: transparent; border: 0; color: var(--ivory); padding: 6px;
    border-radius: var(--r); cursor: pointer;
}
.drawer-close:hover { background: rgba(255,255,255,.08); }
.drawer-body { flex: 1; overflow-y: auto; padding: 12px 12px 24px; }
.drawer-body a {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    color: var(--ivory);
    border-radius: var(--r);
    font-family: var(--font-ui);
    font-size: .95rem;
    margin-bottom: 2px;
}
.drawer-body a:hover, .drawer-body a.active {
    background: rgba(201,162,39,.12); color: var(--gold-soft);
}
.drawer-body a i { width: 20px; height: 20px; flex-shrink: 0; }
.drawer-body hr { border-color: rgba(201,162,39,.2); margin: 12px 0; }
.drawer-body .group-title {
    padding: 10px 14px 6px;
    font-size: .72rem; letter-spacing: .15em; text-transform: uppercase;
    color: var(--gold-soft); opacity: .8;
}
.drawer-search {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(201,162,39,.2);
}
.drawer-search form {
    display: flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(201,162,39,.3);
    padding: 8px 12px; border-radius: 999px;
}
.drawer-search input {
    background: transparent; border: 0; outline: none;
    color: var(--ivory); font-family: var(--font-ui); font-size: .9rem;
    width: 100%;
}
.drawer-search input::placeholder { color: rgba(251,249,243,.5); }
.drawer-search i { color: var(--gold-soft); width: 16px; height: 16px; }

/* ============== FLASH ============== */
.flash-wrap {
    max-width: var(--container); margin: 16px auto 0;
    padding: 0 16px; display: flex; flex-direction: column; gap: 8px;
}
.flash {
    padding: 12px 16px; border-radius: var(--r);
    font-family: var(--font-ui); font-size: .92rem;
    border-left: 4px solid var(--gold); background: var(--parchment);
}
.flash-success { border-left-color: var(--success); background: #E7F4EE; color: #1d4d3a; }
.flash-error   { border-left-color: var(--danger);  background: #FBEAEC; color: #6e2129; }
.flash-info    { border-left-color: var(--ink-3);   background: #E9EFF6; color: var(--ink); }

/* ============== MAIN ============== */
.main {
    max-width: var(--container);
    margin: 24px auto 48px;
    padding: 0 16px;
    min-height: 60vh;
}

/* ============== FOOTER ============== */
.footer {
    background:
      radial-gradient(circle at 80% 0%, rgba(201,162,39,.08), transparent 50%),
      var(--ink);
    color: var(--ivory);
    border-top: 2px solid var(--gold);
    margin-top: 60px;
}
.footer-inner {
    max-width: var(--container); margin: 0 auto;
    padding: 40px 16px 24px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
}
.footer-about { max-width: 360px; }
.footer-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.footer-name  { font-family: var(--font-serif); font-size: 1.3rem; color: var(--gold-soft); line-height: 1.1; }
.footer-tag   { font-style: italic; color: rgba(251,249,243,.6); font-size: .85rem; }
.footer-desc {
    color: rgba(251,249,243,.7);
    font-size: .92rem; line-height: 1.65; margin: 0;
    font-family: var(--font-body);
}
.footer-col h4 {
    color: var(--gold-soft); font-family: var(--font-ui); font-size: .78rem;
    letter-spacing: .18em; text-transform: uppercase; margin-bottom: 14px;
    position: relative; padding-bottom: 8px;
}
.footer-col h4::after {
    content: ''; position: absolute; left: 0; bottom: 0;
    width: 28px; height: 2px; background: var(--gold);
}
.footer-col a {
    display: block; color: rgba(251,249,243,.75);
    padding: 5px 0; font-family: var(--font-ui); font-size: .92rem;
    transition: color .15s, padding-left .15s;
}
.footer-col a:hover { color: var(--gold-soft); padding-left: 4px; }
.footer-bottom {
    max-width: var(--container); margin: 0 auto;
    padding: 16px; border-top: 1px solid rgba(201,162,39,.2);
    color: rgba(251,249,243,.55);
    font-family: var(--font-ui); font-size: .82rem;
    display: flex; flex-direction: column; gap: 6px;
    align-items: center; text-align: center;
}
.footer-meta { color: rgba(251,249,243,.4); font-size: .78rem; }
@media (min-width: 720px) {
    .footer-inner {
        grid-template-columns: 1.6fr repeat(3, 1fr);
        gap: 40px;
        padding: 48px 24px 28px;
    }
    .footer-bottom {
        flex-direction: row; justify-content: space-between;
        text-align: left; padding: 18px 24px;
    }
}

/* ============== RESPONSIVE BREAKPOINTS ============== */

/* Hide brand tagline early — kalau muat hanya saat layar lebar */
@media (max-width: 1280px) {
    .brand-tag { display: none; }
}

/* Hide topnav saat layar tidak cukup lebar untuk semua item, tampilkan hamburger */
@media (max-width: 1200px) {
    .topnav { display: none; }
    .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
}

/* Search mini lebih ramping di tablet */
@media (max-width: 1100px) {
    .search-mini { width: 200px; }
}

/* Tablet: search jadi icon */
@media (max-width: 900px) {
    .search-mini { display: none; }
    .search-trigger { display: inline-flex; }
}

/* Mobile */
@media (max-width: 640px) {
    .topbar-inner { padding: 8px 12px; gap: 6px; min-height: 60px; }
    .brand-name { font-size: 1.05rem; }
    .brand-logo svg { width: 30px; height: 30px; }
    .profile-btn { padding: 3px 8px 3px 3px; }
    .profile-btn span { display: none; }
    .profile-btn i { display: none; }
    .profile-btn img { width: 26px; height: 26px; }
    .icon-btn { width: 36px; height: 36px; }
    .icon-btn i { width: 18px; height: 18px; }
    .main { margin: 16px auto 32px; padding: 0 12px; }
}

@media (max-width: 380px) {
    .brand-text { display: none; }
}

/* Desktop padding bumps */
@media (min-width: 900px) {
    .topbar-inner { padding: 12px 24px; }
    .main { margin: 32px auto 64px; padding: 0 24px; }
    .flash-wrap { padding: 0 24px; }
}
