@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Outfit:wght@400;600;800&display=swap');

:root {
    --bg-base: #060913;
    --bg-gradient-1: #1a0b2e;
    --bg-gradient-2: #0f172a;
    
    --card-bg: rgba(20, 25, 40, 0.4);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    
    /* Sky Blue Theme */
    --accent-primary: #0ea5e9;   /* Sky Blue */
    --accent-secondary: #38bdf8; /* Light Sky */
    --accent-glow: rgba(14, 165, 233, 0.5);
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(14, 165, 233, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(56, 189, 248, 0.15), transparent 25%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    min-height: 100vh;
    animation: pulseBg 15s ease-in-out infinite alternate;
}

@keyframes pulseBg {
    0% { background-position: 0% 0%; }
    100% { background-position: 100% 100%; }
}

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

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.fade-in { animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

/* Typography */
h1 { 
    font-family: var(--font-heading); 
    font-size: 3.8rem; 
    font-weight: 800; 
    line-height: 1.1; 
    margin-bottom: 0.8rem; 
    background: linear-gradient(135deg, #fff 0%, #e0f2fe 50%, var(--accent-primary) 100%); 
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent; 
    letter-spacing: -1px;
    filter: drop-shadow(0 4px 10px rgba(14, 165, 233, 0.3));
}
h2 { font-family: var(--font-heading); font-size: 2.2rem; font-weight: 700; margin-bottom: 1.5rem; letter-spacing: -0.5px; color: #fff; }
h3 { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 700; color: #fdf2f8; margin-bottom: 0.5rem; }
h4 { font-family: var(--font-heading); font-size: 1.2rem; font-weight: 600; color: var(--accent-primary); margin-bottom: 1rem; text-transform: uppercase; letter-spacing: 1px; }
p { color: var(--text-secondary); font-size: 1.05rem; letter-spacing: 0.2px; }

.subtitle { font-size: 1.2rem; font-weight: 300; max-width: 650px; margin: 0 auto; color: var(--text-muted); line-height: 1.8; }
.app-container { max-width: 1400px; margin: 0 auto; padding: 0 2rem; display: flex; flex-direction: column; min-height: 100vh; }
.hero-section { text-align: center; padding: 4rem 0 2rem; position: relative; }
.hero-section::after { content: ''; position: absolute; width: 150px; height: 150px; background: var(--accent-primary); filter: blur(100px); top: 0; left: 50%; transform: translateX(-50%); z-index: -1; opacity: 0.5; }
.subtitle { font-size: 1.1rem; max-width: 600px; margin: 0 auto; color: var(--text-muted); }

/* Components */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.1), var(--card-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.glass-panel:hover {
    transform: translateY(-5px);
    box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.2), 0 30px 60px -12px rgba(0, 0, 0, 0.8), 0 0 40px rgba(14, 165, 233, 0.15);
}

.metrics-container { display: flex; gap: 1.5rem; justify-content: center; margin: 3rem 0; flex-wrap: wrap; }
.metric-box { padding: 1.5rem 2.5rem; text-align: center; flex: 1; min-width: 250px; position: relative; overflow: hidden; }
.metric-box::before { content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: radial-gradient(circle, rgba(255,255,255,0.03) 0%, transparent 60%); z-index: 0; }
.metric-value { font-family: var(--font-heading); font-size: 3rem; font-weight: 800; color: #fff; text-shadow: 0 0 20px rgba(255,255,255,0.2); position: relative; z-index: 1; }
.metric-label { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 2px; color: var(--text-muted); font-weight: 600; margin-top: 0.5rem; position: relative; z-index: 1; }

.main-content { margin: 2rem 0 5rem; }
.analysis-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 2.5rem; margin-top: 2rem; }
.analysis-card { display: flex; flex-direction: column; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 1rem; }
.icon { font-size: 2rem; filter: drop-shadow(0 0 10px rgba(255,255,255,0.2)); animation: float 6s ease-in-out infinite; }

/* Forms */
.input-group { margin-bottom: 1.5rem; }
.form-control-input, textarea {
    width: 100%;
    padding: 1.2rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all 0.3s ease;
    resize: vertical;
}
.form-control-input:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.2), inset 0 2px 4px rgba(0,0,0,0.5);
}
.form-control-input::placeholder, textarea::placeholder { color: var(--text-muted); }

/* Buttons */
.btn-primary, .btn-secondary {
    width: 100%;
    padding: 1.2rem;
    border-radius: 16px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    color: white;
    box-shadow: 0 10px 20px -10px var(--accent-glow);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -10px var(--accent-glow), inset 0 0 0 1px rgba(255,255,255,0.2);
}
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { background: #334155; opacity: 0.7; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.2); }

/* Results Area */
.result-box { margin-top: 2rem; padding-top: 2rem; border-top: 1px solid rgba(255, 255, 255, 0.05); animation: fadeInUp 0.5s ease forwards; }
.hidden { display: none !important; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* Data Tables */
.table-responsive {
    width: 100%;
    margin-top: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--card-border);
    background: rgba(0, 0, 0, 0.2);
    overflow: hidden;
}
.table-scroll {
    max-height: 350px;
    overflow-y: auto;
}
.table-filters {
    padding: 15px;
    display: flex;
    gap: 10px;
    border-bottom: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.02);
}
.table-filters button {
    flex: 1;
    padding: 10px;
    border-radius: 10px;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th, .data-table td { padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.05); text-align: left; }
.data-table th {
    position: sticky; top: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 10;
    font-family: var(--font-heading);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.8rem;
}
.data-table tbody tr { transition: background 0.2s; }
.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }

/* Badges */
.badge-sm {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: inline-block;
}
.badge-sm.positif { background: rgba(16, 185, 129, 0.1); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-sm.negatif { background: rgba(239, 68, 68, 0.1); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.2); }
.badge-sm.netral { background: rgba(245, 158, 11, 0.1); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.2); }

