/**
 * Enhanced UI Components CSS
 *
 * Provides styling for advanced UI components:
 * - Modals
 * - Dropdowns
 * - Tooltips
 * - Date Picker
 * - Autocomplete
 * - Progress bars
 * - Tabs
 * - Mobile navigation
 * - Context menus
 *
 * CSS Audit (Feb 2026): ~80% of this file is dead code.
 * Actively used sections:
 *   - .context-menu* (used by Vue components: FolderTree.js, TimelineCanvas.js)
 *   - .notification-badge (used by base.html — also duplicated in notifications.css)
 *   - .search-icon (used in 3 templates)
 * Dead sections (not used in any template or JS):
 *   - .mobile-nav-toggle, .sidebar.mobile-open, .sidebar-backdrop
 *   - .tabs-container, .tabs-nav, .tab-item, .tab-panel
 *   - .notification-center, .notification-item (NOT the same as notifications.css)
 *   - .inline-edit, .inline-edit-value, .inline-edit-input
 *   - .search-bar-wrapper, .search-bar, .search-suggestions
 *   - .image-gallery, .image-lightbox
 *   - .quick-action-btn
 *   - .slide-panel
 *   - .chip, .chip-primary (templates use different chip classes)
 *   - .accordion-icon, .accordion-content (templates use Bootstrap accordion)
 *   - .hide-mobile, .hide-desktop, .no-print
 */

/* ===================================
   Enhanced Mobile Navigation
   =================================== */

.mobile-nav-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 9998;
    background: var(--primary-500);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.75rem;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.mobile-nav-toggle:hover {
    background: var(--primary-600);
    box-shadow: var(--shadow-lg);
}

.mobile-nav-toggle i {
    font-size: 1.25rem;
}

@media (max-width: 768px) {
    .mobile-nav-toggle {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-backdrop.active {
        display: block;
    }
}


/* ===================================
   Enhanced Tab Component
   =================================== */

.tabs-container {
    width: 100%;
}

.tabs-nav {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    gap: 1rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-item {
    padding: 0.75rem 1.5rem;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 500;
    color: var(--gray-600);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative;
}

.tab-item:hover {
    color: var(--primary-500);
}

.tab-item.active {
    color: var(--primary-500);
    border-bottom-color: var(--primary-500);
}

.tab-item:focus {
    outline: 2px solid var(--primary-200);
    outline-offset: 2px;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-panel.active {
    display: block;
}


/* ===================================
   Context Menu
   =================================== */

.context-menu {
    position: fixed;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    padding: 0.5rem 0;
    min-width: 200px;
    z-index: 10000;
    animation: slideDown 0.2s ease;
}

.context-menu-item {
    width: 100%;
    padding: 0.625rem 1rem;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--gray-700);
    transition: all 0.15s ease;
}

.context-menu-item:hover {
    background: var(--gray-100);
    color: var(--primary-600);
}

.context-menu-item:active {
    background: var(--gray-200);
}

.context-menu-item i {
    width: 1.25rem;
    text-align: center;
}

.context-menu-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 0.5rem 0;
}

.context-menu-item.danger {
    color: var(--error-500);
}

.context-menu-item.danger:hover {
    background: var(--error-50);
    color: var(--error-600);
}


/* ===================================
   Notification Center
   =================================== */

.notification-center {
    position: fixed;
    top: 60px;
    right: 1rem;
    width: 380px;
    max-width: calc(100vw - 2rem);
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-height: 500px;
    overflow: hidden;
    z-index: 10000;
    animation: slideDown 0.3s ease;
}

.notification-center-header {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-center-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.notification-center-body {
    overflow-y: auto;
    max-height: 400px;
}

.notification-item {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background 0.2s ease;
}

.notification-item:hover {
    background: var(--gray-50);
}

.notification-item.unread {
    background: var(--primary-50);
}

.notification-item.unread:hover {
    background: var(--primary-100);
}

.notification-item-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--gray-900);
}

.notification-item-body {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
}

.notification-item-time {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.notification-empty {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--gray-500);
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--error-500);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}


/* ===================================
   Inline Editing
   =================================== */

