/* ==========================================================================
   HNB PARK - Global Navbar, Header, and Mobile Navigation Styles
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Caveat:wght@600;700&display=swap');

:root {
    /* Dynamic Theme Inherited Variables */
    --coderiven-primary: var(--primary, var(--primary-color, var(--bs-primary, currentColor)));
    --coderiven-primary-hover: color-mix(in srgb, var(--coderiven-primary) 85%, black);
    --coderiven-primary-light: color-mix(in srgb, var(--coderiven-primary) 12%, white);
    --coderiven-font: var(--font-stack, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif);
    --coderiven-accent-red: #ff334b;
    --coderiven-dark: var(--text-color, #0f172a);
    --coderiven-navy: #092c4c;
    --coderiven-gray-900: #1e293b;
    --coderiven-gray-700: #334155;
    --coderiven-gray-600: #475569;
    --coderiven-gray-500: #64748b;
    --coderiven-gray-400: #94a3b8;
    --coderiven-gray-200: var(--border-color, #e2e8f0);
    --coderiven-gray-100: #f1f5f9;
    --coderiven-gray-50: #f8fafc;
    --coderiven-star: #fbbf24;
    --coderiven-radius: var(--border-radius-lg, var(--border-radius, 12px));
    --coderiven-radius-sm: var(--border-radius-sm, var(--border-radius, 8px));
    --coderiven-radius-full: 9999px;
    --coderiven-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
    --coderiven-shadow-md: 0 4px 14px rgba(0, 0, 0, 0.06);
    --coderiven-shadow-hover: 0 12px 24px -6px color-mix(in srgb, var(--coderiven-primary) 18%, transparent), 0 6px 12px -4px rgba(0, 0, 0, 0.04);

    /* Backward compatibility aliases */
    --hnb-primary: var(--coderiven-primary);
    --hnb-primary-hover: var(--coderiven-primary-hover);
    --hnb-primary-light: var(--coderiven-primary-light);
    --hnb-font: var(--coderiven-font);
    --hnb-dark: var(--coderiven-dark);
    --hnb-gray-700: var(--coderiven-gray-700);
    --hnb-gray-500: var(--coderiven-gray-500);
    --hnb-gray-200: var(--coderiven-gray-200);
    --hnb-gray-50: var(--coderiven-gray-50);
}

/* Navbar Box Sizing & Dynamic Font Reset */
.coderiven-header, .coderiven-header *,
.coderiven-nav-bar, .coderiven-nav-bar *,
.coderiven-mobile-drawer, .coderiven-mobile-drawer *,
.coderiven-backdrop {
    box-sizing: border-box;
    font-family: var(--coderiven-font);
}

.coderiven-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
}

@keyframes coderivenFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   1. Main Header (Logo, Live Search, Action Badges, User Menu)
   ========================================================================== */
.coderiven-header {
    padding: 12px 0;
    background: #ffffff;
    border-bottom: 1px solid var(--coderiven-gray-200);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.coderiven-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

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

.coderiven-mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--coderiven-gray-700);
    cursor: pointer;
    padding: 2px;
    align-items: center;
    justify-content: center;
}

.coderiven-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -0.6px;
    color: #082f49;
    flex-shrink: 0;
}

.coderiven-logo span {
    color: var(--coderiven-primary);
    margin-left: 2px;
}

.coderiven-logo-img,
.coderiven-logo img,
.coderiven-logo svg {
    height: 30px;
    max-width: 140px;
    object-fit: contain;
    display: block;
}

/* Search Bar */
.coderiven-search-form {
    flex: 1;
    max-width: 540px;
    position: relative;
    display: flex;
    align-items: center;
}

.coderiven-search-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.coderiven-search-input-icon {
    position: absolute;
    left: 11px;
    color: #94a3b8;
    pointer-events: none;
}

.coderiven-search-input {
    width: 100%;
    padding: 6.5px 36px 6.5px 32px;
    font-size: 12.5px;
    border: 1.5px solid #cbd5e1;
    border-radius: var(--coderiven-radius-sm);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #ffffff;
    font-family: inherit;
}

.coderiven-search-input:focus {
    border-color: var(--coderiven-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--coderiven-primary) 15%, transparent);
}

.coderiven-search-clear {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    font-size: 18px;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    transition: color 0.15s;
}

.coderiven-search-clear:hover {
    color: #ef4444;
}

/* Dynamic Autocomplete Dropdown */
.coderiven-search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid var(--coderiven-gray-200);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
    z-index: 1100;
    max-height: 420px;
    overflow-y: auto;
    animation: coderivenFadeIn 0.2s ease-out;
}

.coderiven-search-products {
    display: flex;
    flex-direction: column;
}

.coderiven-search-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    text-decoration: none;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}

.coderiven-search-item:last-child {
    border-bottom: none;
}

.coderiven-search-item:hover {
    background: var(--coderiven-primary-light);
}

