/*
 * WalchandPRO — Enterprise Learning Platform
 * Developed and maintained by Euclideum Solutions Private Limited
 *
 * This software includes components licensed under the GNU General Public License (GPL).
 * All original code, product configuration, branding, and non-GPL assets are the intellectual property of
 * Euclideum Solutions Private Limited.
 *
 * Any use, modification, or redistribution must be in accordance with the applicable open-source licenses
 * and any additional terms applicable to proprietary components.
 *
 * Copyright © 2025 Euclideum Solutions Private Limited.
 */

/* ============================================
   Design Tokens
   ============================================ */
:root {
    --primary: #154f95;
    --primary-hover: #1a5fae;
    --link-underline: #154f95;

    /* Header offset — updated by JS when banner shows/hides */
    --header-offset: 89px; /* 33px banner + 56px navbar */

    /* Light Mode */
    --bg-page: #f8fafc;
    --bg-navbar: #ffffff;
    --bg-hover: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border-color: #e2e8f0;
    --shadow-navbar: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-button: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-button-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

/* Dark Mode - Matching LMS Theme */
[data-theme="dark"] {
    --primary: #60a5fa;
    --primary-hover: #93c5fd;
    --link-underline: #60a5fa;
    --bg-page: #0c1222;
    --bg-navbar: #111a2e;
    --bg-hover: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --shadow-navbar: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px -1px rgba(0, 0, 0, 0.4);
    --shadow-button: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-button-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
}

/* ============================================
   Base Styles
   ============================================ */
html {
    background-color: var(--bg-page);
}

body {
    background-color: var(--bg-page);
    color: var(--text-primary);
}

/* ============================================
   Announcement Banner
   ============================================ */
.announcement-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    background-color: #274c91;
    padding: 6px 12px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

@media (min-width: 768px) {
    .announcement-banner {
        padding: 8px 16px;
    }
}

.announcement-banner.is-hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

[data-theme="dark"] .announcement-banner {
    background-color: #274c91;
}

.announcement-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    max-width: 1400px;
    margin: 0 auto;
    flex-wrap: nowrap;
    position: relative;
    padding-right: 28px;
}

@media (min-width: 768px) {
    .announcement-content {
        gap: 8px;
        padding-right: 32px;
        flex-wrap: wrap;
    }
}

.announcement-icon {
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.8);
    display: none;
}

@media (min-width: 768px) {
    .announcement-icon {
        display: flex;
    }
}

/* Mobile: text is a clickable link, fits one line */
.announcement-text {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Tablet/Desktop: text looks like plain label, link handles navigation */
@media (min-width: 768px) {
    .announcement-text {
        font-size: 13px;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        pointer-events: none;
        color: rgba(255, 255, 255, 0.9);
    }
}

/* Mobile: hide separate link (text itself is the link) */
.announcement-link {
    display: none;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    text-decoration: none;
    position: relative;
    margin-left: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Tablet/Desktop: show separate link */
@media (min-width: 768px) {
    .announcement-link {
        display: inline;
    }
}

.announcement-link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 100%;
    height: 1px;
    background-color: #ffffff;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.announcement-link:hover::after {
    opacity: 1;
}

.announcement-close {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.6);
    border-radius: 4px;
    transition: all 0.15s ease;
}

.announcement-close:hover {
    color: rgba(255, 255, 255, 0.9);
    background-color: rgba(255, 255, 255, 0.1);
}

/* ============================================
   Navbar Base
   ============================================ */
.navbar {
    position: fixed;
    top: 33px;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: var(--bg-navbar);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-navbar);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    transition: top 0.3s ease;
}

.navbar.banner-hidden {
    top: 0;
}

