/**
 * DataSpur CSV Uploader - Main Styles
 * Matches Highline Adventures peek-reporting glassmorphic design
 */

/* CSS Custom Properties */
:root {
    /* Highline Adventures Warm Golden-Brown Color Palette */
    --rgb-jasmine: 255, 231, 122;
    --rgb-tuscan-sun: 248, 202, 89;
    --rgb-sunflower-gold: 243, 176, 37;
    --rgb-harvest-gold: 226, 147, 31;
    --rgb-chocolate-brown: 166, 83, 22;
    --rgb-copper: 190, 111, 38;
    --rgb-copper-2: 193, 114, 38;
    --rgb-saddle-brown: 132, 60, 15;
    --rgb-dark-walnut: 80, 34, 0;
    --rgb-rich-mahogany: 51, 18, 1;
    --rgb-white: 255, 255, 255;
    --rgb-blue: 66, 165, 245;

    /* Glass Physics */
    --glass-opacity: 0.12;
    --glass-blur: 16px;
    --glass-border-opacity: 0.25;

    /* Layout */
    --card-border-radius: 20px;
    --card-padding: 1rem;

    /* Z-Index Hierarchy */
    --z-background: -1;
    --z-card: 10;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-y: auto;
    scroll-behavior: smooth;
    background-color: transparent;
}

body {
    font-family: 'Rubik', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Oxygen, Ubuntu, Cantarell, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: transparent;
    margin: 0;
    min-height: 100vh;
    padding: 0;
    color: #fff;
    overflow-x: hidden;
}

/* Fixed Background Layer - Pattern Image */
.app-with-bg::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-background);
    transform: scale(1.1);
    background-image: url('../assets/bg-pattern.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    pointer-events: none;
}

/* Dark Overlay Layer */
.app-with-bg::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-background);
    background-color: rgba(0, 0, 0, 0.25);
    pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
    .app-with-bg::before {
        animation: subtleZoom 30s ease-in-out infinite alternate;
    }
}

@keyframes subtleZoom {
    0% { transform: scale(1.1); }
    100% { transform: scale(1.15); }
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 16px 32px;
    position: relative;
    z-index: var(--z-card);
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
}

/* Glass Panel Utility Class */
.glass-panel {
    background-color: rgb(31 7 0 / 37%);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgba(255, 255, 255, var(--glass-border-opacity));
    border-radius: var(--card-border-radius);
    box-shadow: 0 8px 32px -4px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@supports not (backdrop-filter: blur(10px)) {
    .glass-panel {
        background-color: rgba(30, 30, 40, 0.92);
        border: 1px solid rgba(255, 255, 255, 0.15);
    }
}

.glass-panel:hover {
    box-shadow: 0 12px 40px -4px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.35);
}

/* ============================================================================
   APP BAR - HEADER
   ============================================================================ */

.app-bar {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 100;
    margin-bottom: 0;
}

.app-bar-content {
    display: flex;
    align-items: center;
    padding: 4px 16px;
    min-height: 64px;
    gap: 4px;
}

.app-bar-title {
    display: flex;
    align-items: center;
}