.inline-edit {
    position: relative;
    display: inline-block;
}

.inline-edit-value {
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.inline-edit-value:hover {
    background: var(--gray-100);
}

.inline-edit-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 0.5rem;
    border: 2px solid var(--primary-500);
    border-radius: var(--radius-sm);
    font-size: inherit;
    font-family: inherit;
    z-index: 100;
}

.inline-edit-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-200);
}


/* ===================================
   Search Bar with Suggestions
   =================================== */

.search-bar-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
}

.search-bar {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-full);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.search-bar:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
    pointer-events: none;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    margin-top: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    animation: slideDown 0.2s ease;
}

.search-suggestion {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.15s ease;
}

.search-suggestion:hover {
    background: var(--gray-100);
}

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

.search-suggestion-title {
    font-weight: 500;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.search-suggestion-subtitle {
    font-size: 0.875rem;
    color: var(--gray-600);
}


/* ===================================
   Image Gallery
   =================================== */

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.image-gallery-item {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.image-gallery-item:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.image-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-gallery-item:hover .image-gallery-overlay {
    opacity: 1;
}

.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.image-lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: var(--radius-lg);
}

.image-lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* ===================================
   Quick Action Button (Floating)
   =================================== */

.quick-action-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-500);
    color: white;
    border: none;
    box-shadow: var(--shadow-xl);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    z-index: 998;
}

.quick-action-btn:hover {
    transform: scale(1.1);
    background: var(--primary-600);
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.4);
}

.quick-action-btn:active {
    transform: scale(0.95);
}

@media (max-width: 768px) {
    .quick-action-btn {
        bottom: 1rem;
        right: 1rem;
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
}


/* ===================================
   Slide-out Panel
   =================================== */

.slide-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    max-width: 100vw;
    height: 100%;
    background: white;
    box-shadow: var(--shadow-xl);
    z-index: 10000;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.slide-panel.open {
    right: 0;
}

.slide-panel-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.slide-panel-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.slide-panel-body {
    padding: 1.5rem;
}

.slide-panel-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.slide-panel-backdrop.active {
    opacity: 1;
    pointer-events: all;
}


/* ===================================
   Chip/Tag Component
   =================================== */

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-full);
    background: var(--gray-100);
    color: var(--gray-700);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.chip-primary {
    background: var(--primary-100);
    color: var(--primary-700);
}

.chip-success {
    background: var(--success-100);
    color: var(--success-700);
}

.chip-warning {
    background: var(--warning-100);
    color: var(--warning-700);
}

.chip-error {
    background: var(--error-100);
    color: var(--error-700);
}

.chip-closable {
    padding-right: 0.25rem;
}

.chip-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.chip-close:hover {
    background: rgba(0, 0, 0, 0.1);
}


/* ===================================
   Accordion Component
   =================================== */

.accordion {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.accordion-item {
    border-bottom: 1px solid var(--gray-200);
}

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

.accordion-header {
    width: 100%;
    padding: 1rem 1.5rem;
    background: white;
    border: none;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    transition: background 0.2s ease;
}

.accordion-header:hover {
    background: var(--gray-50);
}

.accordion-header.active {
    background: var(--gray-100);
}

.accordion-icon {
    transition: transform 0.3s ease;
}

.accordion-header.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accordion-content.open {
    max-height: 1000px;
}

.accordion-body {
    padding: 1rem 1.5rem;
}


/* ===================================
   Responsive Utilities
   =================================== */

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }

    .notification-center {
        width: 100%;
        right: 0;
        left: 0;
        top: 60px;
        border-radius: 0;
    }

    .image-gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.5rem;
    }

    .slide-panel {
        width: 100%;
        right: -100%;
    }
}

@media (min-width: 769px) {
    .hide-desktop {
        display: none !important;
    }
}


/* ===================================
   Print Styles
   =================================== */

@media print {
    .no-print,
    .sidebar,
    .mobile-nav-toggle,
    .quick-action-btn,
    .notification-center,
    .slide-panel,
    .modal-backdrop,
    .loading-overlay {
        display: none !important;
    }
}
