/* ============================================
   MetaStrip — Design System
   Modern, clean, lots of white space
   ============================================ */

/* === CSS Custom Properties === */
:root {
    /* Primary palette */
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --primary-light: #EEF2FF;
    --primary-lighter: #F5F3FF;

    /* Accent */
    --accent: #7C3AED;
    --accent-light: #F3E8FF;

    /* Semantic */
    --success: #10B981;
    --success-bg: #ECFDF5;
    --warning: #F59E0B;
    --warning-bg: #FFFBEB;
    --danger: #EF4444;
    --danger-bg: #FEF2F2;
    --info: #06B6D4;
    --info-bg: #ECFEFF;

    /* Neutrals */
    --bg-primary: #F8FAFC;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F1F5F9;
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-tertiary: #94A3B8;
    --border-light: #E2E8F0;
    --border-medium: #CBD5E1;

    /* Glass */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.5);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    --gradient-secondary: linear-gradient(135deg, #06B6D4 0%, #4F46E5 100%);
    --gradient-warm: linear-gradient(135deg, #F59E0B 0%, #EF4444 100%);

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

    /* Layout */
    --sidebar-width: 270px;
    --sidebar-collapsed: 0px;
    --header-height: 72px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.4s ease;
}

/* === Reset & Base === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    background: var(--bg-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button {
    font-family: inherit;
}

/* === Dashboard Layout === */
.dashboard-body {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

/* === Sidebar === */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-base);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.logo-text h1 {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: var(--text-primary);
    line-height: 1.2;
}

.logo-text span {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.sidebar-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-close svg {
    width: 20px;
    height: 20px;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-tertiary);
    padding: 8px 12px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    margin-bottom: 2px;
}

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

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.nav-item.active .nav-icon {
    color: var(--primary);
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon svg {
    width: 20px;
    height: 20px;
}

.nav-badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-badge.coming-soon {
    background: var(--warning-bg);
    color: var(--warning);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-light);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: var(--radius-md);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

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

.user-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    display: block;
    font-size: 12px;
    color: var(--text-tertiary);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.logout-btn:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.logout-btn svg {
    width: 18px;
    height: 18px;
}

/* === Main Content === */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-base);
}

/* Top Header */
.top-header {
    height: var(--header-height);
    padding: 0 32px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.menu-toggle:hover {
    background: var(--bg-tertiary);
}

.menu-toggle svg {
    width: 22px;
    height: 22px;
}

.page-title h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.page-title p {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--success-bg);
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    color: var(--success);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 28px 32px;
}

/* Sections */
.section {
    display: none;
    animation: fadeInSection 0.3s ease;
}

.section.active {
    display: block;
}

@keyframes fadeInSection {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Stats Cards === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    position: relative;
    transition: all var(--transition-base);
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 22px;
    height: 22px;
    color: white;
}

.stat-info {
    flex: 1;
}

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.stat-label {
    display: block;
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: 4px;
    font-weight: 500;
}

.stat-trend {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 4px;
    border-radius: var(--radius-sm);
}

.stat-trend.up {
    color: var(--success);
    background: var(--success-bg);
}

/* === Cards === */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.card-badge {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 100px;
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
}

.card-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    background: none;
    border: none;
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

.card-link:hover {
    opacity: 0.8;
}

/* === Dashboard Grid === */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.chart-card {
    margin-bottom: 0;
}

.chart-card-small {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 24px;
}

.chart-container {
    height: 260px;
    position: relative;
}

.chart-container-sm {
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.type-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
    justify-content: center;
}

.type-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.type-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* === Activity Feed === */
.activity-feed {
    max-height: 320px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

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

.activity-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-dot svg {
    width: 16px;
    height: 16px;
    color: white;
}

.activity-text {
    flex: 1;
}

.activity-text p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.activity-text p strong {
    color: var(--text-primary);
    font-weight: 600;
}

.activity-time {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* === Upload Zone === */
.upload-area {
    margin-bottom: 24px;
}

.upload-zone {
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-2xl);
    padding: 60px 40px;
    text-align: center;
    transition: all var(--transition-base);
    cursor: pointer;
    background: var(--bg-secondary);
    position: relative;
    overflow: hidden;
}

.upload-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-base);
    border-radius: var(--radius-2xl);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-lighter);
}

.upload-zone.dragover {
    transform: scale(1.01);
}

.upload-zone.dragover::before {
    opacity: 0.03;
}

.upload-illustration {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.upload-zone h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    position: relative;
}

.upload-zone p {
    color: var(--text-tertiary);
    font-size: 14px;
    margin-bottom: 4px;
    position: relative;
}

.upload-hint {
    font-size: 13px !important;
    color: var(--text-tertiary) !important;
    margin-top: 4px;
}

.upload-btn-browse {
    margin-top: 20px;
    position: relative;
}

/* === Queue Items === */
.queue-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.queue-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
}

.queue-item.processing {
    background: var(--primary-lighter);
    border: 1px solid var(--primary-light);
}