.logo-header-bar {
    height: 60px;
    width: auto;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.spacer {
    flex: 1;
}

/* Navigation Links */
.nav-desktop {
    display: flex;
    align-items: center;
}

.nav-links-container {
    display: flex;
    overflow: hidden;
    white-space: nowrap;
    max-width: 0;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-links-container.expanded {
    max-width: 800px;
    opacity: 1;
    margin-right: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 400;
}

.nav-link:hover {
    color: rgba(var(--rgb-sunflower-gold), 1);
}

.nav-link.active {
    color: rgba(var(--rgb-sunflower-gold), 1);
    font-weight: 500;
}

.nav-link .material-symbols-outlined {
    font-size: 20px;
}

/* Icon Buttons */
.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: white;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-icon .material-symbols-outlined {
    font-size: 24px;
}

/* Chevron Toggle */
.chevron-toggle {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    transform: rotate(0deg);
}

.chevron-toggle.expanded {
    transform: rotate(90deg);
}

/* Logout Button */
.btn-logout-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.btn-logout-header:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-logout-header .material-symbols-outlined {
    font-size: 20px;
}

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

.mobile-menu {
    position: absolute;
    top: 100%;
    right: 20px;
    background: #6b492c;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    padding: 8px;
    min-width: 200px;
    margin-top: 8px;
    z-index: 1000;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 400;
}

.mobile-menu-item:hover {
    color: rgba(var(--rgb-sunflower-gold), 1);
}

.mobile-menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
    margin: 8px 0;
}

.app-bar-divider {
    width: 1px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 8px;
}

@media (max-width: 959px) {
    .nav-desktop,
    .chevron-toggle,
    .app-bar-divider,
    .btn-logout-header {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .logo-header-bar {
        height: 50px;
    }
}

/* ============================================================================
   MAIN CONTENT
   ============================================================================ */

.main-content {
    padding: 20px;
}

/* Page Title */
.page-title {
    font-size: 2rem;
    font-weight: 600;
    color: rgba(var(--rgb-sunflower-gold), 1);
    margin-bottom: 24px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

/* Upload Card */
.upload-card {
    background: linear-gradient(135deg,
        rgba(var(--rgb-chocolate-brown), 0.25),
        rgba(var(--rgb-saddle-brown), 0.15)
    );
    border: 1px solid rgba(var(--rgb-copper), 0.4);
    border-radius: 16px;
    padding: 24px;
    backdrop-filter: blur(12px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.upload-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(var(--rgb-sunflower-gold), 0.2);
    border-color: rgba(var(--rgb-sunflower-gold), 0.5);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.card-header .material-symbols-outlined {
    font-size: 28px;
    color: rgba(var(--rgb-sunflower-gold), 1);
}

.card-header h2 {
    font-size: 1.3rem;
    color: white;
    margin: 0;
}

/* Drag and Drop Zone */
.drop-zone {
    border: 2px dashed rgba(var(--rgb-copper), 0.5);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.03);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: rgba(var(--rgb-sunflower-gold), 0.8);
    background: rgba(var(--rgb-sunflower-gold), 0.1);
}

.drop-zone .material-symbols-outlined {
    font-size: 48px;
    color: rgba(var(--rgb-tuscan-sun), 0.8);
    display: block;
    margin: 0 auto 12px;
}

.drop-zone p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    margin: 8px 0;
}

.drop-zone .file-types {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg,
        rgba(var(--rgb-chocolate-brown), 0.5),
        rgba(var(--rgb-saddle-brown), 0.3)
    );
    border: 2px solid rgba(var(--rgb-copper), 0.6);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg,
        rgba(var(--rgb-sunflower-gold), 0.4),
        rgba(var(--rgb-harvest-gold), 0.3)
    );
    border-color: rgba(var(--rgb-sunflower-gold), 0.7);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(var(--rgb-sunflower-gold), 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

/* Rollback Button */
.btn-rollback {
    padding: 6px 12px;
    border: 1px solid rgba(239, 83, 80, 0.4);
    border-radius: 8px;
    background: rgba(239, 83, 80, 0.1);
    color: rgb(239, 83, 80);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-rollback:hover {
    background: rgba(239, 83, 80, 0.2);
    border-color: rgba(239, 83, 80, 0.6);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(239, 83, 80, 0.3);
}

.btn-rollback svg {
    width: 14px;
    height: 14px;
}

/* Form Elements */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-select,
.form-input {
    padding: 12px 14px;
    background: rgba(var(--rgb-dark-walnut), 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: #fff;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s ease;
    width: 100%;
}

.form-select:hover,
.form-input:hover {
    border-color: rgba(var(--rgb-sunflower-gold), 0.4);
}

.form-select:focus,
.form-input:focus {
    outline: none;
    border-color: rgba(var(--rgb-sunflower-gold), 0.7);
    background: rgba(var(--rgb-dark-walnut), 0.5);
    box-shadow: 0 0 0 3px rgba(var(--rgb-sunflower-gold), 0.15);
}

.form-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-select option {
    background: rgba(var(--rgb-dark-walnut), 1);
    color: #fff;
    padding: 8px;
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.form-hint {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
}

/* Table */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    backdrop-filter: blur(8px);
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

table th {
    background: linear-gradient(135deg,
        rgba(var(--rgb-chocolate-brown), 0.5),
        rgba(var(--rgb-saddle-brown), 0.3)
    );
    color: rgba(var(--rgb-sunflower-gold), 1);
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid rgba(var(--rgb-copper), 0.6);
}

table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.4);
    color: rgb(76, 175, 80);
}

.badge-warning {
    background: rgba(255, 167, 38, 0.2);
    border: 1px solid rgba(255, 167, 38, 0.4);
    color: rgb(255, 167, 38);
}

.badge-error {
    background: rgba(239, 83, 80, 0.2);
    border: 1px solid rgba(239, 83, 80, 0.4);
    color: rgb(239, 83, 80);
}

.badge-small {
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 4px;
    background: rgba(var(--rgb-sunflower-gold), 0.15);
    border: 1px solid rgba(var(--rgb-sunflower-gold), 0.3);
    color: rgba(var(--rgb-sunflower-gold), 0.9);
    margin-right: 4px;
}

/* Alert */
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    margin-bottom: 16px;
    border-radius: 12px;
    backdrop-filter: blur(12px);
}

.alert .material-symbols-outlined {
    font-size: 24px;
    flex-shrink: 0;
}

.alert-info {
    background: linear-gradient(135deg,
        rgba(66, 165, 245, 0.15),
        rgba(66, 165, 245, 0.08)
    );
    border: 1px solid rgba(66, 165, 245, 0.3);
    border-left: 4px solid rgba(66, 165, 245, 0.8);
    color: rgba(255, 255, 255, 0.9);
}

.alert-info .material-symbols-outlined {
    color: rgba(66, 165, 245, 1);
}

.alert-success {
    background: linear-gradient(135deg,
        rgba(76, 175, 80, 0.15),
        rgba(76, 175, 80, 0.08)
    );
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-left: 4px solid rgba(76, 175, 80, 0.8);
    color: rgba(255, 255, 255, 0.9);
}

.alert-success .material-symbols-outlined {
    color: rgba(76, 175, 80, 1);
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: rgba(var(--rgb-sunflower-gold), 1);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(var(--rgb-rich-mahogany), 0.8);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(var(--rgb-saddle-brown), 0.9);
    border-radius: 10px;
    border: 2px solid rgba(var(--rgb-rich-mahogany), 0.8);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--rgb-copper), 0.95);
}

/* Text Selection */
::selection {
    background: rgba(var(--rgb-sunflower-gold), 0.5);
    color: #000000;
}

/* Focus Visible */
*:focus-visible {
    outline: 2px solid rgba(var(--rgb-sunflower-gold), 0.8);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Responsive */
@media (max-width: 768px) {
    .card-grid {
        grid-template-columns: 1fr;
    }

    .page-title {
        font-size: 1.5rem;
    }
}

/* ============================================================================
   PREVIEW MODAL
   ============================================================================ */

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: none;  /* Hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    overflow-y: auto;
}

.modal-overlay.active {
    display: flex;  /* Show when active class is added */
}

/* Modal Container */
.modal-container {
    background: linear-gradient(135deg,
        rgba(var(--rgb-chocolate-brown), 0.3),
        rgba(var(--rgb-saddle-brown), 0.2)
    );
    border: 1px solid rgba(var(--rgb-copper), 0.5);
    border-radius: 20px;
    backdrop-filter: blur(16px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Modal Header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 1px solid rgba(var(--rgb-copper), 0.3);
}

.modal-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    color: rgba(var(--rgb-sunflower-gold), 1);
    margin: 0;
}

.modal-header h2 .material-symbols-outlined {
    font-size: 28px;
}

/* Modal Body */
.modal-body {
    padding: 24px 28px;
    overflow-y: auto;
    flex: 1;
}

/* Preview Sections */
.preview-section {
    margin-bottom: 28px;
}

.preview-section:last-child {
    margin-bottom: 0;
}

.preview-section h3 {
    font-size: 1.1rem;
    color: rgba(var(--rgb-tuscan-sun), 1);
    margin-bottom: 12px;
    font-weight: 600;
}

/* File Info Grid */
.preview-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.preview-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
}

