/**
 * KLIMOV RED Design System — Navigation
 *
 * Навигация: main nav bar, dropdowns, theme toggle
 * Extracted from klimov-red.css
 */

/* ========================================
   Legacy Navigation (simple)
   ======================================== */

.nav-bar {
  background: var(--foreground);
  transition: background var(--transition-normal);
}

.nav-link {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-weight: var(--font-weight-regular);
  padding: var(--spacing-2) var(--spacing-3);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.nav-link:hover {
  color: rgba(255, 255, 255, 0.9);
}

.nav-link-active {
  color: #ffffff;
  font-weight: var(--font-weight-medium);
  background: rgba(255, 255, 255, 0.1);
}

/* Theme Switcher - Single Button */
.theme-btn-single {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-btn-single:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

.theme-btn-single:active {
  transform: scale(0.95);
}

/* ========================================
   Navigation — Apple/Lebedev Style
   ======================================== */

.nav-main {
    background: var(--foreground);
    height: 44px;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-container {
    max-width: 100%;
    height: 100%;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 0;
    height: 100%;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-4);
}

/* Logo */
.nav-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    padding: 0 16px 0 0;
    margin-right: 8px;
    height: 100%;
}

.nav-logo img {
    height: 20px;
    filter: brightness(0) invert(1);
    transition: opacity 0.15s ease;
}

.nav-logo:hover img {
    opacity: 0.8;
}

/* Dropdown Menu Item */
.nav-dropdown {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 0 12px;
    height: 100%;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: 400;
    letter-spacing: 0;
    cursor: pointer;
    transition: color 0.12s ease;
    background: none;
    border: none;
    white-space: nowrap;
}

.nav-dropdown-trigger:hover,
.nav-dropdown.active .nav-dropdown-trigger {
    color: #ffffff;
}

.nav-dropdown-trigger svg {
    width: 12px;
    height: 12px;
    opacity: 0.6;
    transition: transform 0.2s ease, opacity 0.15s ease;
}

.nav-dropdown:hover .nav-dropdown-trigger svg,
.nav-dropdown.active .nav-dropdown-trigger svg {
    opacity: 1;
}

.nav-dropdown.open .nav-dropdown-trigger svg {
    transform: rotate(180deg);
}

/* Dropdown Panel */
.nav-dropdown-panel {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.05);
    padding: 6px 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s 0.15s;
    z-index: 1001;
}

.nav-dropdown.open .nav-dropdown-panel,
.nav-dropdown:hover .nav-dropdown-panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s;
}

/* Dropdown Items */
.nav-dropdown-item {
    display: block;
    padding: 8px 16px;
    color: #1d1d1f;
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: 400;
    transition: background 0.1s ease;
    white-space: nowrap;
}

.nav-dropdown-item:hover {
    background: #f5f5f7;
}

.nav-dropdown-item.active {
    color: var(--primary);
    font-weight: 500;
}

/* Dropdown Divider */
.nav-dropdown-divider {
    height: 1px;
    background: #e5e5e5;
    margin: 6px 0;
}

/* Dropdown Section Label */
.nav-dropdown-label {
    padding: 8px 16px 4px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #86868b;
}

/* CTA Item (Выставить счёт) */
.nav-dropdown-item.cta {
    color: var(--primary);
    font-weight: 500;
}

.nav-dropdown-item.cta:hover {
    background: rgba(242, 76, 63, 0.08);
}

/* System Links (right side) */
.nav-system-link {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: var(--font-size-sm);
    transition: color 0.15s ease;
}

.nav-system-link:hover {
    color: rgba(255, 255, 255, 0.9);
}

/* Theme Toggle */
.nav-theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.nav-theme-toggle svg {
    width: 18px;
    height: 18px;
}

/* Dark mode adjustments for nav */
html[data-theme="dark"] .nav-dropdown-panel {
    background: #2a2a2a;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .nav-dropdown-item {
    color: #f5f5f5;
}

html[data-theme="dark"] .nav-dropdown-item:hover {
    background: #3a3a3a;
}

html[data-theme="dark"] .nav-dropdown-divider {
    background: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .nav-dropdown-label {
    color: #86868b;
}

@media (prefers-color-scheme: dark) {
    html[data-theme="auto"] .nav-dropdown-panel {
        background: #2a2a2a;
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
    }

    html[data-theme="auto"] .nav-dropdown-item {
        color: #f5f5f5;
    }

    html[data-theme="auto"] .nav-dropdown-item:hover {
        background: #3a3a3a;
    }

    html[data-theme="auto"] .nav-dropdown-divider {
        background: rgba(255, 255, 255, 0.1);
    }
}