.queue-item.completed {
    background: var(--success-bg);
    border: 1px solid #D1FAE5;
}

.queue-item.failed {
    background: var(--danger-bg);
    border: 1px solid #FECACA;
}

.queue-file-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    background: white;
}

.queue-file-info {
    flex: 1;
    min-width: 0;
}

.queue-file-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-file-meta {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.queue-progress {
    width: 100%;
    height: 6px;
    background: var(--border-light);
    border-radius: 100px;
    margin-top: 8px;
    overflow: hidden;
}

.queue-progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 100px;
    transition: width 0.4s ease;
    position: relative;
}

.queue-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: progress-shimmer 1.5s infinite;
}

@keyframes progress-shimmer {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(100%);
    }
}

.queue-status-chip {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 100px;
    white-space: nowrap;
    flex-shrink: 0;
}

.queue-status-chip.uploading {
    background: var(--info-bg);
    color: var(--info);
}

.queue-status-chip.processing {
    background: var(--primary-light);
    color: var(--primary);
}

.queue-status-chip.completed {
    background: var(--success-bg);
    color: var(--success);
}

.queue-status-chip.failed {
    background: var(--danger-bg);
    color: var(--danger);
}

/* === Results === */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
}

.result-item.success {
    background: var(--success-bg);
}

.result-item.error {
    background: var(--danger-bg);
}

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

.result-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.result-details {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.result-metadata {
    margin-top: 8px;
}

.result-metadata summary {
    font-size: 12px;
    color: var(--primary);
    cursor: pointer;
    font-weight: 500;
}

.result-metadata ul {
    margin-top: 8px;
    padding-left: 16px;
}

.result-metadata li {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-bottom: 2px;
    word-break: break-all;
}

.result-actions {
    display: flex;
    gap: 8px;
}

/* === History / Files Grid === */
.history-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 10px 16px;
    flex: 1;
    min-width: 200px;
    max-width: 400px;
    transition: all var(--transition-base);
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-box svg {
    width: 18px;
    height: 18px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.search-box input {
    border: none;
    outline: none;
    background: none;
    font-size: 14px;
    color: var(--text-primary);
    width: 100%;
    font-family: inherit;
}

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

.filter-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 100px;
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.chip svg {
    width: 14px;
    height: 14px;
}

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.file-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-base);
}

.file-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.file-card-thumb {
    width: 100%;
    height: 160px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.file-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-card-thumb .file-type-icon {
    width: 48px;
    height: 48px;
    color: var(--text-tertiary);
}

.file-card-thumb .file-type-icon svg {
    width: 100%;
    height: 100%;
}

.file-card-thumb .file-type-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 100px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(4px);
}

.file-card-body {
    padding: 16px;
}

.file-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.file-card-meta {
    font-size: 12px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.file-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.file-status-dot.completed {
    background: var(--success);
}

.file-status-dot.processing {
    background: var(--warning);
}

.file-status-dot.failed {
    background: var(--danger);
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    grid-column: 1 / -1;
}

.empty-state svg {
    margin: 0 auto 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-tertiary);
    margin-bottom: 20px;
}

.empty-state-sm {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
    font-size: 14px;
}

/* === Coming Soon Page === */
.coming-soon-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.coming-soon-content {
    text-align: center;
    max-width: 440px;
}

.coming-soon-icon {
    color: var(--text-tertiary);
    margin-bottom: 24px;
    opacity: 0.4;
}

.coming-soon-icon svg {
    margin: 0 auto;
}

.coming-soon-content h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.coming-soon-content p {
    font-size: 14px;
    color: var(--text-tertiary);
    line-height: 1.7;
    margin-bottom: 32px;
}

.coming-soon-features {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
    margin-bottom: 32px;
}

.cs-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.coming-soon-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 600;
}

/* === Activity Timeline === */
.activity-timeline {
    max-height: 600px;
    overflow-y: auto;
}

.timeline-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition-fast);
}

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

.timeline-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.timeline-icon svg {
    width: 18px;
    height: 18px;
    color: white;
}

.timeline-content {
    flex: 1;
}

.timeline-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.timeline-desc {
    font-size: 13px;
    color: var(--text-tertiary);
}

.timeline-time {
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
    margin-top: 2px;
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-2xl);
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
    box-shadow: var(--shadow-xl);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.modal-close svg {
    width: 18px;
    height: 18px;
}

.modal-body {
    padding: 32px;
}

.modal-thumb {
    width: 100%;
    height: 240px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.modal-thumb .file-type-icon {
    width: 64px;
    height: 64px;
    color: var(--text-tertiary);
}

.modal-thumb .file-type-icon svg {
    width: 100%;
    height: 100%;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    word-break: break-word;
}

.modal-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.modal-detail {
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.modal-detail-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.modal-detail-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-metadata {
    margin-bottom: 24px;
}

.modal-metadata h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.metadata-list {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 16px;
    max-height: 200px;
    overflow-y: auto;
}

.metadata-list li {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 4px 0;
    border-bottom: 1px solid var(--border-light);
    word-break: break-all;
    list-style: none;
}

.metadata-list li:last-child {
    border-bottom: none;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    border: none;
    font-family: inherit;
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-lighter);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #DC2626;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-icon {
    padding: 8px;
    border-radius: var(--radius-sm);
}

/* === Pagination === */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding-top: 24px;
}