/* Source Detection Card */
.source-detection-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(var(--rgb-copper), 0.3);
    border-radius: 12px;
    padding: 16px;
}

.source-detection-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.source-name {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
    margin-bottom: 4px;
}

.source-confidence {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Confidence Badge */
.confidence-badge {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.confidence-badge.high {
    background: rgba(76, 175, 80, 0.2);
    border: 2px solid rgba(76, 175, 80, 0.6);
    color: rgb(76, 175, 80);
}

.confidence-badge.medium {
    background: rgba(255, 167, 38, 0.2);
    border: 2px solid rgba(255, 167, 38, 0.6);
    color: rgb(255, 167, 38);
}

.confidence-badge.low {
    background: rgba(239, 83, 80, 0.2);
    border: 2px solid rgba(239, 83, 80, 0.6);
    color: rgb(239, 83, 80);
}

/* Warnings List */
.warnings-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.warning-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(255, 167, 38, 0.1);
    border: 1px solid rgba(255, 167, 38, 0.3);
    border-left: 4px solid rgba(255, 167, 38, 0.8);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
}

.warning-item .material-symbols-outlined {
    color: rgba(255, 167, 38, 1);
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ============================================================================
   STAT TOOLTIPS
   ============================================================================ */

/* Info Icon Button */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.info-icon:hover {
    background: rgba(var(--rgb-sunflower-gold), 0.3);
    transform: scale(1.1);
}

.info-icon .material-symbols-outlined {
    font-size: 14px;
    color: rgba(var(--rgb-sunflower-gold), 0.9);
}

/* Tooltip Container */
.stat-tooltip {
    position: fixed;
    width: 380px;
    max-width: calc(100vw - 40px);
    background: linear-gradient(135deg,
        rgba(var(--rgb-chocolate-brown), 0.95),
        rgba(var(--rgb-saddle-brown), 0.90)
    );
    border: 1px solid rgba(var(--rgb-copper), 0.6);
    border-radius: 16px;
    backdrop-filter: blur(20px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6),
                0 0 0 1px rgba(var(--rgb-sunflower-gold), 0.1);
    padding: 20px;
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.stat-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Tooltip Header */
.stat-tooltip .tooltip-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(var(--rgb-copper), 0.4);
}

.stat-tooltip .tooltip-header .material-symbols-outlined {
    font-size: 24px;
    color: rgba(var(--rgb-sunflower-gold), 1);
}

.stat-tooltip .tooltip-header h4 {
    margin: 0;
    font-size: 1.1rem;
    color: rgba(var(--rgb-sunflower-gold), 1);
    font-weight: 600;
}

/* Tooltip Sections */
.stat-tooltip .tooltip-section {
    margin-bottom: 14px;
}

.stat-tooltip .tooltip-section:last-child {
    margin-bottom: 0;
}

.stat-tooltip .tooltip-section strong {
    display: block;
    font-size: 0.85rem;
    color: rgba(var(--rgb-tuscan-sun), 1);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stat-tooltip .tooltip-section p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
}

/* Caveat Section */
.stat-tooltip .tooltip-section.caveat {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(var(--rgb-copper), 0.3);
}

.stat-tooltip .tooltip-section.caveat strong {
    color: rgba(255, 167, 38, 1);
}

.stat-tooltip .tooltip-section ul {
    margin: 0;
    padding-left: 20px;
    list-style-type: disc;
}

.stat-tooltip .tooltip-section li {
    font-size: 0.85rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 4px;
}

.stat-tooltip .tooltip-section li:last-child {
    margin-bottom: 0;
}

/* Mobile Tooltip Adjustments */
@media (max-width: 768px) {
    .stat-tooltip {
        width: 320px;
        padding: 16px;
    }

    .stat-tooltip .tooltip-header h4 {
        font-size: 1rem;
    }

    .stat-tooltip .tooltip-section p {
        font-size: 0.85rem;
    }

    .stat-tooltip .tooltip-section li {
        font-size: 0.8rem;
    }
}

/* Mappings Table */
.mappings-table-wrapper {
    overflow-x: auto;
    border: 1px solid rgba(var(--rgb-copper), 0.3);
    border-radius: 12px;
}

.mappings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.mappings-table thead tr {
    background: linear-gradient(135deg,
        rgba(var(--rgb-chocolate-brown), 0.4),
        rgba(var(--rgb-saddle-brown), 0.25)
    );
}

.mappings-table th {
    padding: 12px 14px;
    text-align: left;
    color: rgba(var(--rgb-sunflower-gold), 1);
    font-weight: 600;
    border-bottom: 2px solid rgba(var(--rgb-copper), 0.5);
}

.mappings-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.mappings-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.mappings-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

/* Data Preview Table */
.data-preview-wrapper {
    overflow-x: auto;
    border: 1px solid rgba(var(--rgb-copper), 0.3);
    border-radius: 12px;
}

.data-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-preview-table thead tr {
    background: linear-gradient(135deg,
        rgba(var(--rgb-chocolate-brown), 0.4),
        rgba(var(--rgb-saddle-brown), 0.25)
    );
}

.data-preview-table th {
    padding: 10px 12px;
    text-align: left;
    color: rgba(var(--rgb-sunflower-gold), 1);
    font-weight: 600;
    border-bottom: 2px solid rgba(var(--rgb-copper), 0.5);
    white-space: nowrap;
}

.data-preview-table td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-preview-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.data-preview-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

/* Modal Footer */
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 28px;
    border-top: 1px solid rgba(var(--rgb-copper), 0.3);
}

/* Modal Responsive */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 10px;
    }

    .modal-container {
        max-height: 95vh;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 16px 20px;
    }

    .modal-header h2 {
        font-size: 1.2rem;
    }

    .preview-section h3 {
        font-size: 1rem;
    }

    .preview-info-grid {
        grid-template-columns: 1fr;
    }

    .source-detection-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .modal-footer {
        flex-direction: column-reverse;
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================================================
   BULK ACTIONS BAR
   ============================================================================ */

/* Bulk Actions Bar */
.bulk-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg,
        rgba(var(--rgb-chocolate-brown), 0.4),
        rgba(var(--rgb-saddle-brown), 0.25)
    );
    border: 1px solid rgba(var(--rgb-copper), 0.4);
    border-radius: 12px;
    margin-bottom: 16px;
    backdrop-filter: blur(8px);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bulk-actions-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bulk-actions-left input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

