/* =========================================================================
   vector.id — Global Stylesheet
   Sumber: inc-header.php (dipindahkan untuk caching browser)
   ========================================================================= */

/* =========================================================================
   TEMA WARNA & RESET GLOBAL
   ========================================================================= */
:root {
    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    --text-main: #485361;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --primary: #4f46e5;
    --danger: #ef4444;
    --header-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    --header-height: 70px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html.dark-mode {
    --bg-body: #0b0f19;
    --bg-surface: #131c2e;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #1e293b;
    --primary: #6366f1;
    --header-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

html, body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    padding-top: var(--header-height);
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; background: none; border: none; outline: none; font-family: inherit; }
* { box-sizing: border-box; }

/* =========================================================================
   CUSTOM SCROLLBAR — Tema vector.id (primary indigo)
   ========================================================================= */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

/* CSS Global untuk ikon SVG */
.svg-icon {
    display: inline-block;
    vertical-align: -0.125em;
    fill: currentColor;
    transition: var(--transition);
}

/* =========================================================================
   HEADER UTAMA
   ========================================================================= */
.header-main {
    background: var(--bg-surface);
    height: var(--header-height);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9998;
    box-shadow: var(--header-shadow);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hamburger-btn {
    color: var(--text-main);
    font-size: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}
.hamburger-btn:hover { background: var(--bg-body); color: var(--primary); }

.logo {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: -0.5px;
}
.logo-text span {
    color: var(--primary);
    margin-left: 1px;
}

/* Area Tengah — Search Desktop */
.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 40px;
}
.desktop-search {
    width: 100%;
    max-width: 100%;
    position: relative;
}
.desktop-search input {
    width: 100%;
    padding: 12px 20px 12px 45px;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: var(--bg-body);
    color: var(--text-main);
    font-size: 15px;
    outline: none;
    transition: var(--transition);
}
.desktop-search input:focus {
    border-color: var(--primary);
    background: var(--bg-surface);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.desktop-search .svg-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
}

/* Area Kanan */
.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: flex-end;
}

.btn-icon {
    color: var(--text-main);
    font-size: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
    position: relative;
    overflow: visible;
}
.btn-icon:hover { background: var(--bg-body); color: var(--primary); }

/* Badge keranjang — menempel di pojok kanan atas icon */
.badge {
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    position: absolute;
    top: -2px;
    right: -2px;
    border: 2px solid var(--bg-surface);
    pointer-events: none;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
    margin-left: 10px;
}

.mobile-search-trigger { display: none; }
.desktop-only { display: flex; }

/* =========================================================================
   WRAPPER LAYOUT
   ========================================================================= */
.layout-wrapper {
    display: flex;
    width: 100%;
    min-height: calc(100vh - var(--header-height));
    padding-left: 250px;
    transition: padding-left 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
html.sidebar-mini .layout-wrapper {
    padding-left: 72px;
}

/* =========================================================================
   MOBILE FULL-SCREEN SEARCH
   ========================================================================= */
.mobile-search-fullscreen {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: var(--bg-surface); z-index: 10001;
    display: flex; flex-direction: column;
    opacity: 0; visibility: hidden; transition: opacity 0.2s ease, visibility 0.2s ease;
}
.mobile-search-fullscreen.active { opacity: 1; visibility: visible; }

.fs-search-header {
    display: flex; align-items: center; border-bottom: 1px solid var(--border);
    padding: 15px 20px 15px 20px; background: var(--bg-surface); height: var(--header-height);
}
.fs-search-header input {
    flex: 1; border: none; background: transparent; color: var(--text-main);
    font-size: 16px; font-weight: 400; outline: none; padding: 10px 15px;
}
#fsSearchInput::placeholder {
    font-weight: 300; color: rgba(140, 140, 160, 0.45);
    font-style: italic; font-size: 14px;
}
html.dark-mode #fsSearchInput::placeholder { color: rgba(180, 180, 200, 0.35); }
.fs-btn-close {
    flex-shrink: 0; font-size: 18px; color: var(--text-muted);
    width: 40px; height: 40px; order: -1; margin-right: 10px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--bg-body);
    border: 1px solid var(--border); cursor: pointer;
}
.fs-btn-close:hover { background: var(--border); color: var(--text-main); }
.fs-search-body {
    flex: 1; overflow-y: auto; padding: 24px 20px;
}
.fs-section-label {
    font-size: 11px; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.1em; color: var(--primary); margin-bottom: 14px;
    display: flex; align-items: center; gap: 8px;
}
.fs-section-label::before {
    content: ''; display: inline-block;
    width: 3px; height: 13px;
    background: var(--primary); border-radius: 2px; flex-shrink: 0;
}
.fs-tags {
    display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px;
}
.fs-tag {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 7px 14px; border-radius: 20px; font-size: 13px; font-weight: 600;
    background: rgba(99,102,241,0.07); border: 1.5px solid rgba(99,102,241,0.2);
    color: var(--text-main); cursor: pointer; text-decoration: none;
    transition: all 0.2s ease; white-space: nowrap;
}
.fs-tag:hover {
    background: rgba(99,102,241,0.08); border-color: var(--primary);
    color: var(--primary); transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(99,102,241,0.12);
}
.fs-tag.recent { background: rgba(99,102,241,0.04); }
.fs-tag-del {
    font-size: 11px; color: var(--text-muted); margin-left: 2px;
    line-height: 1; opacity: 0.6;
}
.fs-tag-del:hover { opacity: 1; color: var(--danger); }
#fsRecentSection { display: none; }