.coderiven-search-thumb {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    object-fit: contain;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coderiven-search-info {
    flex: 1;
    min-width: 0;
}

.coderiven-search-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.35;
    margin-bottom: 2px;
    white-space: normal;
    transition: color 0.15s;
}

.coderiven-search-item:hover .coderiven-search-name {
    color: var(--coderiven-primary);
}

.coderiven-search-brand {
    font-size: 11.5px;
    color: #64748b;
}

.coderiven-search-categories {
    padding: 10px 16px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.coderiven-search-cat-chip {
    background: var(--coderiven-primary-light);
    color: var(--coderiven-primary);
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    text-decoration: none;
    transition: background-color 0.15s;
}

.coderiven-search-cat-chip:hover {
    background: color-mix(in srgb, var(--coderiven-primary) 22%, white);
}

.coderiven-search-recents {
    padding: 8px 0;
}

.coderiven-recent-header {
    font-size: 12.5px;
    font-weight: 700;
    color: #1e293b;
    padding: 6px 16px;
}

.coderiven-recent-list {
    display: flex;
    flex-direction: column;
}

.coderiven-recent-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.coderiven-recent-item:hover {
    background: #f8fafc;
    color: var(--coderiven-primary);
}

.coderiven-recent-icon {
    color: #94a3b8;
    display: flex;
    align-items: center;
}

.coderiven-search-empty {
    padding: 18px 16px;
    text-align: center;
    color: #64748b;
    font-size: 13px;
}

/* Header Actions */
.coderiven-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.coderiven-action-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--coderiven-radius-full);
    text-decoration: none;
    color: var(--coderiven-gray-700);
    position: relative;
    transition: background-color 0.2s, color 0.2s;
}

.coderiven-action-link svg {
    width: 18px;
    height: 18px;
    color: var(--coderiven-gray-700);
    transition: color 0.2s;
}

.coderiven-action-link:hover {
    background-color: var(--coderiven-primary-light);
    color: var(--coderiven-primary);
}

.coderiven-action-link:hover svg {
    color: var(--coderiven-primary);
}

.coderiven-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: var(--coderiven-primary);
    color: #ffffff;
    font-size: 9px;
    font-weight: 800;
    min-width: 15px;
    height: 15px;
    line-height: 13px;
    text-align: center;
    padding: 0 3px;
    border-radius: var(--coderiven-radius-full);
    border: 1.5px solid #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.coderiven-badge[style*="display: none"],
.coderiven-badge[data-count="0"],
.coderiven-badge:empty {
    display: none !important;
}

@keyframes hnbBadgeBounce {
    0% { transform: scale(1); }
    40% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

.coderiven-badge.coderiven-badge-bounce {
    animation: hnbBadgeBounce 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* User Avatar & Profile Dropdown */
.coderiven-user-dropdown-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.coderiven-user-avatar-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--coderiven-radius-full);
    border: 1.5px solid transparent;
    padding: 0;
    cursor: pointer;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, border-color 0.2s;
    outline: none;
}

.coderiven-user-avatar-btn:hover {
    transform: scale(1.05);
    border-color: color-mix(in srgb, var(--coderiven-primary) 40%, transparent);
}

.coderiven-user-avatar-initials {
    width: 100%;
    height: 100%;
    border-radius: var(--coderiven-radius-full);
    background: var(--coderiven-primary);
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    box-shadow: 0 1px 4px color-mix(in srgb, var(--coderiven-primary) 30%, transparent);
}

.coderiven-user-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: var(--coderiven-radius-full);
    object-fit: cover;
}

.coderiven-user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 200px;
    background: #ffffff;
    border: 1px solid var(--coderiven-gray-200);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    padding: 6px 0;
    z-index: 1200;
    display: none;
    flex-direction: column;
    animation: coderivenFadeIn 0.2s ease-out;
}

.coderiven-user-menu.show {
    display: flex;
}

.coderiven-user-menu-header {
    padding: 8px 14px 6px 14px;
}

.coderiven-user-menu-name {
    font-size: 12.5px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.coderiven-user-menu-email {
    font-size: 11px;
    color: #64748b;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.coderiven-user-menu-divider {
    height: 1px;
    background: var(--coderiven-gray-200);
    margin: 4px 0;
}

.coderiven-user-menu-item {
    padding: 6px 14px;
    font-size: 12.5px;
    font-weight: 500;
    color: #334155;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    display: block;
}

.coderiven-user-menu-item:hover {
    background: var(--coderiven-primary-light);
    color: var(--coderiven-primary);
}

/* ==========================================================================
   3. Navigation Bar (Centered Links & Dropdowns)
   ========================================================================== */
.coderiven-nav-bar {
    background: #ffffff;
    border-bottom: 1px solid var(--coderiven-gray-200);
    padding: 3px 0;
    position: relative;
}

.coderiven-nav-row {
    display: flex;
    align-items: center;
    justify-content: center;
}

.coderiven-nav-links {
    display: flex;
    align-items: center;
    gap: 18px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.coderiven-nav-links a {
    text-decoration: none;
    color: var(--coderiven-gray-700);
    font-size: 12.5px;
    font-weight: 600;
    transition: color 0.2s;
    padding: 4px 0;
    position: relative;
    display: inline-flex;
    align-items: center;
}

.coderiven-nav-links a:hover,
.coderiven-nav-links a.active {
    color: var(--coderiven-primary);
}

.coderiven-nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--coderiven-primary);
    border-radius: 2px;
}

