/* ═══════════════════════════════════════════════════════════════
   AI Content Detector - Premium Dark Theme Stylesheet
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties (Design Tokens) ──────────────────── */
:root {
    /* Colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #16161f;
    --bg-card-hover: #1a1a25;
    --bg-input: #1e1e2a;
    --bg-glass: rgba(22, 22, 31, 0.8);
    
    --text-primary: #f0f0f5;
    --text-secondary: #9898b0;
    --text-muted: #6b6b84;
    
    --accent-primary: #6366f1;
    --accent-secondary: #a855f7;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --border-accent: rgba(99, 102, 241, 0.3);
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);
    
    /* Spacing */
    --container-width: 900px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Typography */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Animated Background ────────────────────────────────────── */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.12;
    animation: float 20s ease-in-out infinite;
}

.bg-orb-1 {
    width: 600px;
    height: 600px;
    background: var(--accent-primary);
    top: -200px;
    right: -100px;
    animation-delay: 0s;
}

.bg-orb-2 {
    width: 500px;
    height: 500px;
    background: var(--accent-secondary);
    bottom: -150px;
    left: -100px;
    animation-delay: -7s;
}

.bg-orb-3 {
    width: 400px;
    height: 400px;
    background: #ec4899;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -40px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(40px, 30px) scale(1.02); }
}

/* ── Header ─────────────────────────────────────────────────── */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
}

.header-content {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-text {
    font-size: 1.15rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav {
    display: flex;
    gap: 4px;
    background: var(--bg-input);
    border-radius: 10px;
    padding: 4px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-link.active {
    color: var(--text-primary);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.header-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

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

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

/* ── Hero Section ────────────────────────────────────────────── */
.hero {
    position: relative;
    z-index: 1;
    padding: 80px 24px 60px;
    text-align: center;
}

.hero-content {
    max-width: var(--container-width);
    margin: 0 auto;
}

.hero-badge {
    display: inline-block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    padding: 6px 18px;
    border-radius: 30px;
    margin-bottom: 24px;
    animation: fadeInUp 0.6s ease;
}

.hero-title {
    font-size: clamp(2.2rem, 5vw, 3.2rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 18px;
    animation: fadeInUp 0.6s ease 0.1s both;
}

.gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.08rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
    line-height: 1.7;
    animation: fadeInUp 0.6s ease 0.2s both;
}

.hero-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    animation: fadeInUp 0.6s ease 0.3s both;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: var(--border);
}

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

/* ── Detection Sections ──────────────────────────────────────── */
.detection-section {
    position: relative;
    z-index: 1;
    padding: 40px 24px 60px;
    max-width: var(--container-width);
    margin: 0 auto;
}

.section-header {
    text-align: center;
    margin-bottom: 32px;
}

.section-icon {
    font-size: 2.4rem;
    margin-bottom: 12px;
}

.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.section-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ── Detector Card ───────────────────────────────────────────── */
.detector-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transition: border-color var(--transition-base);
}

.detector-card:hover {
    border-color: var(--border-hover);
}

.card-inner {
    padding: 32px;
}

/* ── Text Input ──────────────────────────────────────────────── */
.input-area {
    margin-bottom: 8px;
}

.input-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.label-icon {
    font-size: 1.1rem;
}

.text-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.95rem;
    line-height: 1.7;
    resize: vertical;
    transition: all var(--transition-base);
    outline: none;
}

.text-input::placeholder {
    color: var(--text-muted);
}

.text-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.input-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
}

.char-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

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

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-main);
    font-size: 0.88rem;
    font-weight: 600;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

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

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

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    padding: 8px;
    border-radius: var(--radius-sm);
}

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

.btn-lg {
    padding: 14px 28px;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
    margin-top: 16px;
    width: 100%;
    justify-content: center;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
}

/* ── Upload Area ─────────────────────────────────────────────── */
.upload-area {
    text-align: center;
}

.upload-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    cursor: pointer;
    transition: all var(--transition-base);
    background: var(--bg-input);
}

.upload-dropzone:hover,
.upload-dropzone.drag-over {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.04);
}

.dropzone-icon {
    color: var(--text-muted);
    margin-bottom: 16px;
    transition: color var(--transition-base);
}

.upload-dropzone:hover .dropzone-icon {
    color: var(--accent-primary);
}

