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

/* ============================================================
   DESIGN SYSTEM & VARIABLES
   ============================================================ */
:root {
    --bg-primary: #0b0d12;
    --bg-secondary: #12151e;
    --bg-card: rgba(22, 26, 38, 0.7);
    --bg-input: #0f111a;

    --accent: #6164f3;
    --accent-light: #8386fb;
    --accent-glow: rgba(97, 100, 243, 0.3);

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --error: #f43f5e;
    --error-bg: rgba(244, 63, 94, 0.12);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border: rgba(45, 50, 75, 0.6);
    --border-hover: rgba(97, 100, 243, 0.5);
    --radius: 20px;
    --radius-sm: 10px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    background-image: 
        radial-gradient(at 0% 0%, rgba(97, 100, 243, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(131, 134, 251, 0.05) 0px, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

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

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.05); opacity: 0.8; }
    100% { transform: scale(1); opacity: 0.5; }
}

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

@keyframes slideBg {
    from { background-position: 0% 0%; }
    to { background-position: 100% 100%; }
}

.fade-in { animation: fadeInUp 0.6s ease-out forwards; }

/* ============================================================
   LAYOUT
   ============================================================ */
.app-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px 40px;
    width: 100%;
    z-index: 10;
}

/* ============================================================
   HERO BANNER
   ============================================================ */
.hero-banner {
    position: relative;
    width: 100%;
    height: 320px;
    background: url('/static/hero_bg.png') no-repeat center center/cover;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: -60px;
    border-radius: 0 0 40px 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

.hero-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 0%, var(--bg-primary) 100%);
}

.hero-content {
    position: relative;
    z-index: 5;
    animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.header-logo {
    font-size: 3rem;
    margin-bottom: 15px;
    filter: drop-shadow(0 0 15px var(--accent-glow));
}

.hero-banner h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff, #8386fb);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    line-height: 1.1;
}

.hero-banner p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ============================================================
   GLASS CARD
   ============================================================ */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    transition: transform var(--transition), border-color var(--transition);
}

.glass-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
}

.card-title {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ============================================================
   UPLOAD SECTION
   ============================================================ */
.upload-area {
    background: var(--bg-input);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    transition: all var(--transition);
    cursor: pointer;
    position: relative;
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--accent);
    background: rgba(97, 100, 243, 0.04);
}

.upload-area.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    border-style: solid;
}

.upload-visual {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.upload-illustration {
    width: 140px;
    height: auto;
    filter: drop-shadow(0 0 20px var(--accent-glow));
    transition: transform var(--transition);
}

.upload-area:hover .upload-illustration { transform: scale(1.05); }

.upload-text {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.upload-subtext {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.upload-filename {
    margin-top: 15px;
    color: var(--success);
    font-weight: 600;
    font-size: 0.9rem;
}

#fileInput { display: none; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    padding: 14px 36px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: #fff;
    box-shadow: 0 8px 16px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 24px var(--accent-glow);
}

.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; filter: grayscale(1); }

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

.btn-secondary:hover { border-color: var(--accent); background: var(--bg-input); }

/* ============================================================
   PROGRESS SECTION
   ============================================================ */
.progress-section { display: none; text-align: center; }

.processing-visual {
    position: relative;
    width: 60px;
    height: 60px;
    margin: 0 auto 30px;
}

.spinner-ring {
    width: 100%;
    height: 100%;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.pulse-ring {
    position: absolute;
    inset: -10px;
    background: var(--accent-glow);
    border-radius: 50%;
    animation: pulse 2s infinite ease-in-out;
}

.progress-bar-track {
    width: 100%;
    height: 10px;
    background: var(--bg-input);
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    border-radius: 10px;
    transition: width 0.5s cubic-bezier(0.1, 0.7, 0.1, 1);
}

.progress-status { font-weight: 600; color: var(--accent-light); }

/* ============================================================
   RESULTS SECTION
   ============================================================ */
.results-section { display: none; }

.download-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.download-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    padding: 24px;
    border-radius: var(--radius);
    text-align: center;
    transition: all var(--transition);
    cursor: pointer;
}

.download-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    background: rgba(97, 100, 243, 0.08);
}

.dl-icon { font-size: 2.5rem; margin-bottom: 14px; display: block; filter: drop-shadow(0 0 8px rgba(0,0,0,0.5)); }
.dl-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.dl-desc { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; }

/* ============================================================
   FILE LIST
   ============================================================ */
.files-preview { display: none; }
.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 10px;
}

.file-item {
    background: var(--bg-input);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    border-left: 4px solid var(--accent);
}

/* ============================================================
   STATUS TOASTS
   ============================================================ */
.status-toast {
    padding: 16px 24px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-toast.success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.status-toast.error { background: var(--error-bg); color: var(--error); border: 1px solid rgba(244, 63, 94, 0.2); }

.stats-row { display: flex; gap: 20px; color: var(--text-muted); font-size: 0.85rem; margin-bottom: 20px; font-weight: 600; }
.stat-value { color: var(--text-primary); }

/* ============================================================
   FOOTER
   ============================================================ */
.footer { text-align: center; padding: 40px; color: var(--text-muted); font-size: 0.8rem; letter-spacing: 0.1em; }