.navbar-container {
    position: relative;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 12px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

@media (min-width: 480px) {
    .navbar-container {
        padding: 0 16px;
        gap: 12px;
    }
}

@media (min-width: 768px) {
    .navbar-container {
        padding: 0 24px;
        gap: 16px;
    }
}

@media (min-width: 1400px) {
    .navbar-container {
        max-width: 1400px;
        padding: 0 32px;
    }
}

/* ============================================
   Logo - Responsive
   ============================================ */
.navbar-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.navbar-logo img {
    height: 28px;
    width: auto;
    max-width: 160px;
    transition: height 0.2s ease;
}

/* Scale logo on smaller screens */
@media (max-width: 480px) {
    .navbar-logo img {
        height: 22px;
        max-width: 140px;
    }
}

@media (min-width: 481px) and (max-width: 767px) {
    .navbar-logo img {
        height: 24px;
        max-width: 150px;
    }
}

@media (min-width: 900px) {
    .navbar-logo img {
        height: 36px;
        max-width: 200px;
    }
}

[data-theme="dark"] .navbar-logo img {
    filter: brightness(0) invert(1);
}

/* ============================================
   Navigation Links - Desktop Only (Centered)
   ============================================ */
.navbar-nav {
    display: none;
    align-items: center;
    gap: 4px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

@media (min-width: 900px) {
    .navbar-nav {
        display: flex;
    }
}

/* ============================================
   Nav Link with Underline Animation
   ============================================ */
.nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

/* Underline wrapper - matches text width */
.nav-link span {
    position: relative;
}

.nav-link span::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 2px;
    background-color: var(--link-underline);
    border-radius: 1px;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover span::after {
    transform: scaleX(1);
}

/* ============================================
   Right Actions
   ============================================ */
.navbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

@media (min-width: 480px) {
    .navbar-actions {
        gap: 8px;
    }
}

/* ============================================
   Icon Button
   ============================================ */
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

@media (min-width: 480px) {
    .icon-button {
        width: 36px;
        height: 36px;
    }
}

.icon-button:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.icon-button svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ============================================
   Primary Button
   ============================================ */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    background-color: var(--primary);
    border: none;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    box-shadow: var(--shadow-button);
    transition: all 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-button-hover);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Note: Auth buttons already hidden at max-width: 899px above */

/* ============================================
   Theme Toggle - Desktop only
   ============================================ */
.theme-toggle-desktop {
    display: none;
}

@media (min-width: 900px) {
    .theme-toggle-desktop {
        display: inline-flex;
    }
}

/* ============================================
   Mobile Menu Button
   ============================================ */
.mobile-menu-btn {
    display: inline-flex;
}

@media (min-width: 900px) {
    .mobile-menu-btn {
        display: none;
    }
}

/* ============================================
   Mobile Menu
   ============================================ */
.mobile-menu {
    display: none;
    background-color: var(--bg-navbar);
    border-top: 1px solid var(--border-color);
    padding: 12px 16px 16px;
}

.mobile-menu.is-open {
    display: block;
}

@media (min-width: 900px) {
    .mobile-menu {
        display: none !important;
    }
}

/* Mobile nav links */
.mobile-nav-link {
    display: block;
    padding: 12px 12px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.mobile-nav-link:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
}

/* Divider in mobile menu */
.mobile-menu-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 8px 0;
}

/* Theme toggle row in mobile menu */
.mobile-menu-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
}

.mobile-menu-row .icon-button {
    border: none;
    background-color: var(--bg-hover);
}

