/**
 * navbar.css
 * Main navigation bar (Pastel Casual theme, v1.4 — Flag Active Fix)
 * Extracted from app/Views/layout/navbar.php (RFC-UI-V3 layout externalization).
 */

.main-navbar {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(241, 245, 249, 0.8);
    position: sticky;
    top: 0;
    z-index: 2000;
    padding: 15px 0;
    transition: all 0.3s ease;
}
.main-navbar.scrolled {
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    padding: 10px 0;
}

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

/* Logo */
.nav-logo {
    font-size: 1.5rem;
    font-weight: 900;
    color: #334155;
    text-decoration: none;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.version-badge {
    font-size: 0.7rem;
    color: #3B82F6;
    background: #E0F2FE;
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 700;
    vertical-align: middle;
}

/* Desktop Links */
.nav-links { list-style: none; display: flex; gap: 20px; align-items: center; margin: 0; padding: 0; }
.nav-item {
    text-decoration: none; color: #64748B; font-weight: 600; font-size: 0.95rem;
    transition: color 0.2s;
    position: relative;
    background: none; border: none; cursor: pointer; padding: 0;
    white-space: nowrap;
}
.nav-item:hover { color: #3B82F6; }
.nav-item.active { color: #3B82F6; }
.nav-item.active::after {
    content: ''; position: absolute; bottom: -24px; left: 0; width: 100%; height: 3px;
    background: #3B82F6; border-radius: 3px 3px 0 0;
}

/* Dropdown — RFC-V4 P12: hover bridge + 키보드/클릭 지원 */
.dropdown { position: relative; }
.dropdown-toggle::after {
    content: ' ▾';
    font-size: 0.8em;
    opacity: 0.6;
    margin-left: 2px;
}

/* 버튼-메뉴 사이 invisible hover bridge (margin → padding 변환) */
.dropdown-menu {
    position: absolute;
    top: 100%; right: 0;
    /* padding-top 으로 버튼과 메뉴 사이를 채워서 hover 가 끊기지 않음 */
    padding: 15px 0 0 0;
    margin: 0;
    background: transparent;
    box-shadow: none;
    border: none;
    border-radius: 0;
    min-width: 200px;
    display: none;
    flex-direction: column;
    gap: 0;
}

/* 실제 메뉴 박스는 padding-top 안쪽의 inner wrapper 로 */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: 15px; left: 0; right: 0; bottom: 0;
    background: #fff;
    border: 1px solid #F1F5F9;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    z-index: -1;
}

.dropdown-menu .dropdown-item {
    position: relative;
    margin: 0 10px;
}
.dropdown-menu .dropdown-item:first-of-type { margin-top: 10px; }
.dropdown-menu .dropdown-item:last-of-type  { margin-bottom: 10px; }

/* hover 또는 focus-within 시 표시 (마우스 + 키보드 양쪽 지원) */
.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu,
.dropdown.is-open .dropdown-menu {
    display: flex;
    animation: slideDown 0.18s ease;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
    display: block; padding: 10px 15px;
    color: #334155; font-size: 0.9rem; font-weight: 500;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
    white-space: nowrap;
}
.dropdown-item:hover, .dropdown-item:focus {
    background: #F8FAFC;
    color: #3B82F6;
    outline: none;
}
.dropdown-item.active { background: #E0F2FE; color: #0369A1; }

.dropdown.is-open .dropdown-toggle { color: #3B82F6; }

.nav-btn-pastel {
    background-color: #3B82F6;
    color: #ffffff !important;
    padding: 8px 20px;
    border-radius: 12px;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}
.nav-btn-pastel:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(59, 130, 246, 0.3);
}
.nav-btn-pastel.active {
    background-color: #2563EB;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
}

/* Language Switcher (Flags) */
.lang-switch {
    display: flex; align-items: center; gap: 8px;
    background: #f1f5f9; padding: 5px 8px; border-radius: 20px;
}
.lang-btn {
    font-size: 1.2rem;
    opacity: 0.4;
    transition: all 0.2s;
    filter: grayscale(100%);
    text-decoration: none;
    line-height: 1;
    cursor: pointer;
}
.lang-btn:hover { opacity: 0.8; filter: grayscale(0%); transform: scale(1.1); }
.lang-btn.active { opacity: 1; filter: grayscale(0%); transform: scale(1.1); }

.lang-switch-mobile {
    display: flex; gap: 15px;
}
.lang-switch-mobile .lang-btn { font-size: 1.5rem; }

.menu-icon { margin-right: 6px; font-size: 1.1rem; vertical-align: middle; }

/* Hamburger */
.nav-toggle {
    background: none; border: none; cursor: pointer; display: flex; flex-direction: column; gap: 6px;
    padding: 5px;
}
.bar { width: 24px; height: 2.5px; background-color: #334155; border-radius: 2px; transition: 0.3s; }

/* Mobile Overlay */
.mobile-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100vh;
    background: rgba(15, 23, 42, 0.2); backdrop-filter: blur(4px);
    z-index: 2001;
    opacity: 0; transition: opacity 0.3s;
}
.mobile-overlay.is-active { display: flex; opacity: 1; }

.mobile-menu-card {
    position: absolute; top: 20px; right: 20px; width: 280px;
    background: white; padding: 20px; border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.1);
    transform: translateY(-20px); transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 80vh; overflow-y: auto;
}
.mobile-overlay.is-active .mobile-menu-card { transform: translateY(0); }

.mobile-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.mobile-title { font-weight: 800; color: #1E293B; font-size: 1.1rem; }
.btn-close-mobile { background: none; border: none; font-size: 1.5rem; color: #94A3B8; cursor: pointer; }

.mobile-links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.mobile-links a {
    display: block; padding: 12px 15px; text-decoration: none; color: #334155; font-weight: 600;
    background: #F8FAFC; border-radius: 12px; font-size: 1rem;
    transition: background 0.2s;
}
.mobile-links a:hover, .mobile-links a.active { background: #E0F2FE; color: #0369A1; }

/* Visibility */
.desktop-only { display: flex; }
.mobile-only { display: none; }

@media (max-width: 900px) {
    .desktop-only { display: none; }
    .mobile-only { display: flex; }
}
