/* ============================================================
   HEADER & FOOTER CSS
   ORANGBAIK.ID
   Menggunakan design system dari global.css
   ============================================================ */


/* ============================================================
   HEADER
============================================================ */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;

    background: var(--primary);
    border-bottom: 1px solid rgba(255, 255, 255, .24);
    box-shadow: var(--shadow-soft);

    transition:
        background .25s ease,
        box-shadow .25s ease;
}

.site-header.is-scrolled {
    box-shadow: var(--shadow);
}

.header-inner {
    min-height: 74px;
    height: 74px;

    display: flex;
    align-items: center;
    gap: var(--space-6);
}

.brand {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.brand-logo {
    width: 46px;
    height: 46px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;
    overflow: hidden;
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}


/* ============================================================
   DESKTOP NAVIGATION
============================================================ */

.nav-menu {
    display: flex;
    align-items: center;
    gap: var(--space-6);
}

.nav-menu a {
    position: relative;

    color: rgba(255, 255, 255, .84);
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    line-height: 1;

    transition: color .2s ease;
}

.nav-menu a::after {
    content: "";

    position: absolute;
    left: 0;
    right: 0;
    bottom: -10px;

    width: 0;
    height: 2px;
    margin-inline: auto;

    border-radius: var(--radius-full);
    background: var(--bg);

    transition: width .2s ease;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--bg);
}

.nav-menu a:hover::after,
.nav-menu a.active::after {
    width: 100%;
}


/* ============================================================
   HEADER ACTIONS
============================================================ */

.header-actions {
    margin-left: auto;

    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.desktop-search-form {
    width: 230px;
    height: 42px;

    display: flex;
    align-items: center;
    gap: var(--space-2);

    padding-inline: var(--space-3);

    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: var(--radius-full);

    transition:
        background .25s ease,
        border-color .25s ease;
}

.desktop-search-form:hover,
.desktop-search-form:focus-within {
    background: rgba(255, 255, 255, .18);
    border-color: rgba(255, 255, 255, .35);
}

.desktop-search-form input {
    flex: 1;
    width: 100%;
    min-width: 0;
    height: 100%;

    margin: 0;
    padding: 0;

    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;

    appearance: none;
    -webkit-appearance: none;

    color: var(--bg);
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
}

.desktop-search-form input::placeholder {
    color: rgba(255, 255, 255, .75);
}

.desktop-search-form input:focus,
.desktop-search-form input:focus-visible,
.desktop-search-form input:active {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    background-color: transparent !important;
}

.desktop-search-form button {
    width: 30px;
    height: 30px;

    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;

    padding: 0;

    border: none;
    background: transparent;

    color: var(--bg);
    cursor: pointer;
}

.desktop-search-form button i {
    font-size: 18px;
}

.desktop-search-form button:hover {
    opacity: .8;
}

.divider {
    width: 1px;
    height: 34px;
    background: rgba(255, 255, 255, .26);
}

.login-link {
    color: var(--bg);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);

    transition: opacity .2s ease;
}

.login-link:hover {
    opacity: .86;
}

.register-btn {
    min-height: 42px;
    padding: 11px var(--space-6);

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: var(--radius-full);
    background: var(--bg);
    color: var(--primary);

    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);

    box-shadow: var(--shadow-soft);

    transition:
        transform .2s ease,
        box-shadow .2s ease;
}

.register-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}


/* ============================================================
   USER DROPDOWN
============================================================ */

.header-user {
    position: relative;
}

.header-user-button {
    min-height: 44px;

    display: flex;
    align-items: center;
    gap: var(--space-2);

    padding: var(--space-1) var(--space-3) var(--space-1) var(--space-1);

    border: 1px solid rgba(255, 255, 255, .20);
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, .10);

    color: var(--bg);
    cursor: pointer;

    transition: background .2s ease;
}

.header-user-button:hover {
    background: rgba(255, 255, 255, .16);
}

.header-user-avatar {
    width: 36px;
    height: 36px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;
    overflow: hidden;

    border-radius: var(--radius-full);
    background: var(--bg);
    color: var(--primary);

    font-size: var(--fs-xs);
    font-weight: var(--fw-extrabold);
}