#selectionCounter {
    font-size: 0.95rem;
    color: rgba(var(--rgb-sunflower-gold), 1);
    font-weight: 600;
}

.bulk-actions-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Bulk Action Buttons */
.btn-bulk-action {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(8px);
}

.btn-bulk-action .material-symbols-outlined {
    font-size: 18px;
}

.btn-bulk-rollback {
    background: rgba(255, 167, 38, 0.15);
    border: 1px solid rgba(255, 167, 38, 0.4);
    color: rgb(255, 167, 38);
}

.btn-bulk-rollback:hover {
    background: rgba(255, 167, 38, 0.25);
    border-color: rgba(255, 167, 38, 0.6);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 167, 38, 0.3);
}

.btn-bulk-delete {
    background: rgba(239, 83, 80, 0.15);
    border: 1px solid rgba(239, 83, 80, 0.4);
    color: rgb(239, 83, 80);
}

.btn-bulk-delete:hover {
    background: rgba(239, 83, 80, 0.25);
    border-color: rgba(239, 83, 80, 0.6);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(239, 83, 80, 0.3);
}

/* Checkbox Styling in Table */
table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: rgba(var(--rgb-sunflower-gold), 1);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .bulk-actions-bar {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .bulk-actions-left {
        justify-content: center;
    }

    .bulk-actions-right {
        flex-direction: column;
        gap: 8px;
    }

    .btn-bulk-action {
        width: 100%;
        justify-content: center;
    }

    .btn-bulk-action span:not(.material-symbols-outlined) {
        display: inline;
    }
}