.dropzone-text {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.dropzone-subtext {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.dropzone-formats {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ── Image Preview ───────────────────────────────────────────── */
.image-preview {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-input);
}

.image-preview img {
    width: 100%;
    max-height: 350px;
    object-fit: contain;
    background: #0d0d14;
}

.preview-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.preview-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

/* ── Loading State ───────────────────────────────────────────── */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
}

.loader {
    position: relative;
    width: 60px;
    height: 60px;
    margin-bottom: 20px;
}

.loader-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-radius: 50%;
}

.loader-ring:nth-child(1) {
    border-top-color: var(--accent-primary);
    animation: spin 1s linear infinite;
}

.loader-ring:nth-child(2) {
    border-right-color: var(--accent-secondary);
    animation: spin 1.5s linear infinite reverse;
    width: 80%;
    height: 80%;
    top: 10%;
    left: 10%;
}

.loader-ring:nth-child(3) {
    border-bottom-color: #ec4899;
    animation: spin 2s linear infinite;
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
}

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

.loading-text {
    font-size: 0.92rem;
    color: var(--text-secondary);
    animation: pulse 1.5s ease-in-out infinite;
}

/* ── Results Area ────────────────────────────────────────────── */
.results-area {
    animation: slideUp 0.4s var(--transition-slow);
}

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

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

.result-title {
    font-size: 1.15rem;
    font-weight: 700;
}

/* ── Prediction Card ─────────────────────────────────────────── */
.prediction-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    border: 1px solid var(--border);
    background: var(--bg-input);
}

.prediction-card.ai-detected {
    background: var(--danger-bg);
    border-color: rgba(239, 68, 68, 0.2);
}

.prediction-card.human-detected {
    background: var(--success-bg);
    border-color: rgba(34, 197, 94, 0.2);
}

.prediction-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.prediction-label {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.prediction-card.ai-detected .prediction-label {
    color: var(--danger);
}

.prediction-card.human-detected .prediction-label {
    color: var(--success);
}

.prediction-confidence {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    gap: 6px;
}

.confidence-value {
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

/* ── Confidence Bar ──────────────────────────────────────────── */
.confidence-bar-container {
    margin-bottom: 28px;
}

.confidence-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.confidence-bar {
    width: 100%;
    height: 10px;
    background: var(--bg-input);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.confidence-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    background: linear-gradient(90deg, var(--success), var(--warning), var(--danger));
}

.confidence-values {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    margin-top: 6px;
}

/* ── Features Grid ───────────────────────────────────────────── */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}

.feature-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    transition: all var(--transition-fast);
}

.feature-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.feature-name {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.feature-value {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

/* ── Highlighted Text ────────────────────────────────────────── */
.highlight-section {
    margin-top: 24px;
}

.highlight-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.highlight-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.highlighted-text {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    line-height: 2;
    font-size: 0.92rem;
}

.word-highlight {
    display: inline;
    padding: 2px 1px;
    border-radius: 3px;
    transition: background var(--transition-fast);
    cursor: default;
}

.word-highlight.suspicious {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-bottom: 2px solid rgba(239, 68, 68, 0.4);
}

.word-highlight.normal {
    color: var(--text-secondary);
}

.word-highlight:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* ── Heatmap ─────────────────────────────────────────────────── */
.heatmap-section {
    margin-top: 24px;
}

.heatmap-container {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.heatmap-container img {
    width: 100%;
    display: block;
}

/* ── Footer ──────────────────────────────────────────────────── */
.footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 40px 24px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

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

.footer-sub {
    font-size: 0.78rem !important;
    margin-top: 6px;
    opacity: 0.6;
}

/* ── Utility Classes ─────────────────────────────────────────── */
.hidden {
    display: none !important;
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-card-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    .header-content {
        padding: 10px 16px;
    }
    
    .header-badge {
        display: none;
    }
    
    .nav {
        gap: 2px;
    }
    
    .nav-link {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    .hero {
        padding: 50px 16px 40px;
    }
    
    .hero-stats {
        gap: 16px;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    .detection-section {
        padding: 24px 16px 40px;
    }
    
    .card-inner {
        padding: 20px;
    }
    
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .input-footer {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .input-actions {
        justify-content: flex-end;
    }
}

@media (max-width: 480px) {
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 12px;
    }
    
    .stat-divider {
        width: 40px;
        height: 1px;
    }
}

/* ── Toast Notification ──────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    animation: slideIn 0.3s ease, slideOut 0.3s ease 2.7s forwards;
    max-width: 400px;
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.1);
}

.toast.success {
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.1);
}

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

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