/* === VARIABLES === */
:root {
    /* Colors - Cyberpunk/Terminal aesthetic */
    --bg-primary: #0a0e14;
    --bg-secondary: #0d1117;
    --bg-tertiary: #151b23;
    --bg-elevated: #1c232d;
    --bg-hover: #252d38;
    
    --border-primary: #30363d;
    --border-focus: #58a6ff;
    
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    
    --accent-primary: #00d9ff;
    --accent-secondary: #7c3aed;
    --accent-gradient: linear-gradient(135deg, #00d9ff 0%, #7c3aed 100%);
    
    --success: #3fb950;
    --warning: #d29922;
    --error: #f85149;
    --info: #58a6ff;
    
    /* Typography */
    --font-sans: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    
    /* Border radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(0, 217, 255, 0.3);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms 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: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* === LOADING SCREEN === */
.loading-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    color: var(--text-secondary);
    font-size: 14px;
}

.loader-ring {
    width: 48px;
    height: 48px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader-ring.small {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === APP LAYOUT === */
.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    opacity: 1;
    transition: opacity var(--transition-normal);
}

.app.hidden {
    opacity: 0;
    pointer-events: none;
}

/* === HEADER === */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left, .header-right, .header-center {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.header-center {
    flex: 1;
    justify-content: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 700;
    font-size: 18px;
    color: var(--text-primary);
}

.logo-icon {
    width: 28px;
    height: 28px;
    color: var(--accent-primary);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    font-size: 13px;
    font-family: var(--font-mono);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: var(--success);
    animation: none;
}

.status-dot.disconnected {
    background: var(--error);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* === DATE SELECTOR === */
.date-selector {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    background: var(--bg-tertiary);
    padding: var(--space-xs);
    border-radius: var(--radius-md);
}

.date-input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 14px;
    padding: var(--space-xs) var(--space-sm);
    cursor: pointer;
}

.date-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

/* === BUTTONS === */
.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.btn-icon.small {
    width: 28px;
    height: 28px;
}

.btn-icon.small svg {
    width: 14px;
    height: 14px;
}

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary svg {
    width: 18px;
    height: 18px;
}

/* === MAIN LAYOUT === */
.main {
    display: grid;
    grid-template-columns: 280px 1fr 300px;
    gap: var(--space-lg);
    padding: var(--space-lg);
    flex: 1;
    min-height: 0;
}

@media (max-width: 1200px) {
    .main {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        order: 2;
    }
    
    .content {
        order: 1;
    }
    
    .files-sidebar {
        order: 3;
    }
}

/* === SIDEBAR & PANELS === */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.panel-title svg {
    width: 16px;
    height: 16px;
    color: var(--accent-primary);
}

/* === TASK BUTTONS === */
.task-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.task-btn {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.task-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-primary);
    transform: translateX(4px);
}

.task-btn:active {
    transform: translateX(2px);
}

.task-btn.running {
    border-color: var(--accent-primary);
    box-shadow: 0 0 12px rgba(0, 217, 255, 0.2);
}

.task-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    color: var(--accent-primary);
}

.task-btn-icon svg {
    width: 20px;
    height: 20px;
}

.task-btn-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.task-btn-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.task-btn-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* === TASK HISTORY === */
.task-filters {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
}

.filter-select,
.form-group select,
select {
    width: 100%;
    height: 44px;
    padding: 0 calc(var(--space-md) * 2 + 12px) 0 var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-sans);
    line-height: 44px;
    cursor: pointer;
    transition: all var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-md) center;
    box-sizing: border-box;
}

.filter-select:hover,
.form-group select:hover,
select:hover {
    border-color: var(--border-focus);
    background-color: var(--bg-hover);
}

.filter-select:focus,
.form-group select:focus,
select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.1);
}

.filter-select option,
.form-group select option,
select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: var(--space-sm);
}

.task-history {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 400px;
    overflow-y: auto;
}

.task-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    padding: var(--space-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 13px;
    transition: all var(--transition-fast);
}

.task-item:hover {
    background: var(--bg-hover);
}

.task-item-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.task-item-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.task-item-status.pending { background: var(--text-muted); }
.task-item-status.running { background: var(--info); animation: pulse 1s infinite; }
.task-item-status.completed { background: var(--success); }
.task-item-status.failed { background: var(--error); }
.task-item-status.cancelled { background: var(--warning); }