/* ============================================================================
   SOURCE REGISTRATION MODAL STYLES
   ============================================================================ */

/* Modal Large Size */
.modal-large {
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(var(--rgb-sunflower-gold), 0.6);
    box-shadow: 0 0 0 3px rgba(var(--rgb-sunflower-gold), 0.1);
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

/* Category Input Group */
.category-input-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

.category-input-group select,
.category-input-group input {
    flex: 1;
}

.or-divider {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
    white-space: nowrap;
}

/* Checkbox Label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: rgba(var(--rgb-sunflower-gold), 1);
}

/* Field Mappings Section */
.field-mappings-section {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 8px;
    margin-top: 16px;
}

.field-mappings-section h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
}

.field-mappings-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.field-mapping-row {
    display: grid;
    grid-template-columns: 1fr 1fr 100px;
    gap: 12px;
    align-items: center;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.field-mapping-row .csv-column {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 12px;
    border-radius: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.field-mapping-row select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px;
    border-radius: 4px;
    font-size: 13px;
}

.field-mapping-row select:focus {
    outline: none;
    border-color: rgba(var(--rgb-sunflower-gold), 0.6);
}

/* Select dropdown options styling - fix white text on white background */
.form-control option,
.field-mapping-row select option,
select option {
    background-color: rgba(var(--rgb-saddle-brown), 0.95);
    color: rgba(255, 255, 255, 0.95);
    padding: 8px;
}

/* Confidence Badges */
.confidence-badge {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 12px;
    text-align: center;
    font-weight: 600;
    text-transform: uppercase;
}

.confidence-high {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.4);
}

