/* ==========================================================================
   CYBERPUNK #3989ff THEME & CORE DESIGN SYSTEM
   ========================================================================== */

:root {
    --bg-dark: #06090d;
    --bg-panel: #0b1118;
    --bg-card: #101924;
    --bg-input: #162230;
    
    --border-color: #263b54;
    --border-glow: #247cff;
    
    --primary: #3989ff;
    --primary-glow: #247cff;
    --accent-cyan: #00f0ff;
    --accent-magenta: #0077ff;
    --accent-green: #00ff66;
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;
    
    --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --topbar-height: 64px;
    --footer-height: 70px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(57, 137, 255, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(0, 240, 255, 0.05) 0%, transparent 40%);
}

/* ==========================================================================
   TOPBAR & HEADER
   ========================================================================== */

.topbar {
    height: var(--topbar-height);
    background: rgba(13, 11, 24, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.back-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

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

.back-btn:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.3);
    transform: translateX(-2px);
}

.brand h1 {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #fff;
    text-shadow: 0 0 8px rgba(57, 137, 255, 0.6);
}

.brand p {
    font-size: 10px;
    color: var(--accent-cyan);
    letter-spacing: 1px;
}

.system-status {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 255, 102, 0.05);
    border: 1px solid rgba(0, 255, 102, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-green);
    animation: pulse 2s infinite;
}

.status-text {
    font-size: 10px;
    font-weight: 700;
    color: var(--accent-green);
    letter-spacing: 1px;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ==========================================================================
   LAYOUT CONTAINERS
   ========================================================================== */

.container {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 24px;
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.panel-icon {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.panel-header h2 {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: var(--text-main);
}

/* ==========================================================================
   FORM CONTROLS & SWITCHES
   ========================================================================== */

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.8px;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.neon-badge {
    background: rgba(57, 137, 255, 0.15);
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 0 8px rgba(57, 137, 255, 0.3);
}

.select-wrapper select,
.input-field input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
}

.select-wrapper select:focus,
.input-field input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
    background: var(--bg-input);
    height: 6px;
    border-radius: 4px;
    outline: none;
}

.option-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
}

.option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.option-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0.5px;
}

/* CYBER SWITCH */
.cyber-switch {
    position: relative;
    width: 44px;
    height: 22px;
}

.cyber-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cyber-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    transition: 0.3s;
}

.cyber-slider:before {
    content: "";
    position: absolute;
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background: var(--text-dim);
    border-radius: 50%;
    transition: 0.3s;
}

.cyber-switch input:checked + .cyber-slider {
    background: rgba(57, 137, 255, 0.2);
    border-color: var(--primary);
}

.cyber-switch input:checked + .cyber-slider:before {
    transform: translateX(22px);
    background: var(--accent-cyan);
    box-shadow: 0 0 8px var(--accent-cyan);
}

.resize-options {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.cyber-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
}

.cyber-checkbox-label input {
    accent-color: var(--primary);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.cyber-button {
    width: 100%;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
    border: none;
}

.cyber-button svg {
    width: 18px;
    height: 18px;
}

.cyber-button.primary-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-glow));
    color: #fff;
    box-shadow: 0 0 15px rgba(57, 137, 255, 0.4);
}

.cyber-button.primary-btn:hover:not(:disabled) {
    box-shadow: 0 0 25px rgba(57, 137, 255, 0.7);
    transform: translateY(-1px);
}

.cyber-button.secondary {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

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

.cyber-button.action {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--accent-cyan);
}

.cyber-button.action:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.3);
}

.cyber-button.neon {
    background: rgba(255, 0, 127, 0.15);
    border: 1px solid var(--accent-magenta);
    color: #fff;
}

.cyber-button.neon:hover {
    background: var(--accent-magenta);
    box-shadow: 0 0 20px rgba(255, 0, 127, 0.6);
}

.cyber-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none !important;
}

/* ==========================================================================
   WORKSPACE & UPLOAD ZONE
   ========================================================================== */

.upload-area {
    border: 2px dashed var(--border-color);
    background: rgba(19, 16, 36, 0.5);
    border-radius: 14px;
    padding: 36px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover,
.upload-area.dragging {
    border-color: var(--accent-cyan);
    background: rgba(0, 240, 255, 0.03);
    box-shadow: inset 0 0 20px rgba(0, 240, 255, 0.05);
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--primary);
    margin-bottom: 12px;
    transition: transform 0.3s;
}

.upload-area:hover .upload-icon {
    transform: translateY(-4px);
    color: var(--accent-cyan);
}