.task-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.task-item-name {
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-item-time {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.task-cancel-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.task-item:hover .task-cancel-btn {
    opacity: 1;
}

.task-cancel-btn:hover {
    background: var(--bg-elevated);
    color: var(--error);
}

.task-cancel-btn svg {
    width: 12px;
}

/* === Task Pagination === */
.task-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-sm);
    margin-top: var(--space-sm);
    border-top: 1px solid var(--border-primary);
}

.btn-pagination {
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-pagination:hover {
    background: var(--bg-hover);
    border-color: var(--border-focus);
}

.btn-pagination:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}
    height: 12px;
}

.task-progress {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-xs);
}

.task-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.task-progress-fill {
    height: 100%;
    background: var(--accent-primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-normal);
    animation: progress-shimmer 1.5s infinite;
}

@keyframes progress-shimmer {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.task-progress-text {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    min-width: 35px;
    text-align: right;
}

.task-message {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: var(--space-xs);
}

.task-error {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: rgba(248, 81, 73, 0.1);
    border-left: 2px solid var(--error);
    border-radius: var(--radius-sm);
    font-size: 11px;
    color: var(--error);
    margin-top: var(--space-xs);
}

.task-error svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.task-error span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* === SCREENSHOT === */
.content {
    display: flex;
    flex-direction: column;
}

.screenshot-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.screenshot-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    min-height: 400px;
}

.screenshot-wrapper img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.screenshot-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
}

.screenshot-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.screenshot-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-primary);
}

.screenshot-time {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
}

/* === FILES PANEL === */
.files-sidebar {
    min-width: 0;
}

.file-count {
    margin-left: auto;
    padding: 2px 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-family: var(--font-mono);
}

.files-controls {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box svg {
    position: absolute;
    left: var(--space-sm);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}

.search-box input {
    width: 100%;
    padding: var(--space-sm) var(--space-sm) var(--space-sm) 32px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    transition: all var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.1);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-clear {
    position: absolute;
    right: var(--space-xs);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.search-clear:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.search-clear svg {
    width: 12px;
    height: 12px;
    position: static;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.sort-select {
    flex: 1;
    height: 36px;
    padding: 0 calc(var(--space-sm) * 2 + 12px) 0 var(--space-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-sans);
    line-height: 36px;
    cursor: pointer;
    transition: all var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-sm) center;
    box-sizing: border-box;
}

.sort-select:hover {
    border-color: var(--border-focus);
    background-color: var(--bg-hover);
}

.sort-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.1);
}

.sort-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: var(--space-sm);
}

.files-stats {
    display: flex;
    justify-content: space-between;
    padding: var(--space-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-md);
    font-size: 12px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.stat-label {
    color: var(--text-muted);
}

.stat-value {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-weight: 600;
}

.upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-lg);
    border: 2px dashed var(--border-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: var(--space-md);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent-primary);
    background: rgba(0, 217, 255, 0.05);
}

.upload-zone svg {
    width: 32px;
    height: 32px;
    color: var(--text-muted);
}

.upload-zone span {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

.upload-hint {
    font-size: 11px !important;
    color: var(--text-muted) !important;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    max-height: 400px;
    overflow-y: auto;
}

.file-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.file-item:hover {
    background: var(--bg-hover);
}

.file-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.file-icon svg {
    width: 16px;
    height: 16px;
}

.file-icon.image { color: var(--success); }
.file-icon.video { color: var(--accent-primary); }

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.file-name:hover {
    color: var(--accent-primary);
}

.file-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.file-actions {
    display: flex;
    gap: var(--space-xs);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.file-item:hover .file-actions {
    opacity: 1;
}

.file-action {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.file-action:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.file-action.delete:hover {
    color: var(--error);
}

.file-action svg {
    width: 14px;
    height: 14px;
}

/* === EMPTY STATE === */
.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    color: var(--text-muted);
    font-size: 13px;
}

/* === MODALS === */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
}

.modal.visible {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 400px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transform: scale(0.95) translateY(20px);
    transition: transform var(--transition-fast);
}

.modal.visible .modal-content {
    transform: scale(1) translateY(0);
}

.modal-content.large {
    max-width: 800px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-primary);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-body {
    padding: var(--space-lg);
}

.shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.shortcut-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-sm);
}

.shortcut-item kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.shortcut-item span {
    flex: 1;
    color: var(--text-secondary);
    font-size: 13px;
}

.preview-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    background: #000;
}

