/* ===== EFFORT – Single-Screen Layout ===== */

/* --- Light theme (default) --- */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #4f46e5;
    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;
    --bg-primary: #f8f9fb;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f3f8;
    --bg-card: rgba(255, 255, 255, 0.92);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: rgba(99, 102, 241, 0.18);
    --border-hover: rgba(99, 102, 241, 0.4);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);
    --radius: 10px;
    --radius-lg: 14px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --bg-gradient-a: rgba(99, 102, 241, 0.05);
    --bg-gradient-b: rgba(139, 92, 246, 0.03);
}

/* --- Dark theme --- */
[data-theme="dark"] {
    --primary-light: #818cf8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --bg-card: rgba(26, 26, 46, 0.85);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: rgba(99, 102, 241, 0.2);
    --border-hover: rgba(99, 102, 241, 0.4);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --bg-gradient-a: rgba(99, 102, 241, 0.08);
    --bg-gradient-b: rgba(139, 92, 246, 0.04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
    background-image:
        radial-gradient(ellipse at top, var(--bg-gradient-a), transparent 50%),
        radial-gradient(ellipse at bottom right, var(--bg-gradient-b), transparent 50%);
    transition: background 0.3s ease, color 0.3s ease;
}

/* ===== App Shell ===== */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75rem 1.25rem;
}

/* ===== Header ===== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.logo-icon {
    width: 28px;
    height: 28px;
    color: var(--primary);
}

.header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-muted);
    font-size: 0.8rem;
    padding-left: 0.6rem;
    border-left: 1px solid var(--border-color);
}

.header-right {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    font-weight: 500;
}

.badge.accent {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
    border-color: rgba(99, 102, 241, 0.3);
}

/* ===== Theme Toggle ===== */
.theme-toggle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    padding: 0;
    flex-shrink: 0;
}

.theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun  { display: none; }

[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }

/* ===== Main Grid ===== */
.main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    flex: 1;
    min-height: 0;
}

/* ===== Panels ===== */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.panel-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

.supported-types {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
}

/* ===== Model Selector ===== */
.model-selector {
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.model-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.4rem;
}

.model-options {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
}

.model-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.4rem;
    background: var(--bg-tertiary);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    gap: 0.15rem;
}

.model-btn:hover {
    border-color: var(--border-hover);
    background: rgba(99, 102, 241, 0.06);
}

.model-btn.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.15);
}

.model-name {
    font-size: 0.82rem;
    font-weight: 600;
}

.model-btn.active .model-name {
    color: var(--primary);
}

.model-desc {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.model-btn.active .model-desc {
    color: var(--text-secondary);
}

/* ===== Upload Area ===== */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-area.dragover {
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.15);
}

.upload-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 0.6rem;
    color: var(--primary);
    opacity: 0.7;
}

.upload-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.upload-text strong {
    color: var(--primary);
    cursor: pointer;
}

.file-types {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ===== Preview ===== */
.preview-area {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.preview-area.active {
    display: flex;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.preview-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    min-height: 0;
    overflow: hidden;
}

.preview-container img,
.preview-container video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.75rem;
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.file-name {
    font-size: 0.78rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.3rem;
    color: var(--text-muted);
    transition: var(--transition);
    border-radius: 6px;
    display: flex;
}

.remove-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.remove-btn svg {
    width: 16px;
    height: 16px;
}

/* ===== Analyze Button ===== */
.analyze-btn {
    width: 100%;
    padding: 0.65rem 1rem;
    margin-top: 0.75rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    flex-shrink: 0;
}

.analyze-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

.analyze-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.analyze-btn.loading .btn-text { opacity: 0; }
.analyze-btn .btn-loader { position: absolute; display: none; }
.analyze-btn.loading .btn-loader { display: block; }

.spinner {
    width: 22px;
    height: 22px;
    animation: spin 1s linear infinite;
}

.spinner-circle {
    stroke: white;
    stroke-dasharray: 60;
    stroke-dashoffset: 45;
}

@keyframes spin { 100% { transform: rotate(360deg); } }

/* ===== Results Panel ===== */
.results-panel {
    justify-content: center;
}

.results-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    color: var(--text-muted);
    gap: 0.75rem;
}

.placeholder-icon {
    width: 48px;
    height: 48px;
    opacity: 0.3;
}

.placeholder-icon svg {
    width: 100%;
    height: 100%;
    color: var(--text-muted);
}

.results-placeholder p {
    font-size: 0.85rem;
    max-width: 220px;
    line-height: 1.6;
}

.results-placeholder strong {
    color: var(--primary);
}

/* ===== Result Card ===== */
.result-card {
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(15px); }
    to { opacity: 1; transform: translateX(0); }
}

.result-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

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

.result-icon.real {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.result-icon.fake {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.result-icon svg {
    width: 24px;
    height: 24px;
}

.result-text h3 {
    font-size: 1rem;
    margin-bottom: 0.3rem;
}

.result-badge {
    display: inline-block;
    padding: 0.2rem 0.75rem;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.result-badge.real {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.result-badge.fake {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

/* ===== Confidence Meter ===== */
.confidence-meter {
    margin-bottom: 1rem;
}

.confidence-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.4rem;
    font-size: 0.82rem;
}

.confidence-header span:last-child {
    font-weight: 600;
    color: var(--primary);
}

.confidence-bar {
    height: 7px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 4px;
    width: 0%;
    transition: width 0.8s ease;
}

/* ===== Probability Bars ===== */
.probability-bars {
    margin-bottom: 1rem;
}

.prob-item { margin-bottom: 0.6rem; }
.prob-item:last-child { margin-bottom: 0; }

.prob-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.3rem;
    font-size: 0.82rem;
}

.prob-name { font-weight: 500; }
.prob-name.real { color: var(--success); }
.prob-name.fake { color: var(--danger); }
.prob-value { color: var(--text-secondary); }

.prob-bar {
    height: 5px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.prob-fill {
    height: 100%;
    border-radius: 3px;
    width: 0%;
    transition: width 0.8s ease 0.15s;
}

.prob-fill.real { background: var(--success); }
.prob-fill.fake { background: var(--danger); }

/* ===== Details Grid ===== */
.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.detail-item {
    padding: 0.5rem 0.6rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.detail-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.15rem;
}

.detail-value {
    display: block;
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 500;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 0.5rem 0 0.25rem;
    flex-shrink: 0;
    margin-top: 0.5rem;
}

.footer p {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.footer strong {
    color: var(--primary);
}

.disclaimer {
    font-size: 0.65rem !important;
    margin-top: 0.15rem;
    opacity: 0.7;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    padding: 0.75rem 1.25rem;
    background: var(--danger);
    color: white;
    border-radius: var(--radius);
    font-size: 0.85rem;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ===== Responsive: stack on narrow screens ===== */
@media (max-width: 768px) {
    body { overflow: auto; height: auto; }
    .app { height: auto; min-height: 100vh; }
    .main {
        grid-template-columns: 1fr;
    }
    .header { flex-direction: column; gap: 0.5rem; text-align: center; }
    .header-left { justify-content: center; }
    .header-right { justify-content: center; }
    .tagline { border-left: none; padding-left: 0; }
    .results-placeholder { min-height: 200px; }
}