.header-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-user-name {
    max-width: 130px;

    color: var(--bg);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-user-icon {
    color: rgba(255, 255, 255, .8);
    font-size: var(--fs-xxs);

    transition: transform .2s ease;
}

.header-user:hover .header-user-icon {
    transform: rotate(180deg);
}

.header-user-dropdown {
    position: absolute;
    top: calc(100% + 14px);
    right: 0;
    z-index: 200;

    width: 230px;
    padding: var(--space-2);

    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);

    box-shadow: var(--shadow);

    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);

    transition:
        opacity .2s ease,
        visibility .2s ease,
        transform .2s ease;
}

.header-user:hover .header-user-dropdown,
.header-user:focus-within .header-user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.header-user-dropdown a,
.header-user-dropdown button {
    width: 100%;
    padding: var(--space-3);

    display: flex;
    align-items: center;
    gap: var(--space-2);

    border: none;
    border-radius: var(--radius-md);
    background: transparent;

    color: var(--text);
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    text-align: left;

    transition:
        background .2s ease,
        color .2s ease;
}

.header-user-dropdown a i,
.header-user-dropdown button i {
    font-size: var(--fs-xs);
    line-height: 1;
}

.header-user-dropdown a:hover,
.header-user-dropdown button:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.header-user-dropdown form {
    margin: 0;
}

.header-user-dropdown form button {
    color: var(--danger);
    cursor: pointer;
}

.header-user-dropdown form button:hover {
    background: var(--danger-light);
    color: var(--danger);
}


/* ============================================================
   MOBILE HEADER
============================================================ */

.mobile-header-inner {
    display: none;
}

.mobile-search-form {
    height: 42px;

    display: flex;
    align-items: center;
    gap: var(--space-2);

    flex: 1;
    min-width: 0;

    padding-inline: var(--space-3);

    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: var(--radius-full);

    transition:
        background .2s ease,
        border-color .2s ease;
}

.mobile-search-form:hover {
    background: rgba(255, 255, 255, .18);
}

.mobile-search-form:focus-within {
    background: rgba(255, 255, 255, .18);
    border-color: rgba(255, 255, 255, .35);
}

.mobile-search-form button {
    width: 30px;
    height: 30px;

    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;

    padding: 0;

    border: none;
    outline: none;
    background: transparent;

    color: var(--bg);
    cursor: pointer;
}

.mobile-search-form button i {
    font-size: 18px;
}

.mobile-search-form input {
    flex: 1;
    width: 100%;
    min-width: 0;
    height: 100%;

    margin: 0;
    padding: 0;

    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    background-color: transparent !important;

    appearance: none;
    -webkit-appearance: none;

    color: var(--bg);
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    caret-color: var(--bg);
}

.mobile-search-form input::placeholder {
    color: rgba(255, 255, 255, .75);
}

/*
   Menjaga background input tetap transparan.
   Tidak ada kotak biru ketika input diklik atau diketik.
*/

.mobile-search-form input:hover,
.mobile-search-form input:focus,
.mobile-search-form input:focus-visible,
.mobile-search-form input:active {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    background-color: transparent !important;
}

.mobile-search-form input:-webkit-autofill,
.mobile-search-form input:-webkit-autofill:hover,
.mobile-search-form input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--bg);
    caret-color: var(--bg);
    transition: background-color 9999s ease-out;
}

/* ============================================================
   MOBILE HEADER — MODE KATEGORI
   Ganti blok lama .mobile-header-title di header-footer.css
   dengan blok ini.
   Susunan: [← back]  [Kategori / Nama kategori]  [ikon]
============================================================ */

.mobile-header-back {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--bg);
    font-size: 20px;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
    transition:
        background .2s ease,
        transform .2s ease;
}

.mobile-header-back:active {
    transform: scale(.94);
}