.preview-body img,
.preview-body video {
    max-width: 100%;
    max-height: 60vh;
}

.preview-body img { display: block; }
.preview-body video { display: none; }

.preview-modal.video .preview-body img { display: none; }
.preview-modal.video .preview-body video { display: block; }

/* === SYSTEM STATUS === */
.system-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-md);
}

.status-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

.status-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
}

.status-card-header svg {
    width: 20px;
    height: 20px;
    color: var(--accent-primary);
}

.status-card-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.status-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.status-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.status-details span {
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: var(--space-xs);
}

.progress-fill {
    height: 100%;
    background: var(--accent-primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-normal);
}

.progress-fill.warning {
    background: var(--warning);
}

.progress-fill.danger {
    background: var(--error);
}

/* === USERS MANAGEMENT === */
.users-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 500px;
    overflow-y: auto;
}

/* === Scheduler === */
.scheduler-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 500px;
    overflow-y: auto;
}

.schedule-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-primary);
}

.schedule-info {
    flex: 1;
}

.schedule-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.schedule-details {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    font-size: 12px;
    color: var(--text-secondary);
}

.schedule-actions {
    display: flex;
    gap: var(--space-xs);
}

.schedule-config {
    margin-top: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.cron-inputs {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.cron-inputs input {
    flex: 1;
    max-width: 100px;
    height: 44px;
    padding: 0 var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 44px;
    text-align: center;
    transition: all var(--transition-fast);
    box-sizing: border-box;
}

.cron-inputs input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.1);
}

.cron-inputs input:hover {
    border-color: var(--border-focus);
    background-color: var(--bg-hover);
}

.cron-inputs input::placeholder {
    color: var(--text-muted);
}

.cron-inputs span {
    color: var(--text-secondary);
    font-size: 18px;
    font-weight: 600;
    line-height: 44px;
}

.interval-inputs {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.interval-inputs input {
    flex: 1;
    height: 44px;
    padding: 0 var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 44px;
    text-align: center;
    transition: all var(--transition-fast);
    box-sizing: border-box;
}

.interval-inputs input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.1);
}

.interval-inputs input:hover {
    border-color: var(--border-focus);
    background-color: var(--bg-hover);
}

.interval-inputs input::placeholder {
    color: var(--text-muted);
}

.interval-inputs span {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 44px;
}

.file-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    max-height: 300px;
    overflow-y: auto;
}

.file-checkbox-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.file-checkbox-item:hover {
    background: var(--bg-hover);
}

.file-checkbox-item input[type="checkbox"] {
    cursor: pointer;
}

.user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.user-item:hover {
    background: var(--bg-hover);
}

.user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.user-badge {
    padding: 2px 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-family: var(--font-mono);
}

.user-badge.admin {
    background: var(--accent-primary);
    color: white;
}

.user-badge.user {
    background: var(--text-muted);
    color: var(--text-primary);
}

.user-badge.inactive {
    background: var(--error);
    color: white;
}

.user-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.user-actions {
    display: flex;
    gap: var(--space-xs);
}

.btn-primary.small {
    padding: var(--space-xs) var(--space-sm);
    font-size: 13px;
}

.btn-primary.small svg {
    width: 14px;
    height: 14px;
}

/* === SETTINGS === */
.setting-group {
    margin-bottom: var(--space-lg);
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.setting-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.setting-row input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    cursor: pointer;
}

.setting-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
}

.setting-row span {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-muted);
    min-width: 50px;
}

/* === TOASTS === */
.toast-container {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    z-index: 2000;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    font-size: 14px;
    animation: slideIn var(--transition-normal) ease;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info { border-left: 3px solid var(--info); }

.toast svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.toast.success svg { color: var(--success); }
.toast.error svg { color: var(--error); }
.toast.warning svg { color: var(--warning); }
.toast.info svg { color: var(--info); }

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* === LOGIN PAGE === */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: 
        radial-gradient(ellipse at top, rgba(0, 217, 255, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at bottom, rgba(124, 58, 237, 0.1) 0%, transparent 50%),
        var(--bg-primary);
}

.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-lg);
}

.login-card {
    width: 380px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-xl);
    background: linear-gradient(180deg, var(--bg-tertiary) 0%, transparent 100%);
    text-align: center;
}

.login-logo {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
}