.confidence-medium {
    background: rgba(255, 193, 7, 0.2);
    color: #FFC107;
    border: 1px solid rgba(255, 193, 7, 0.4);
}

.confidence-low {
    background: rgba(158, 158, 158, 0.2);
    color: #9E9E9E;
    border: 1px solid rgba(158, 158, 158, 0.4);
}

/* Text Muted */
.text-muted {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .modal-large {
        max-width: 95vw;
        max-height: 95vh;
    }

    .category-input-group {
        flex-direction: column;
        align-items: stretch;
    }

    .or-divider {
        text-align: center;
    }

    .field-mapping-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .field-mapping-row .csv-column {
        font-size: 12px;
    }

    .confidence-badge {
        justify-self: start;
    }
}

/* ============================================================================
   APPLICATION SIDEBAR NAVIGATION
   ============================================================================ */

/* Menu Icon Button (Top Right) */
.app-nav-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: white;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
    margin-right: 8px;
}

.app-nav-menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.app-nav-menu-btn .material-symbols-outlined {
    font-size: 24px;
    transition: transform 0.3s ease;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Sidebar Navigation */
.sidebar {
    position: fixed;
    top: 0;
    right: -380px;
    width: 380px;
    height: 100vh;
    background: linear-gradient(135deg,
        rgba(var(--rgb-chocolate-brown), 0.85),
        rgba(var(--rgb-saddle-brown), 0.80)
    );
    border-left: 1px solid rgba(var(--rgb-copper), 0.4);
    backdrop-filter: blur(var(--glass-blur));
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.sidebar.open {
    right: 0;
}

/* Sidebar Header */
.sidebar-header {
    padding: 24px 28px;
    border-bottom: 1px solid rgba(var(--rgb-copper), 0.3);
}

.sidebar-header h2 {
    color: rgba(var(--rgb-sunflower-gold), 1);
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Sidebar Content */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Sidebar Links */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    font-size: 1rem;
}

.sidebar-link:hover {
    background: rgba(var(--rgb-sunflower-gold), 0.15);
    border-color: rgba(var(--rgb-sunflower-gold), 0.3);
    color: rgba(var(--rgb-sunflower-gold), 1);
    transform: translateX(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.sidebar-link.active {
    background: rgba(var(--rgb-sunflower-gold), 0.2);
    border-color: rgba(var(--rgb-sunflower-gold), 0.5);
    color: rgba(var(--rgb-sunflower-gold), 1);
    font-weight: 500;
}

.sidebar-link .material-symbols-outlined {
    font-size: 24px;
    flex-shrink: 0;
}

/* Sidebar Scrollbar */
.sidebar-content::-webkit-scrollbar {
    width: 8px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(var(--rgb-copper), 0.6);
    border-radius: 4px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--rgb-copper), 0.8);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        right: -100%;
    }

    .sidebar-header {
        padding: 20px 24px;
    }

    .sidebar-header h2 {
        font-size: 1.3rem;
    }

    .sidebar-content {
        padding: 12px;
    }

    .sidebar-link {
        padding: 14px 18px;
    }
}

/* ============================================================================
   COMBOBOX (Source/Section selector with create-new option)
   ============================================================================ */

.combobox-wrapper {
    position: relative;
    display: flex;
    align-items: stretch;
}

.combobox-wrapper .form-input {
    padding-right: 44px; /* Make room for toggle button */
    border-radius: 10px;
}

.combobox-toggle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 0 10px 10px 0;
}