.pagination button {
    padding: 8px 14px;
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.pagination button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* === Toast === */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastSlide 0.3s ease, toastFade 0.3s ease 3.7s reverse forwards;
    pointer-events: auto;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

.toast.info {
    background: var(--primary);
}

.toast.warning {
    background: var(--warning);
}

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

@keyframes toastSlide {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastFade {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* === Responsive === */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .chart-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }

    .sidebar-close {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: flex;
    }

    .top-header {
        padding: 0 16px;
    }

    .content-area {
        padding: 20px 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 22px;
    }

    .history-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .history-toolbar-right {
        justify-content: space-between;
    }

    .search-box {
        max-width: none;
    }

    .filter-chips {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }

    .files-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .modal-detail-grid {
        grid-template-columns: 1fr;
    }

    .upload-zone {
        padding: 40px 20px;
    }

    .page-title h2 {
        font-size: 18px;
    }

    .bulk-action-bar {
        left: 16px;
        right: 16px;
        transform: none;
        flex-wrap: wrap;
        gap: 12px;
        padding: 12px 16px;
    }

    .bulk-action-buttons {
        flex-wrap: wrap;
    }

    .video-controls {
        padding: 6px 10px;
    }

    .video-volume-wrap {
        display: none;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .files-grid {
        grid-template-columns: 1fr;
    }

    .confirm-card {
        padding: 24px 20px;
    }
}

/* === Scrollbar === */
* {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

*:hover {
    scrollbar-color: var(--border-medium) transparent;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 100px;
}

::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 100px;
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: background 0.3s ease;
}

*:hover> ::-webkit-scrollbar-thumb,
:hover::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary) !important;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* === Video Player === */
.video-player {
    width: 100%;
    background: #0a0a0f;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
    position: relative;
}

.video-player video {
    width: 100%;
    max-height: 340px;
    display: block;
    cursor: pointer;
    background: #000;
}

.video-player:fullscreen video {
    max-height: none;
    height: calc(100% - 48px);
    object-fit: contain;
}

.video-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.5) 100%);
}

.video-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.video-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.video-btn svg {
    width: 20px;
    height: 20px;
}

.video-play-btn svg {
    width: 22px;
    height: 22px;
}

.video-progress-wrap {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 100px;
    cursor: pointer;
    position: relative;
    transition: height var(--transition-fast);
}

.video-progress-wrap:hover {
    height: 8px;
}

.video-progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 100px;
    width: 0;
    pointer-events: none;
    transition: width 0.1s linear;
}

.video-time {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    min-width: 70px;
    text-align: center;
}

.video-volume-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.video-volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 70px;
    height: 4px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 100px;
    outline: none;
    cursor: pointer;
}

.video-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.video-volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.3);
}

.video-volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

.video-fullscreen-btn svg {
    width: 18px;
    height: 18px;
}

/* === Sidebar overlay for mobile === */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 99;
}

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

/* === History toolbar layout === */
.history-toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* === Button variants === */
.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

.btn-ghost.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.btn-danger-outline {
    border-color: var(--danger) !important;
    color: var(--danger) !important;
}

.btn-danger-outline:hover {
    background: var(--danger-bg) !important;
}

/* === File Card Checkbox (multi-select) === */
.file-card {
    position: relative;
}

.file-card-checkbox {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    background: rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.file-card-checkbox svg {
    width: 14px;
    height: 14px;
    color: white;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

/* Show checkbox in select mode */
.files-grid.select-mode .file-card-checkbox {
    display: flex;
}

/* Hover state */
.files-grid.select-mode .file-card:hover .file-card-checkbox {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.3);
}

/* Selected state */
.file-card.selected .file-card-checkbox {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
}

.file-card.selected .file-card-checkbox svg {
    opacity: 1;
}

.file-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

/* Disable lift on select mode */
.files-grid.select-mode .file-card:hover {
    transform: none;
}

/* === Bulk Action Bar === */
.bulk-action-bar {
    position: fixed;
    bottom: -80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transition: bottom 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.bulk-action-bar.visible {
    bottom: 28px;
}

.bulk-action-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    font-weight: 600;
    font-size: 14px;
}

.bulk-action-info svg {
    flex-shrink: 0;
}

.bulk-action-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* === Confirm Dialog === */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.15s ease;
}

.confirm-overlay.active {
    display: flex;
}

.confirm-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-2xl);
    padding: 32px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    animation: slideUp 0.25s ease;
    box-shadow: var(--shadow-xl);
}

.confirm-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    background: var(--danger-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-icon svg {
    width: 28px;
    height: 28px;
    color: var(--danger);
}

.confirm-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.confirm-message {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-actions .btn {
    min-width: 100px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-lg);
}