.login-logo svg {
    width: 32px;
    height: 32px;
    color: white;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.login-header p {
    color: var(--text-muted);
    font-size: 14px;
}

.login-form {
    padding: var(--space-xl);
    padding-top: 0;
}

.form-group {
    margin-bottom: var(--space-md);
}

.form-group > label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    line-height: 1.4;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper svg {
    position: absolute;
    left: var(--space-md);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}

/* === UNIFIED FORM INPUTS === */
.input-wrapper input,
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="datetime-local"],
.form-group input[type="password"],
.form-group select,
.filter-select,
.sort-select {
    width: 100%;
    height: 44px;
    padding: 0 var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 44px;
    transition: all var(--transition-fast);
    box-sizing: border-box;
}

.input-wrapper input {
    padding-left: 48px !important;
}

.input-wrapper input:focus,
.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group input[type="datetime-local"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.1);
}

.input-wrapper input::placeholder,
.form-group input[type="text"]::placeholder,
.form-group input[type="number"]::placeholder {
    color: var(--text-muted);
}

.input-wrapper input:hover,
.form-group input[type="text"]:hover,
.form-group input[type="number"]:hover,
.form-group input[type="datetime-local"]:hover {
    border-color: var(--border-focus);
    background-color: var(--bg-hover);
}

.toggle-password {
    position: absolute;
    right: var(--space-sm);
    background: transparent;
    border: none;
    padding: var(--space-sm);
    cursor: pointer;
    color: var(--text-muted);
}

.toggle-password:hover {
    color: var(--text-secondary);
}

.toggle-password svg {
    position: static;
    width: 18px;
    height: 18px;
}

.checkbox-group {
    margin-bottom: var(--space-lg);
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    color: var(--text-secondary);
    user-select: none;
}

.checkbox-label input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
}

.checkmark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    flex-shrink: 0;
    border: 2px solid var(--border-primary);
    border-radius: 4px;
    position: relative;
    transition: all var(--transition-fast);
    background: var(--bg-tertiary);
}

.checkbox-label:hover .checkmark {
    border-color: var(--accent-primary);
}