.upload-area h3 {
    font-size: 14px;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.upload-area .highlight {
    color: var(--accent-cyan);
}

.upload-area p {
    font-size: 11px;
    color: var(--text-dim);
}

/* FILE INFO QUEUE */
.file-info {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

/* PROGRESS BAR */
.progress-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-cyan);
}

.progress-bar {
    height: 8px;
    background: var(--bg-input);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent-cyan));
    box-shadow: 0 0 10px var(--accent-cyan);
    transition: width 0.2s ease;
}

/* BATCH CONTROLS */
.batch-controls {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.batch-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.batch-summary h3 {
    font-size: 13px;
    letter-spacing: 1px;
}

.cyber-badge {
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid var(--accent-cyan);
    color: var(--accent-cyan);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
}

.batch-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

/* RESULTS GRID */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.2s;
}

.result-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(57, 137, 255, 0.2);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cyber-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
}

.cyber-checkbox input {
    accent-color: var(--primary);
}

.preview-thumb {
    width: 100%;
    height: 160px;
    object-fit: contain;
    background: #000;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.metrics-box {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.tag.highlight {
    background: rgba(0, 255, 106, 0.1);
    border-color: var(--accent-green);
    color: var(--accent-green);
    font-weight: 700;
}

.card-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.card-actions .cyber-button {
    padding: 8px;
    font-size: 11px;
}

/* ==========================================================================
   COMPARISON MODAL
   ========================================================================== */

.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(5, 4, 10, 0.85);
    backdrop-filter: blur(8px);
}

.modal-container {
    position: relative;
    width: 100%;
    max-width: 900px;
    background: var(--bg-panel);
    border: 1px solid var(--border-glow);
    border-radius: 16px;
    box-shadow: 0 0 30px rgba(57, 137, 255, 0.3);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow: hidden;
}

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

.modal-header h3 {
    font-size: 14px;
    letter-spacing: 1px;
}

.modal-view-toggle {
    display: flex;
    background: var(--bg-input);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 6px 12px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
}

.toggle-btn.active {
    background: var(--primary);
    color: #fff;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

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

.modal-body {
    padding: 20px;
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

/* SPLIT SLIDER VIEW */
.compare-view-slider {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
    user-select: none;
}

.image-wrapper {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.compressed-wrapper {
    width: 50%;
    overflow: hidden;
    border-right: 2px solid var(--accent-cyan);
}

.view-tag {
    position: absolute;
    top: 10px;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.view-tag.left { left: 10px; color: var(--text-main); }
.view-tag.right { right: 10px; color: var(--accent-cyan); }

.compare-range {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: ew-resize;
    z-index: 10;
}

.slider-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background: var(--accent-cyan);
    box-shadow: 0 0 10px var(--accent-cyan);
    pointer-events: none;
}

/* SIDE BY SIDE VIEW */
.compare-view-side {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    height: 400px;
}

.side-box {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.side-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.side-tag {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 10px;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.8);
    padding: 3px 6px;
    border-radius: 4px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.cyber-footer {
    background: var(--bg-panel);
    border-top: 1px solid var(--border-color);
    padding: 20px 24px;
    margin-top: auto;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.footer-title {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--primary);
}

.footer-brand p {
    font-size: 10px;
    color: var(--text-dim);
}

.footer-stats {
    display: flex;
    gap: 16px;
    font-size: 10px;
    color: var(--text-muted);
}

.neon-text {
    color: var(--accent-cyan);
}

.footer-bottom {
    text-align: center;
    font-size: 10px;
    color: var(--text-dim);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 10px;
}

/* MOBILE NAV TAB BAR */
.mobile-nav {
    display: none;
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   RESPONSIVE / APP MOBILE BEHAVIOR
   ========================================================================== */

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

@media (max-width: 768px) {
    body {
        height: 100dvh;
        overflow: hidden;
    }

    .topbar {
        height: 54px;
    }

    .container {
        padding: 12px;
        height: calc(100dvh - 54px - 60px);
        overflow: hidden;
        position: relative;
    }

    .panel {
        height: 100%;
        overflow-y: auto;
        display: none;
    }

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

    /* MOBILE NAVIGATION TABS */
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: var(--bg-panel);
        border-top: 1px solid var(--border-color);
        z-index: 100;
    }

    .nav-tab {
        flex: 1;
        background: transparent;
        border: none;
        color: var(--text-dim);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        font-size: 10px;
        font-weight: 700;
        cursor: pointer;
    }

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

    .nav-tab.active {
        color: var(--accent-cyan);
    }

    .cyber-footer {
        display: none; /* Hidden on mobile to fit screen like an app */
    }

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