/**
 * Two-Row Navbar - Per A_navbar.txt Wireframe
 * Updated: 03.02.2026
 * Row 1: Logo + [l][c][m][i] actions
 * Row 2: Navigation links with underline for active
 */

/* ========== CSS Variables for Navbar ========== */
:root {
    /* Navbar Font - uses global --font-family from design-system.css */
    --navbar-font: var(--font-family, 'Figtree', -apple-system, sans-serif);

    /* Navbar specific colors */
    --navbar-bg: #ffffff;
    --navbar-border: #e8e8e8;
    --navbar-text: #121117;
    --navbar-text-muted: #6b6b6b;

    /* Nav link colors */
    --nav-link-color: #121117;
    --nav-link-hover-color: #6b6b6b;
    --nav-link-active-color: #121117;

    /* Action item height - all same height */
    --action-item-height: 40px;

    /* Spacing */
    --navbar-row1-height: 76px;  /* 56px * 1.35 = 76px (35% größer) */
    --navbar-row2-height: 44px;
    --nav-link-spacing: 32px;

    /* Border color for action items - same as font color */
    --action-border-color: #121117;
}

/* ========== Navbar Container (Full Width) ========== */
#navbar-container {
    width: 100%;
    max-width: 100vw;
    overflow: visible;
    display: block;
    margin: 0;
    padding: 0;
}

/* ========== Header Container (Two Rows) ========== */
.header {
    width: 100%;
    max-width: 100vw;
    margin: 0;
    padding: 0;
    background-color: var(--navbar-bg);
    border-bottom: 1px solid var(--navbar-border);
    position: sticky;
    top: 0;
    z-index: 10500;
    font-family: var(--navbar-font);
    padding-top: max(0px, env(safe-area-inset-top));
    /* Force vertical stacking of rows */
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch;
    overflow: visible;
}

/* ========== Row 1: Logo + Actions ========== */
.header-row-1 {
    width: 100%;
    height: var(--navbar-row1-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-sizing: border-box;
    padding: 0 16px;
}

/* Logo: [b] Icon + [b.1] Brand Name */
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    flex-shrink: 1; /* Allow logo to shrink */
    min-width: 0; /* Enable text truncation */
    overflow: hidden;
}

.logo-icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}