/* =========================================================================
   PRODUCT CARD — IMAGE BOX
   ========================================================================= */
.vector-img-box {
    position: relative;
    display: block;
}

/* =========================================================================
   SIDEBAR
   ========================================================================= */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 250px;
    height: calc(100vh - var(--header-height));
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 9997;
}
html.sidebar-mini .sidebar { width: 72px; }

.sidebar-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px);
    z-index: 9999; opacity: 0; visibility: hidden; transition: var(--transition);
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }

/* =========================================================================
   CART BADGE SIDEBAR — tidak menabrak teks nav-item
   ========================================================================= */
.sidebar .cart-badge {
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
    flex-shrink: 0;
}

/* =========================================================================
   RESPONSIVE — MOBILE
   ========================================================================= */
@media (max-width: 992px) {
    .header-center { display: none; }
    .mobile-search-trigger { display: flex; }
    .desktop-only { display: none !important; }

    .header-main {
        padding: 0 15px;
        position: fixed;
        display: grid;
        grid-template-columns: auto 1fr auto;
        justify-content: unset;
    }

    .logo {
        position: static;
        transform: none;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .header-left { min-width: auto; gap: 0; display: flex; align-items: center; }
    .header-right { min-width: auto; gap: 4px; }

    .btn-icon, .hamburger-btn {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }

    .hamburger-btn { margin-left: -5px; }
    .user-avatar { margin-left: 5px; width: 32px; height: 32px; }

    .layout-wrapper { padding-left: 0; }
    html.sidebar-mini .layout-wrapper { padding-left: 0; }

    .sidebar {
        top: 0 !important;
        left: -320px;
        width: 280px !important;
        height: 100vh !important;
        z-index: 10000 !important;
        box-shadow: 5px 0 25px rgba(0,0,0,0.15);
    }
    .sidebar.mobile-active { left: 0; }

    /* Reset sidebar-mini styles saat mode mobile — paksa tampilan full */
    html.sidebar-mini .sidebar { width: 280px !important; left: -320px; }
    html.sidebar-mini .sidebar.mobile-active { left: 0; }
    html.sidebar-mini .sidebar .nav-label { display: block !important; }
    html.sidebar-mini .sidebar .nav-item-text { display: block !important; }
    html.sidebar-mini .sidebar .lang-switcher { display: flex !important; }
    html.sidebar-mini .sidebar .nav-item {
        justify-content: flex-start !important;
        padding: 12px 24px !important;
        border-left: 3px solid transparent;
    }
    html.sidebar-mini .sidebar .nav-item.active { border-left-color: var(--primary); }
    html.sidebar-mini .sidebar .nav-item .svg-icon { margin-right: 15px !important; }
    html.sidebar-mini .sidebar .cart-badge {
        position: static !important;
        margin-left: auto !important;
        padding: 2px 8px !important;
        font-size: 11px !important;
    }
}