.mobile-header-heading {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.mobile-header-eyebrow {
    color: rgba(255, 255, 255, .72);
    font-size: var(--fs-xxs);
    font-weight: var(--fw-regular);
    line-height: 1;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.mobile-header-title {
    margin: 0;
    overflow: hidden;
    color: var(--bg);
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
    line-height: 1.2;
    letter-spacing: -.02em;

    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Wrapper mode kategori: susun back, judul, dan ikon dalam satu baris */
.mobile-header-inner.is-category {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* ============================================================
   MOBILE BACK BUTTON
============================================================ */

.mobile-page-back {
    display: none;
}


/* ============================================================
   MOBILE BOTTOM NAVIGATION
============================================================ */

.mobile-bottom-nav {
    display: none;
}

.floating-donate-btn {
    display: none;
}


/* ============================================================
   FOOTER
============================================================ */

.site-footer {
    margin-top: var(--space-16);

    background:
        radial-gradient(
            circle at 12% 0%,
            rgba(255, 255, 255, .16),
            transparent 28%
        ),
        linear-gradient(
            180deg,
            var(--primary),
            var(--primary-hover)
        );

    color: var(--bg);
}

.footer-inner {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1.25fr 1.15fr 1.25fr;
    gap: var(--space-8);

    padding-block: var(--space-16);
}

.footer-brand {
    max-width: 330px;
}

.footer-logo {
    width: fit-content;

    display: inline-flex;
    align-items: center;

    margin-bottom: var(--space-5);
}

.footer-logo img {
    width: 165px;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.footer-brand p {
    margin: 0;

    color: rgba(255, 255, 255, .84);
    font-size: var(--fs-xs);
    line-height: 1.8;
}

.footer-socials,
.socials {
    display: flex;
    align-items: center;
    gap: var(--space-3);

    margin-top: var(--space-5);
}

.footer-socials a,
.socials span {
    width: 38px;
    height: 38px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, .12);
    color: var(--bg);

    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);

    transition:
        color .2s ease,
        transform .2s ease,
        background .2s ease;
}

.footer-socials a:hover,
.socials span:hover {
    color: var(--bg);
    background: rgba(255, 255, 255, .20);
    transform: translateY(-3px);
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.footer-col h4 {
    margin: 0 0 var(--space-2);

    color: var(--bg);
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
    line-height: 1.3;
}

.footer-col a,
.footer-col p {
    margin: 0;

    display: inline-flex;
    align-items: center;
    gap: var(--space-2);

    color: rgba(255, 255, 255, .78);
    font-size: var(--fs-xs);
    line-height: 1.7;

    transition:
        color .2s ease,
        transform .2s ease;
}

.footer-col a:hover {
    color: var(--bg);
    transform: translateX(4px);
}

.footer-col i {
    font-size: var(--fs-xs);
    line-height: 1;
}

.footer-bottom,
.copyright {
    border-top: 1px solid rgba(255, 255, 255, .16);
}

.footer-bottom-inner {
    padding-block: var(--space-4);
}

.footer-bottom p,
.copyright {
    margin: 0;

    color: rgba(255, 255, 255, .72);
    font-size: var(--fs-xxs);
    line-height: 1.6;
    text-align: center;
}

.copyright {
    padding-block: var(--space-5);
}


/* ============================================================
   PROFILE MENU ICON
============================================================ */

.profile-menu-icon {
    width: 48px;
    height: 48px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;

    color: var(--primary);
    background: var(--primary-light);
    border-radius: var(--radius-md);
}

.profile-menu-icon svg {
    width: 24px;
    height: 24px;
}

/* ============================
   SEARCH INPUT — RESET BROWSER AUTOFILL
   Tidak ada perubahan visual saat autofill,
   hover, focus, maupun active.
   ============================ */

.desktop-search-form input,
.mobile-search-form input {
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    border: none !important;
    appearance: none;
    -webkit-appearance: none;
}

/* Hover dan focus */
.desktop-search-form input:hover,
.desktop-search-form input:focus,
.desktop-search-form input:focus-visible,
.desktop-search-form input:active,
.mobile-search-form input:hover,
.mobile-search-form input:focus,
.mobile-search-form input:focus-visible,
.mobile-search-form input:active {
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Chrome / Edge autofill */
.desktop-search-form input:-webkit-autofill,
.desktop-search-form input:-webkit-autofill:hover,
.desktop-search-form input:-webkit-autofill:focus,
.desktop-search-form input:-webkit-autofill:active,
.mobile-search-form input:-webkit-autofill,
.mobile-search-form input:-webkit-autofill:hover,
.mobile-search-form input:-webkit-autofill:focus,
.mobile-search-form input:-webkit-autofill:active {
    -webkit-text-fill-color: #fff !important;
    -webkit-box-shadow: 0 0 0 1000px transparent inset !important;
    box-shadow: none !important;
    background-color: transparent !important;
    transition: background-color 999999s ease-out 0s;
}


/* ============================================================
   RESPONSIVE TABLET
============================================================ */

@media (max-width: 900px) {

    .header-inner {
        gap: var(--space-5);
    }

    .nav-menu {
        gap: var(--space-4);
    }

    .desktop-search-form {
        width: 190px;
    }

    .footer-inner {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .footer-brand {
        grid-column: 1 / -1;
        max-width: 520px;
    }
}


/* ============================================================
   RESPONSIVE MOBILE
============================================================ */

@media (max-width: 768px) {

    /* General */

    body {
        padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px));
        transition: padding-bottom .3s ease;
    }


    /* Header */

    .site-header {
        background: var(--primary);
        border-bottom: 1px solid rgba(255, 255, 255, .24);
        box-shadow: var(--shadow-soft);
    }

    /*
       Mobile header hanya muncul pada halaman
       yang memiliki form pencarian mobile.
    */

    .site-header:not(.has-mobile-search) {
        display: none;
    }

    .desktop-header {
        display: none;
    }

    .mobile-header-inner {
        min-height: 66px;

        display: flex;
        align-items: center;
        gap: var(--space-3);
    }

    .mobile-search-form {
        width: 100%;
        min-width: 0;
        flex: 1;
    }


    /* Back button */

    .mobile-page-back {
        position: fixed;
        top: max(12px, env(safe-area-inset-top, 0px));
        left: var(--space-3);
        z-index: 1200;

        width: 40px;
        height: 40px;

        display: flex;
        align-items: center;
        justify-content: center;

        border-radius: var(--radius-full);
        background: var(--bg);
        color: var(--text);

        font-size: 20px;
        text-decoration: none;

        box-shadow: var(--shadow-soft);

        -webkit-tap-highlight-color: transparent;
        transition: transform .2s ease;
    }

    .mobile-page-back:active {
        transform: scale(.95);
    }


    /* Bottom navigation */

    .mobile-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 250;
        min-height: calc(64px + env(safe-area-inset-bottom, 0px));
        padding:
            var(--space-1)
            var(--space-2)
            env(safe-area-inset-bottom, 0px);

        display: flex;
        align-items: center;
        justify-content: space-between;

        background: var(--bg-soft);
        border-top: 1px solid var(--border);
        box-shadow: 0 -8px 24px rgba(15, 23, 42, .08);

        opacity: 1;
        visibility: visible;
        transform: translateY(0);

        transition:
            transform .3s ease,
            opacity .3s ease,
            visibility .3s ease;
    }

    .mobile-bottom-nav a {
        min-width: 0;
        min-height: 48px;
        flex: 1;

        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: var(--space-1);

        color: var(--muted);
        font-size: var(--fs-xxs);
        font-weight: var(--fw-medium);
        line-height: 1;

        text-decoration: none;
        white-space: nowrap;

        -webkit-tap-highlight-color: transparent;

        transition:
            color .2s ease,
            transform .2s ease;
    }

    .mobile-bottom-nav a i {
        font-size: 20px;
        line-height: 1;
    }

    .mobile-bottom-nav a.active {
        color: var(--primary);
        font-weight: var(--fw-bold);
    }

    .mobile-bottom-nav a:active {
        transform: scale(.96);
    }


    /* Bottom nav ketika footer terlihat */

    body.footer-in-view {
        padding-bottom: 0;
    }

    body.footer-in-view .mobile-bottom-nav,
    .mobile-bottom-nav.is-hidden {
        opacity: 0;
        visibility: hidden;
        transform: translateY(100%);
        pointer-events: none;
    }


    /* Floating donate button */

    .floating-donate-btn {
        position: fixed;
        right: var(--space-4);
        bottom: calc(80px + env(safe-area-inset-bottom, 0px));
        z-index: 260;

        display: inline-flex;
        align-items: center;
        gap: var(--space-2);

        height: 48px;
        padding-inline: var(--space-5);

        border: none;
        border-radius: var(--radius-full);

        background: var(--secondary);
        color: var(--bg);

        font-size: var(--fs-xs);
        font-weight: var(--fw-bold);

        box-shadow: var(--shadow);

        transition:
            opacity .25s ease,
            visibility .25s ease,
            transform .2s ease;
    }

    .floating-donate-btn:active {
        transform: scale(.96);
    }

    .floating-donate-btn i {
        font-size: 18px;
    }

    body.footer-in-view .floating-donate-btn {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }


    /* Footer */

    .footer-inner {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--space-5);

        text-align: left;

        padding:
            var(--space-10)
            var(--space-4)
            var(--space-6);
    }

    .footer-brand {
        grid-column: 1 / -1;
        max-width: 100%;
        padding-bottom: var(--space-4);
    }

    .footer-logo img {
        width: 140px;
        max-width: 100%;
        height: auto;
    }

    .footer-socials,
    .socials {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .footer-col {
        display: flex;
        flex-direction: column;
        gap: var(--space-3);

        padding-block: var(--space-4);

        border-top: 1px solid rgba(255, 255, 255, .18);
    }

    .footer-col h4 {
        margin-bottom: var(--space-1);
    }

    .footer-col a,
    .footer-col p {
        justify-content: flex-start;

        word-break: break-word;
        overflow-wrap: anywhere;
    }

    .footer-bottom-inner {
        flex-direction: column !important;
        gap: var(--space-2) !important;

        text-align: center !important;
        padding-inline: var(--space-4);
    }
}


/* ============================================================
   RESPONSIVE HP KECIL
============================================================ */

@media (max-width: 576px) {

    .footer-inner {
        grid-template-columns: 1fr;
        gap: 0;

        text-align: center;

        padding:
            var(--space-8)
            var(--space-4)
            var(--space-5);
    }

    .footer-brand {
        padding-bottom: var(--space-6);
    }

    .footer-logo {
        margin-inline: auto;
    }

    .footer-logo img {
        width: 120px;
    }

    .footer-brand p {
        font-size: var(--fs-xxs);
        line-height: 1.7;
    }

    .footer-socials,
    .socials {
        justify-content: center;
        gap: var(--space-2);
    }

    .footer-socials a,
    .socials span {
        width: 34px;
        height: 34px;
    }

    .footer-col {
        display: grid;
        grid-template-columns: minmax(96px, 128px) minmax(0, 1fr);
        column-gap: var(--space-4);
        row-gap: var(--space-3);
        align-items: start;

        padding-block: var(--space-5);

        text-align: left;
    }

    .footer-col h4 {
        grid-column: 1;
        grid-row: 1;
        align-self: start;

        margin-bottom: 0;

        white-space: normal;
        word-break: break-word;
    }

    .footer-col a,
    .footer-col p {
        grid-column: 2;
        justify-content: flex-start;
    }

    .footer-col a:hover {
        transform: none;
    }

    .footer-bottom p,
    .copyright {
        font-size: var(--fs-xxs);
        line-height: 1.6;
        padding-inline: var(--space-3);
    }
}


/* ============================================================
   RESPONSIVE HP SUPER KECIL
============================================================ */

@media (max-width: 380px) {

    .footer-inner {
        padding-inline: var(--space-3);
        padding-block: var(--space-8) var(--space-5);
    }

    .footer-logo img {
        width: 110px;
    }

    .footer-col {
        grid-template-columns: 1fr;
        row-gap: var(--space-2);

        padding-block: var(--space-5);
    }

    .footer-col h4,
    .footer-col a,
    .footer-col p {
        grid-column: 1;
    }

    .footer-col h4 {
        grid-row: auto;
        margin-bottom: var(--space-1);
    }

    .footer-col a,
    .footer-col p {
        font-size: var(--fs-xxs);
        line-height: 1.65;
    }

    .footer-bottom p,
    .copyright {
        font-size: 10px;
        padding-inline: var(--space-3);
    }
}


/* ============================================================
   REDUCED MOTION
============================================================ */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}