/* File Input Override */
.file-upload-wrapper { position: relative; margin-bottom: 1rem; }
.file-upload-input { width: 0.1px; height: 0.1px; opacity: 0; overflow: hidden; position: absolute; z-index: -1; }
.file-upload-label { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 2rem; background: rgba(0,0,0,0.2); border: 2px dashed rgba(255,255,255,0.1); border-radius: 16px; cursor: pointer; transition: all 0.3s; color: var(--text-secondary); font-family: var(--font-heading); }
.file-upload-label:hover { border-color: var(--accent-primary); background: rgba(14, 165, 233, 0.05); color: white; }

/* Navbar System */
nav { display: flex; justify-content: space-between; align-items: center; padding: 1.5rem 2rem; border-bottom: 1px solid rgba(255,255,255,0.05); margin-bottom: 2rem; flex-wrap: wrap; gap: 1.5rem; }
.logo { font-family: var(--font-heading); font-size: 1.8rem; font-weight: 800; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; }
.logo span { background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.nav-actions { position: static; display: flex; flex-wrap: wrap; gap: 10px; }
.nav-actions .btn-secondary { width: auto; padding: 0.8rem 1.5rem; border-radius: 12px; font-size: 0.9rem; flex: 1; min-width: max-content; }

@media (max-width: 768px) {
    nav { flex-direction: column; justify-content: center; text-align: center; }
    .logo { align-items: center; }
    .nav-actions { width: 100%; justify-content: center; }
}

/* Dynamic Bars */
.sentiment-badge { font-size: 1.2rem; font-weight: 800; text-align: center; margin: 1.5rem 0; padding: 1rem; border-radius: 16px; background: rgba(0,0,0,0.3); font-family: var(--font-heading); letter-spacing: 2px; }
.prob-bars { display: flex; flex-direction: column; gap: 1rem; }
.prob-item { display: flex; align-items: center; gap: 1rem; }
.prob-label { width: 80px; font-weight: 600; font-size: 0.9rem; }
.prob-bar-bg { flex: 1; height: 12px; background: rgba(255,255,255,0.05); border-radius: 10px; overflow: hidden; position: relative; }
.prob-bar-fill { height: 100%; border-radius: 10px; transition: width 1s cubic-bezier(0.4, 0, 0.2, 1); }
.prob-value { width: 50px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.9rem; }

/* Clean text */
.clean-text-preview { background: rgba(0,0,0,0.2); padding: 1rem; border-radius: 12px; font-size: 0.85rem; border-left: 3px solid rgba(255,255,255,0.2); margin-top: 2rem; }

/* Toasts */
.toast { 
    position: fixed; 
    bottom: 30px; 
    right: 30px; 
    z-index: 9999; 
    background: rgba(11, 15, 25, 0.95); 
    backdrop-filter: blur(10px); 
    color: white; 
    padding: 1rem 1.5rem; 
    border-radius: 12px; 
    border: 1px solid rgba(255,255,255,0.1); 
    box-shadow: 0 15px 30px rgba(0,0,0,0.5); 
    font-weight: 500; 
    transform: translateX(180%); 
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    max-width: calc(100% - 60px);
}
.toast.show { transform: translateX(0); }
.toast.error { border-left: 4px solid #ef4444; }

@media (max-width: 600px) {
    .toast {
        bottom: 20px;
        right: 20px;
        left: 20px;
        max-width: calc(100% - 40px);
        transform: translateY(180%);
        transition: transform 0.4s ease-out;
    }
    .toast.show {
        transform: translateY(0);
    }
}

footer { text-align: center; padding: 3rem 0; color: var(--text-muted); font-size: 0.9rem; margin-top: 5rem; border-top: 1px solid rgba(255,255,255,0.05); }

.intro-section {
    text-align: center;
    padding: 3rem 2rem;
    margin-bottom: 3rem;
}
.intro-section h2 { margin-bottom: 1rem; }
.intro-section p { max-width: 800px; margin: 0 auto; color: var(--text-secondary); line-height: 1.6; }

/* Loader */
.loader {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

.btn-primary:disabled .loader {
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: rgba(255,255,255,0.3);
}

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

/* Mobile Responsiveness Improvements */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.link-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    background: rgba(255,255,255,0.02);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.05);
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    .intro-section {
        padding: 2rem 1rem;
        margin-bottom: 2rem;
    }
    .intro-section h2 {
        font-size: 1.8rem;
        line-height: 1.3;
    }
    .glass-panel {
        padding: 1.5rem;
        border-radius: 16px;
    }
    .nav-actions {
        width: 100%;
        flex-direction: column;
    }
    .nav-actions button {
        width: 100% !important;
    }
    .link-options {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px;
    }
    .link-options > div {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }
    .link-options label {
        font-size: 0.85rem !important;
    }
    .link-options select, .link-options input {
        font-size: 0.9rem !important;
        padding: 8px !important;
    }
    .btn-download {
        width: 100%;
        justify-content: center;
    }
    .download-actions {
        flex-direction: column;
        gap: 10px;
    }
}