/* Login buttons in mobile menu - visible when mobile menu shows */
.mobile-login-btns {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.mobile-login-btn .btn-primary {
    display: flex;
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
}

/* ============================================
   Spacer
   ============================================ */
.navbar-spacer {
    height: 89px; /* 33px banner + 56px navbar */
    transition: height 0.3s ease;
}

.navbar-spacer.banner-hidden {
    height: 56px;
}

/* ============================================
   Utility
   ============================================ */
.hidden {
    display: none !important;
}

/* ============================================
   Main Content - Base only, page-specific styles in page CSS
   ============================================ */
.main-content {
    min-height: calc(100vh - 56px);
    background-color: var(--bg-page);
    margin: 0;
    padding: 0;
}

/* ============================================
   Secondary Button
   ============================================ */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-secondary:hover {
    background-color: var(--bg-hover);
    border-color: var(--text-secondary);
}

/* Block button - Full width */
.btn-block {
    display: flex;
    width: 100%;
    justify-content: center;
}

/* Hide auth buttons on small screens - goes to mobile menu */
@media (max-width: 899px) {
    .navbar-actions .btn-secondary,
    .navbar-actions .btn-primary {
        display: none;
    }
}

/* ============================================
   Search Button with Shortcut Badge
   ============================================ */
.search-btn {
    position: relative;
    gap: 8px;
    padding: 0 10px;
    width: auto;
    justify-content: center;
}

.search-btn .search-shortcut {
    display: none;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    background-color: var(--bg-hover);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

@media (min-width: 900px) {
    .search-btn .search-shortcut {
        display: inline;
    }
}

/* ============================================
   Support Link in Navbar
   ============================================ */
.nav-link-support {
    display: none;
}

@media (min-width: 900px) {
    .nav-link-support {
        display: inline-flex;
    }
}

/* ============================================
   Nav Dropdown (Resources)
   ============================================ */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.nav-dropdown-trigger:hover {
    color: var(--text-primary);
}

/* Underline wrapper for Resources text - matches nav-link style */
.nav-dropdown-trigger span {
    position: relative;
}

.nav-dropdown-trigger span::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 2px;
    background-color: var(--link-underline);
    border-radius: 1px;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-dropdown-trigger:hover span::after,
.nav-dropdown.is-open .nav-dropdown-trigger span::after,
.nav-dropdown:hover .nav-dropdown-trigger span::after {
    transform: scaleX(1);
}

.nav-dropdown-arrow {
    transition: transform 0.2s ease;
    stroke-width: 2.5;
}

.nav-dropdown.is-open .nav-dropdown-arrow {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    min-width: 230px;
    background-color: var(--bg-navbar);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 8px;
    padding-top: 12px;
    margin-top: 4px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 100;
}

/* Bridge the gap between trigger and menu for hover */
.nav-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 8px;
}

[data-theme="dark"] .nav-dropdown-menu {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.nav-dropdown.is-open .nav-dropdown-menu,
.nav-dropdown:hover .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
}

.nav-dropdown:hover .nav-dropdown-arrow {
    transform: rotate(180deg);
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.nav-dropdown-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.nav-dropdown-item svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.nav-dropdown-item:hover svg {
    color: var(--primary);
}

[data-theme="dark"] .nav-dropdown-item:hover svg {
    color: var(--primary);
}

.nav-dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 6px 0;
}

/* ============================================
   User Dropdown (Logged In)
   ============================================ */
.user-dropdown {
    position: relative;
}

.user-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 4px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.15s ease;
}

@media (min-width: 900px) {
    .user-dropdown-trigger {
        padding: 4px 8px 4px 4px;
    }
}