.brand-name {
    font-family: var(--navbar-font);
    font-size: 16px;
    font-weight: 600;
    color: var(--navbar-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Actions Container [l][c][m][i] - evenly spaced */
.navbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;  /* Gleicher Abstand zwischen allen Items */
    flex-shrink: 0; /* Actions don't shrink */
}

/* All action items same height and alignment */
.navbar-action-item {
    height: var(--action-item-height);
    min-height: var(--action-item-height);
    max-height: var(--action-item-height);
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

/* Language & Currency Selectors [l] [c] */
.language-selector,
.currency-selector {
    position: relative;
    z-index: 10502;
}

/* Hide native select - replaced by custom dropdown */
.navbar-native-select {
    display: none !important;
}

/* ========== Custom Dropdown (Language/Currency) ========== */
.navbar-custom-select {
    position: relative;
}

.navbar-custom-select-btn {
    height: var(--action-item-height) !important;
    min-height: var(--action-item-height) !important;
    padding: 0 12px !important;
    border: 1px solid var(--action-border-color) !important;
    border-radius: 4px !important;
    background-color: #ffffff !important;
    color: var(--navbar-text) !important;
    font-family: var(--navbar-font) !important;
    font-size: 14px !important;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
    display: flex !important;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.navbar-custom-select-btn:hover {
    border-color: var(--navbar-text-muted);
}

.navbar-custom-select-arrow {
    font-size: 10px;
    line-height: 1;
    transition: transform 0.2s ease;
}

.navbar-custom-select.open .navbar-custom-select-arrow {
    transform: rotate(180deg);
}

.navbar-custom-select-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    background: #ffffff;
    border: 1px solid var(--action-border-color);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10503;
    display: none !important;
    padding: 4px 0;
    list-style: none;
    margin: 0;
}

.navbar-custom-select.open .navbar-custom-select-list {
    display: block !important;
}

.navbar-custom-select-option {
    padding: 8px 12px;
    font-family: var(--navbar-font);
    font-size: 14px;
    font-weight: 500;
    color: var(--navbar-text);
    cursor: pointer;
    transition: background-color 0.15s ease;
    white-space: nowrap;
}

.navbar-custom-select-option:hover {
    background-color: #f5f5f5;
}

.navbar-custom-select-option.selected {
    font-weight: 600;
    background-color: #f0f0f0;
}

/* Inbox Link [m] - gleiche Border wie [l],[c],[i] */
.inbox-link {
    height: var(--action-item-height);
    min-height: var(--action-item-height);
    padding: 0 12px;
    border: 1px solid var(--action-border-color);
    border-radius: 4px;
    background-color: #ffffff;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}

.inbox-link:hover {
    border-color: var(--navbar-text-muted);
}

/* Inbox disabled when not logged in */
.inbox-link.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: default;
}

.inbox-text {
    font-family: var(--navbar-font);
    font-size: 14px;
    font-weight: 500;
    color: var(--navbar-text);
}

.inbox-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: #dc2626;
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* User Menu */
.user-menu {
    position: relative;
    height: var(--action-item-height);
    display: flex;
    align-items: center;
}

.btn-login {
    height: var(--action-item-height);
    min-height: var(--action-item-height);
    padding: 0 12px;  /* Gleich wie [c], [m], [i] */
    border: 1px solid var(--action-border-color);
    border-radius: 4px;
    background-color: #ffffff;
    color: var(--navbar-text);
    font-family: var(--navbar-font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}

.btn-login:hover {
    border-color: var(--navbar-text-muted);
}

.user-menu-button {
    height: var(--action-item-height);
    min-height: var(--action-item-height);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid var(--action-border-color);
    box-sizing: border-box;
    border-radius: 4px;
    background-color: #ffffff;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.user-menu-button:hover {
    border-color: var(--navbar-text-muted);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background: var(--navbar-text);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.user-email {
    font-family: var(--navbar-font);
    font-size: 13px;
    font-weight: 500;
    color: var(--navbar-text);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role {
    font-family: var(--navbar-font);
    font-size: 11px;
    font-weight: 400;
    color: var(--navbar-text-muted);
}

/* ========== Row 2: Navigation ========== */
.header-row-2 {
    width: 100%;
    height: var(--navbar-row2-height);
    display: flex;
    align-items: center;
    justify-content: flex-start; /* All links left-aligned */
    border-top: 1px solid var(--navbar-border);
    box-sizing: border-box;
    padding: 0 24px;
}

/* Nav links container (all left-aligned) */
.nav-links {
    display: flex;
    align-items: center;
    gap: var(--nav-link-spacing);
}

.nav-link {
    font-family: var(--navbar-font);
    font-size: 14px;
    font-weight: 500;
    color: var(--nav-link-color);
    text-decoration: none;
    padding: 0;  /* Kein Padding - Button ragt nicht über row-2 hinaus */
    line-height: var(--navbar-row2-height);  /* Vertikal zentriert */
    height: var(--navbar-row2-height);
    position: relative;
    transition: color 0.15s ease;
}

.nav-link:hover {
    color: var(--nav-link-hover-color);
}

/* Active link with underline */
.nav-link.active {
    color: var(--nav-link-active-color);
    font-weight: 600;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 12px;  /* Näher am Text - wie echter Unterstrich */
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--nav-link-active-color);
}


/* ========== User Dropdown Menu ========== */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 240px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10501;
    padding: 8px 0;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    text-align: left;
    font-family: var(--navbar-font);
    font-size: 14px;
    font-weight: 500;
    color: var(--nav-link-color, #121117);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.dropdown-item:hover {
    background-color: #f0f0f0;
}

.dropdown-item-danger {
    color: #dc3545;
}

.dropdown-item-danger:hover {
    background-color: #fee;
    color: #c82333;
}

.dropdown-divider {
    height: 1px;
    background-color: #e0e0e0;
    border: none;
    margin: 8px 0;
}

/* ========== Role Selector Dropdown ========== */
.dropdown-role-selector {
    padding: 12px 16px;
}

.role-selector-label {
    display: block;
    font-size: var(--text-xs, 0.75rem);
    font-weight: 600;
    color: #4a4a4a;
    margin-bottom: 8px;
}

.role-selector-dropdown {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #a0a0a0;
    border-radius: 0;
    background-color: #ffffff;
    font-size: var(--text-sm, 0.875rem);
    color: #000000;
    cursor: pointer;
    transition: all 0.2s ease;
}

.role-selector-dropdown:hover {
    border-color: #808080;
}

.role-selector-dropdown:focus {
    outline: none;
    border-color: #000000;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.role-selector-dropdown:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== Hamburger Menu for Mobile ========== */
.hamburger-menu {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
}

.hamburger-menu span {
    width: 20px;
    height: 2px;
    background-color: var(--navbar-text);
    border-radius: 1px;
    transition: all 0.2s ease;
}

/* ========== Desktop: Ensure Row 2 is visible ========== */
@media (min-width: 769px) {
    .header-row-2 {
        display: flex !important;
    }
}

/* ========== Responsive Design ========== */
@media (max-width: 1024px) {
    .header-row-1 {
        padding: 0 16px;
    }

    .header-row-2 {
        padding: 0 16px;
        gap: 24px;
    }

    .user-email {
        max-width: 100px;
    }
}

@media (max-width: 768px) {
    /* ========== Mobile Navbar Layout ========== */

    :root {
        --navbar-height: 60px;
    }

    .header {
        height: var(--navbar-height);
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 10500;
    }

    /* Hide Row 2 on mobile - navigation moves to hamburger menu */
    .header-row-2 {
        display: none;
    }

    .header-row-1 {
        height: 100%;
        padding: 0 12px;
    }

    .logo h1 {
        font-size: 18px;
    }

    .navbar-actions {
        gap: 8px;
        flex-wrap: nowrap;
        overflow: visible;
    }

    /* Force language/currency selectors to be visible on mobile */
    .navbar-action-item.language-selector,
    .navbar-action-item.currency-selector {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto;
        min-height: 44px;
        max-height: none; /* Reset desktop max-height: 40px */
    }

    /* Custom dropdown mobile styles */
    .navbar-custom-select-btn {
        min-height: 44px !important;
        height: 44px !important;
        padding: 0 10px !important;
    }

    .navbar-custom-select-option {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Ensure native selects stay hidden on mobile */
    .navbar-native-select {
        display: none !important;
    }

    .user-info {
        display: none;
    }

    /* Hamburger Menu - 3 horizontal lines */
    .hamburger-menu {
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: 8px;
        background: none;
        border: none;
        cursor: pointer;
        min-height: 44px;
        min-width: 44px;
        justify-content: center;
        align-items: center;
        border-radius: 4px;
        transition: background-color 0.2s;
    }

    .hamburger-menu:hover,
    .hamburger-menu:active {
        background-color: #f5f5f5;
    }

    .hamburger-menu span {
        width: 22px;
        height: 2px;
        background-color: var(--navbar-text);
        border-radius: 1px;
        transition: all 0.3s ease;
    }

    /* Hamburger menu open state - X animation */
    .hamburger-menu.open span:nth-child(1) {
        transform: translateY(6px) rotate(45deg);
    }

    .hamburger-menu.open span:nth-child(2) {
        opacity: 0;
    }

    .hamburger-menu.open span:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg);
    }

    /* Touch-target optimization */
    .dropdown-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .inbox-link {
        min-height: 44px;
        min-width: 44px;
        padding: 0 8px;
    }

    .user-menu-button {
        min-height: 44px;
        padding: 6px 8px;
    }

    .user-avatar {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }
}

/* ========== Mobile Menu (per Design A_MobileUndAppDesign.txt) ========== */
.mobile-menu {
    position: fixed;
    top: var(--navbar-height, 60px);
    left: 0;
    right: 0;
    bottom: 0;
    /* Enhanced backdrop with blur effect */
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    overflow-y: auto;
    z-index: 10501;
    /* Slide from right animation */
    transform: translateX(100%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-menu.open {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
}

.mobile-menu-section {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--navbar-border, #e0e0e0);
}

.mobile-menu-section:last-child {
    border-bottom: none;
}

.mobile-menu-title {
    font-family: var(--navbar-font);
    font-size: 12px;
    font-weight: 600;
    color: var(--navbar-text-muted, #6b6b6b);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding: 0 16px;
}

.mobile-nav-pill {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    border: none;
    border-radius: 0;
    background-color: transparent;
    color: var(--nav-link-color, #121117);
    font-family: var(--navbar-font);
    font-size: 16px;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s ease;
    min-height: 48px;
}

.mobile-nav-pill:hover,
.mobile-nav-pill:active {
    background-color: transparent;
    color: var(--nav-link-hover-color, #6b6b6b);
}

.mobile-nav-pill.active {
    background-color: transparent;
    color: var(--nav-link-active-color, #121117);
    font-weight: 600;
}

.mobile-nav-pill-icon {
    font-size: var(--text-lg, 1.25rem);
    width: 24px;
    text-align: center;
}

/* Mobile Menu Language/Currency Selectors */
.mobile-menu .mobile-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    min-height: 48px;
}

.mobile-menu .mobile-selector select {
    flex: 1;
    max-width: 200px;
    padding: 10px 12px;
    font-size: var(--text-md, 1rem);
    border: 1px solid var(--pill-border, #ddd);
    border-radius: 8px;
    background-color: #fff;
    min-height: 44px;
}

/* Animation removed - using CSS transitions for mobile menu */

/* ========== Smooth transitions ========== */
.nav-link,
.user-menu-button,
.inbox-link,
.btn-login {
    -webkit-tap-highlight-color: transparent;
}

/* ========== Focus states for accessibility ========== */
.nav-link:focus,
.user-menu-button:focus,
.inbox-link:focus,
.btn-login:focus {
    outline: 2px solid var(--nav-link-active-color);
    outline-offset: 2px;
}