.combobox-toggle:hover:not(:disabled) {
    color: rgba(var(--rgb-sunflower-gold), 1);
    background: rgba(var(--rgb-sunflower-gold), 0.1);
}

.combobox-toggle:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.combobox-toggle .material-symbols-outlined {
    font-size: 22px;
    transition: transform 0.2s ease;
}

.combobox-dropdown.show + .combobox-toggle .material-symbols-outlined,
.combobox-wrapper:focus-within .combobox-toggle .material-symbols-outlined {
    transform: rotate(180deg);
}

.combobox-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: rgba(var(--rgb-dark-walnut), 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.combobox-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.combobox-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
}

.combobox-option:hover {
    background: rgba(var(--rgb-sunflower-gold), 0.15);
}

.combobox-option:first-child {
    border-radius: 10px 10px 0 0;
}

.combobox-option:last-child {
    border-radius: 0 0 10px 10px;
}

.combobox-option:only-child {
    border-radius: 10px;
}

.combobox-option .material-symbols-outlined {
    font-size: 20px;
    flex-shrink: 0;
}

.combobox-option.create-new {
    background: rgba(var(--rgb-sunflower-gold), 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(var(--rgb-sunflower-gold), 1);
}

.combobox-option.create-new:hover {
    background: rgba(var(--rgb-sunflower-gold), 0.2);
}

.combobox-option.create-new .material-symbols-outlined {
    color: rgba(var(--rgb-sunflower-gold), 1);
}

.combobox-empty {
    padding: 16px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
}

/* Scrollbar for combobox dropdown */
.combobox-dropdown::-webkit-scrollbar {
    width: 6px;
}

.combobox-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.combobox-dropdown::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.combobox-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Disabled state for form-input in combobox */
.combobox-wrapper .form-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(var(--rgb-dark-walnut), 0.2);
}