.coderiven-nav-dropdown {
    position: relative;
}

.coderiven-nav-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 3px;
}

.coderiven-nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    min-width: 160px;
    background: #ffffff;
    border: 1px solid var(--coderiven-gray-200);
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
    padding: 4px 0;
    display: none;
    z-index: 1050;
    flex-direction: column;
    animation: coderivenFadeIn 0.15s ease-out;
}

.coderiven-nav-dropdown:hover .coderiven-nav-dropdown-menu {
    display: flex;
}

.coderiven-nav-dropdown-menu a {
    padding: 6px 12px;
    font-size: 12px;
    color: var(--coderiven-gray-700);
    text-decoration: none;
    display: block;
    transition: background 0.15s, color 0.15s;
}

.coderiven-nav-dropdown-menu a:hover {
    background: var(--coderiven-primary-light);
    color: var(--coderiven-primary);
}

.coderiven-wishlist-badge {
    background: var(--coderiven-accent-red);
}

/* ==========================================================================
   4. Mobile Drawer & Backdrop (Full-Screen Vertically Centered Glass Format)
   ========================================================================== */
.coderiven-mobile-drawer {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    max-width: 100vw;
    height: 100%;
    height: 100dvh;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    z-index: 2000;
    box-shadow: none;
    transition: left 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 60px 0;
}

.coderiven-mobile-drawer.open {
    left: 0;
}

.coderiven-mobile-drawer-inner {
    width: 100%;
    max-width: 500px;
    margin: auto 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.coderiven-drawer-close-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 28px;
}

.coderiven-mobile-close {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: var(--coderiven-radius-full);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    color: var(--coderiven-gray-700);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    outline: none;
}

.coderiven-mobile-close:hover {
    background: #ffffff;
    color: var(--coderiven-gray-900);
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.coderiven-drawer-logo-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-bottom: 32px;
    padding: 0 20px;
}

.coderiven-drawer-logo-wrapper .coderiven-logo {
    font-size: 28px;
    font-weight: 900;
    text-align: center;
    letter-spacing: -0.5px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.coderiven-drawer-logo-wrapper .coderiven-logo-img {
    max-height: 52px;
    max-width: 200px;
    object-fit: contain;
}

.coderiven-mobile-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.coderiven-mobile-nav-item {
    width: 100%;
    border: none !important;
}

.coderiven-mobile-nav-link {
    text-decoration: none !important;
    color: #1e293b !important;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.2px;
    display: block;
    width: 100%;
    text-align: center;
    padding: 14px 24px;
    border-radius: var(--coderiven-radius-md, 8px);
    transition: background 0.15s ease, color 0.15s ease;
}

.coderiven-mobile-nav-link:hover,
.coderiven-mobile-nav-link:active,
.coderiven-mobile-nav-link.active {
    color: var(--coderiven-primary) !important;
    background-color: var(--coderiven-primary-light);
}

.coderiven-mobile-sublist {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background-color: transparent;
    border: none !important;
    margin-top: 4px;
}

.coderiven-mobile-sublink {
    text-decoration: none !important;
    color: #475569 !important;
    font-size: 1.05rem;
    font-weight: 600;
    text-align: center;
    padding: 10px 24px;
    border-radius: var(--coderiven-radius-md, 8px);
    display: block;
    transition: background 0.15s ease, color 0.15s ease;
}

.coderiven-mobile-sublink:hover,
.coderiven-mobile-sublink:active {
    color: var(--coderiven-primary) !important;
    background-color: var(--coderiven-primary-light);
}

.coderiven-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.coderiven-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

/* ==========================================================================
   5. Responsive Navbar Rules
   ========================================================================== */
@media (max-width: 768px) {
    .coderiven-container {
        padding: 0 10px !important;
    }
    .coderiven-topbar {
        display: none;
    }
    .coderiven-header {
        padding: 6px 0 8px 0 !important;
    }
    .coderiven-header-row {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 0 !important;
        row-gap: 8px !important;
    }
    .coderiven-header-left {
        order: 1 !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
    }
    .coderiven-mobile-toggle {
        display: flex !important;
    }
    .coderiven-mobile-toggle svg {
        width: 20px;
        height: 20px;
    }
    .coderiven-logo {
        font-size: 17px !important;
    }
    .coderiven-logo-img,
    .coderiven-logo img,
    .coderiven-logo svg {
        height: 22px !important;
        max-width: 110px !important;
    }
    .coderiven-actions {
        order: 2 !important;
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        margin-left: auto !important;
    }
    .coderiven-search-form {
        order: 3 !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
    }
    .coderiven-nav-bar {
        display: none;
    }
}