.checkbox-label input:checked + .checkmark {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.checkbox-label input:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.login-error {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid var(--error);
    border-radius: var(--radius-md);
    margin-top: var(--space-md);
    color: var(--error);
    font-size: 13px;
}

.login-error svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.login-footer {
    color: var(--text-muted);
    font-size: 12px;
}

.hidden {
    display: none !important;
}

/* === UTILITY CLASSES === */
.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

/* === SCROLLBAR === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
    background: var(--border-primary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* === MOBILE ADAPTATION === */
@media (max-width: 768px) {
    /* Header mobile */
    .header {
        flex-wrap: wrap;
        padding: var(--space-sm) var(--space-md);
        gap: var(--space-sm);
    }
    
    .header-left {
        order: 1;
        flex: 1;
    }
    
    .header-center {
        order: 3;
        width: 100%;
        justify-content: center;
    }
    
    .header-right {
        order: 2;
        gap: var(--space-xs);
    }
    
    .logo span {
        display: none;
    }
    
    .date-selector {
        background: transparent;
        padding: 0;
    }
    
    .date-selector .btn-icon {
        display: none;
    }
    
    .date-selector #today-btn {
        display: flex;
    }
    
    .date-input {
        width: 110px;
        font-size: 12px;
        padding: var(--space-xs);
    }
    
    .connection-status {
        font-size: 11px;
        padding: var(--space-xs) var(--space-sm);
    }
    
    .btn-icon {
        width: 32px;
        height: 32px;
    }
    
    .btn-icon svg {
        width: 16px;
        height: 16px;
    }
    
    /* Main layout mobile */
    .main {
        grid-template-columns: 1fr;
        padding: var(--space-md);
        gap: var(--space-md);
    }
    
    .sidebar {
        order: 2;
    }
    
    .content {
        order: 1;
    }
    
    .files-sidebar {
        order: 3;
    }
    
    /* Tasks panel */
    .task-buttons {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }
    
    .task-btn {
        flex-direction: column;
        text-align: center;
        padding: var(--space-sm);
    }
    
    .task-btn-icon {
        width: 32px;
        height: 32px;
    }
    
    .task-btn-icon svg {
        width: 16px;
        height: 16px;
    }
    
    .task-btn-text {
        align-items: center;
    }
    
    .task-btn-title {
        font-size: 12px;
    }
    
    .task-btn-desc {
        font-size: 10px;
        display: none;
    }
    
    /* Screenshot */
    .screenshot-wrapper {
        min-height: 200px;
    }
    
    /* Files */
    .upload-zone {
        padding: var(--space-md);
    }
    
    .upload-zone svg {
        width: 24px;
        height: 24px;
    }
    
    .upload-zone span {
        font-size: 12px;
    }
    
    .file-list {
        max-height: 300px;
    }
    
    .file-item {
        padding: var(--space-sm);
    }
    
    .file-icon {
        width: 28px;
        height: 28px;
    }
    
    .file-name {
        font-size: 12px;
    }
    
    .file-actions {
        opacity: 1;
    }
    
    .file-action {
        width: 24px;
        height: 24px;
    }
    
    /* Task history */
    .task-history {
        max-height: 250px;
    }
    
    /* Modals */
    .modal-content {
        width: 95%;
        max-width: none;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-content.large {
        max-width: none;
    }
    
    .modal-header {
        padding: var(--space-sm) var(--space-md);
    }
    
    .modal-header h3 {
        font-size: 14px;
    }
    
    .modal-body {
        padding: var(--space-md);
    }
    
    /* System status grid */
    .system-status-grid {
        grid-template-columns: 1fr;
    }
    
    .status-value {
        font-size: 24px;
    }
    
    /* Toasts */
    .toast-container {
        left: var(--space-md);
        right: var(--space-md);
        bottom: var(--space-md);
    }
    
    .toast {
        font-size: 13px;
        padding: var(--space-sm) var(--space-md);
    }
    
    /* Pagination */
    .task-pagination {
        flex-wrap: wrap;
        gap: var(--space-sm);
    }
    
    /* Scheduler */
    .schedule-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }
    
    .schedule-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .schedule-details {
        font-size: 11px;
    }
    
    .cron-inputs {
        flex-wrap: wrap;
    }
    
    .cron-inputs input {
        max-width: none;
        flex: 1;
        min-width: 80px;
    }
    
    /* Users */
    .user-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }
    
    .user-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    /* File selector in create video modal */
    .file-checkbox-list {
        max-height: 200px;
    }
    
    .file-checkbox-item {
        font-size: 12px;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .main {
        padding: var(--space-sm);
    }
    
    .panel {
        padding: var(--space-sm);
    }
    
    .panel-title {
        font-size: 12px;
    }
    
    .task-buttons {
        grid-template-columns: 1fr;
    }
    
    .task-btn {
        flex-direction: row;
        text-align: left;
    }
    
    .task-btn-text {
        align-items: flex-start;
    }
    
    .task-btn-desc {
        display: block;
    }
    
    .filter-select {
        font-size: 12px;
        padding: var(--space-xs) var(--space-sm);
    }
    
    .btn-primary {
        padding: var(--space-sm) var(--space-md);
        font-size: 14px;
    }
    
    .btn-primary.small {
        padding: var(--space-xs) var(--space-sm);
        font-size: 12px;
    }
}

/* === LOGIN PAGE MOBILE === */
@media (max-width: 480px) {
    .login-container {
        padding: var(--space-md);
        width: 100%;
    }
    
    .login-card {
        width: 100%;
        max-width: 100%;
    }
    
    .login-header {
        padding: var(--space-lg);
    }
    
    .login-logo {
        width: 48px;
        height: 48px;
    }
    
    .login-logo svg {
        width: 24px;
        height: 24px;
    }
    
    .login-header h1 {
        font-size: 20px;
    }
    
    .login-header p {
        font-size: 13px;
    }
    
    .login-form {
        padding: var(--space-lg);
        padding-top: 0;
    }
    
    .form-group label {
        font-size: 12px;
    }
    
    .input-wrapper input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: var(--space-sm) var(--space-md);
        padding-left: 40px;
    }
    
    .input-wrapper svg {
        width: 16px;
        height: 16px;
        left: var(--space-sm);
    }
    
    .toggle-password svg {
        width: 16px;
        height: 16px;
    }
    
    .btn-primary {
        padding: var(--space-sm) var(--space-md);
    }
    
    .login-error {
        font-size: 12px;
        padding: var(--space-sm);
    }
}

/* Tablet specific adjustments */
@media (min-width: 769px) and (max-width: 1200px) {
    .main {
        grid-template-columns: 1fr 1fr;
    }
    
    .content {
        grid-column: 1 / -1;
        order: 1;
    }
    
    .sidebar {
        order: 2;
    }
    
    .files-sidebar {
        order: 3;
    }
}