.user-dropdown-trigger:hover {
    background-color: var(--bg-hover);
    border-color: var(--text-secondary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    max-width: 32px;
    max-height: 32px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background-color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    flex-grow: 0;
    box-sizing: border-box;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 1 / 1;
}

.user-avatar-initial {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
}

.user-avatar-lg {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    max-width: 40px;
    max-height: 40px;
    aspect-ratio: 1 / 1;
}

.user-avatar-lg .user-avatar-initial {
    font-size: 16px;
}

.user-avatar-lg img {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    max-width: 40px;
    max-height: 40px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 50%;
}

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

@media (min-width: 900px) {
    .user-info {
        display: flex;
    }
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-email {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.3;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-dropdown-arrow {
    color: var(--text-secondary);
    transition: transform 0.2s ease;
    display: none;
}

@media (min-width: 900px) {
    .user-dropdown-arrow {
        display: block;
    }
}

.user-dropdown.is-open .user-dropdown-arrow {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    transform: translateY(8px);
    min-width: 240px;
    background-color: var(--bg-navbar);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 100;
}

[data-theme="dark"] .user-dropdown-menu {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.user-dropdown.is-open .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 8px 12px;
}

.user-dropdown-header-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-dropdown-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-dropdown-email {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 4px 0;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-secondary);
    text-decoration: none;
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.user-dropdown-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.user-dropdown-item svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.user-dropdown-item:hover svg {
    color: var(--primary);
}

[data-theme="dark"] .user-dropdown-item:hover svg {
    color: var(--primary);
}

.user-dropdown-logout:hover {
    background-color: rgba(220, 38, 38, 0.1);
    color: #dc2626;
}

.user-dropdown-logout:hover svg {
    color: #dc2626;
    stroke: #dc2626;
}

/* ============================================
   Mobile Menu - Enhanced
   ============================================ */
.mobile-search-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    color: var(--text-secondary);
    background-color: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.mobile-search-btn:hover {
    border-color: var(--text-secondary);
}

.mobile-search-btn svg {
    flex-shrink: 0;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-nav-link svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

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

[data-theme="dark"] .mobile-nav-link:hover svg {
    color: var(--primary);
}

.mobile-menu-section-title {
    padding: 16px 12px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mobile-login-btns {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

/* ============================================
   Search Modal
   ============================================ */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 60px 16px 16px;
    visibility: hidden;
    pointer-events: none;
    transition: visibility 0s 0.15s;
}

.search-modal.is-open {
    visibility: visible;
    pointer-events: auto;
    transition: visibility 0s 0s;
}

.search-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.search-modal.is-open .search-modal-backdrop {
    opacity: 1;
}

[data-theme="dark"] .search-modal-backdrop {
    background-color: rgba(0, 0, 0, 0.7);
}

.search-modal-content {
    position: relative;
    width: 100%;
    max-width: 600px;
    max-height: calc(100vh - 120px);
    background-color: var(--bg-navbar);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

[data-theme="dark"] .search-modal-content {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.search-modal.is-open .search-modal-content {
    opacity: 1;
    transform: translateY(0);
}

.search-modal-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0 14px;
    transition: border-color 0.15s ease;
}

.search-input-wrapper:focus-within {
    border-color: var(--primary);
}

[data-theme="dark"] .search-input-wrapper:focus-within {
    border-color: var(--primary);
}

.search-input-icon {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.search-input {
    flex: 1;
    padding: 14px 0;
    font-size: 16px;
    color: var(--text-primary);
    background: none;
    border: none;
    outline: none;
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-close-hint {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    background-color: var(--bg-navbar);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.search-modal-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}

.search-tab {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.search-tab:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.search-tab.is-active {
    background-color: var(--primary);
    color: #ffffff;
}

[data-theme="dark"] .search-tab.is-active {
    background-color: var(--primary);
}

.search-modal-body {
    flex: 1;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    padding: 16px;
}

.search-empty-state,
.search-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.search-empty-state svg,
.search-no-results svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.search-empty-state h3,
.search-no-results h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.search-empty-state p,
.search-no-results p {
    font-size: 14px;
    max-width: 280px;
    line-height: 1.5;
}

.search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.search-loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

[data-theme="dark"] .search-loading-spinner {
    border-top-color: var(--primary);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.search-results-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.15s ease;
}

.search-result-item:hover,
.search-result-item.is-selected {
    background-color: var(--bg-hover);
}

.search-result-image {
    width: 48px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    background-color: var(--bg-hover);
}

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

.search-result-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.search-result-type {
    font-size: 11px;
    font-weight: 500;
    color: var(--primary);
    background-color: rgba(21, 79, 149, 0.1);
    padding: 2px 8px;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

[data-theme="dark"] .search-result-type {
    color: var(--primary);
    background-color: rgba(96, 165, 250, 0.15);
}

.search-modal-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-hover);
}

.search-shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
}

.search-shortcuts kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 500;
    font-family: inherit;
    background-color: var(--bg-navbar);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-right: 4px;
}
