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

:root {
    --bg: #041c16;        /* Vert forêt très sombre */
    --panel: #0a362a;     /* Vert foncé pour les panneaux */
    --panel-2: #0f4435;   /* Vert légèrement plus clair pour les éléments secondaires */
    --text: #f0fdf4;      /* Blanc menthe très clair pour le texte */
    --muted: #a7f3d0;     /* Vert menthe clair pour le texte secondaire */
    --accent: #10b981;    /* Vert émeraude éclatant */
    --accent-2: #f97316;  /* Orange vif pour les contrastes */
    --danger: #f87171;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: radial-gradient(circle at top, #0d5c46 0%, var(--bg) 60%);
    color: var(--text);
    font-family: 'Outfit', Inter, Segoe UI, Roboto, sans-serif;
    min-height: 100vh;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 40px;
    border-bottom: 3px solid rgba(16, 185, 129, 0.2);
    background: rgba(4, 28, 22, 0.85);
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.15);
}

.brand {
    color: var(--text);
    font-weight: 900;
    text-decoration: none;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand::before {
    content: "🎬";
    font-size: 1.6rem;
    animation: rotate 3s ease-in-out infinite alternate;
}

@keyframes rotate {
    0% { transform: rotate(-8deg); }
    100% { transform: rotate(8deg); }
}

.badge {
    color: var(--muted);
    font-weight: 700;
    font-size: .95rem;
    background: rgba(16, 185, 129, 0.15);
    padding: 6px 14px;
    border-radius: 99px;
    border: 2px solid rgba(16, 185, 129, 0.3);
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 24px;
}

.hero {
    margin-bottom: 28px;
}
.hero h1 {
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 900;
    margin: 0 0 12px;
}
.hero p {
    color: var(--muted);
    font-size: 1.1rem;
    max-width: 760px;
    line-height: 1.7;
}

/* 3D Cards Style - Dark Forest Green Theme */
.card, .premium-card {
    background: var(--panel);
    border: 3px solid rgba(16, 185, 129, 0.25);
    border-bottom: 8px solid rgba(4, 28, 22, 0.7);
    border-radius: 24px;
    padding: 30px;
    margin-bottom: 24px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.prompt-input, .text-input, .select-input {
    width: 100%;
    border: 3px solid rgba(16, 185, 129, 0.25);
    background: #041c16;
    color: var(--text);
    border-radius: 16px;
    padding: 16px;
    font-size: 1rem;
    line-height: 1.6;
    font-family: inherit;
    font-weight: 600;
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.prompt-input:focus, .text-input:focus, .select-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.25);
}

.select-input option {
    background: #041c16;
    color: var(--text);
}

/* POP-3D Buttons Style (Zelda/Nintendo style) */
button, .download, .btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 3px solid #032b20;
    border-bottom: 7px solid #032b20;
    color: #ffffff;
    background: linear-gradient(135deg, #10b981, #059669); /* Vert émeraude */
    border-radius: 20px;
    padding: 14px 26px;
    font-weight: 900;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.1s ease;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

button:hover, .download:hover, .btn-primary:hover {
    transform: translateY(2px);
    border-bottom-width: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

button:active, .download:active, .btn-primary:active {
    transform: translateY(5px);
    border-bottom-width: 2px;
    box-shadow: none;
}

/* Secondary 3D Orange Button */
.btn-gold {
    background: linear-gradient(135deg, #f97316, #ea580c) !important; /* Orange */
    border-color: #5c1f0a !important;
    border-bottom-color: #5c1f0a !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25) !important;
}

.btn-gold:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
}

.project-list {
    display: grid;
    gap: 14px;
}

.project-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px 24px;
    border: 3px solid rgba(16, 185, 129, 0.25);
    border-bottom: 6px solid rgba(4, 28, 22, 0.7);
    border-radius: 18px;
    background: var(--panel);
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    transition: all 0.2s ease;
}

.project-item:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    border-bottom-color: #059669;
    background: var(--panel-2);
}

.muted {
    color: var(--muted);
    font-weight: 600;
}

/* 3D Progress Bar */
.progress-wrap {
    height: 22px;
    background: #041c16;
    border-radius: 99px;
    overflow: hidden;
    border: 3px solid rgba(16, 185, 129, 0.25);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transition: width .4s cubic-bezier(0.4, 0, 0.2, 1);
}

.video-player {
    width: 100%;
    max-height: 640px;
    border-radius: 20px;
    border: 3px solid rgba(16, 185, 129, 0.25);
    background: #000;
}

.scene-card {
    border-top: 2px dashed rgba(16, 185, 129, 0.25);
    padding: 22px 0;
}

pre {
    white-space: pre-wrap;
    color: var(--muted);
    background: #041c16;
    padding: 14px;
    border-radius: 10px;
    border: 2px solid rgba(16, 185, 129, 0.25);
    font-family: inherit;
    font-size: 0.95rem;
}

.error {
    color: var(--danger);
    font-weight: 800;
}

@media (max-width: 760px) {
    .topbar, .project-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* ==========================================
   PREMIUM TALKING AVATAR AND DASHBOARD UI
   ========================================== */

/* Hero Premium Card */
.hero-premium {
    position: relative;
    padding: 40px;
    background: linear-gradient(135deg, #093c2f 0%, #041c16 100%);
    border: 3px solid rgba(16, 185, 129, 0.3);
    border-bottom: 8px solid rgba(4, 28, 22, 0.7);
    border-radius: 28px;
    margin-bottom: 32px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.hero-glow {
    position: absolute;
    top: -50%;
    right: -20%;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.4) 0%, rgba(249, 115, 22, 0) 70%);
    filter: blur(40px);
    pointer-events: none;
}

.hero-text-content h1 {
    font-size: 2.2rem;
    font-weight: 900;
    margin: 0 0 10px 0;
    background: linear-gradient(90deg, #34d399, #f97316);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-text-content p {
    color: var(--muted);
    font-size: 1.1rem;
    max-width: 700px;
    line-height: 1.6;
    margin: 0;
}

/* Tabs UI */
.tab-container {
    display: flex;
    gap: 10px;
    margin-bottom: 26px;
    border-bottom: 3px solid rgba(16, 185, 129, 0.25);
    padding-bottom: 12px;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    color: var(--muted);
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    border-radius: 14px;
    transition: all 0.2s ease;
}

.tab-btn svg {
    opacity: 0.8;
}

.tab-btn:hover {
    color: var(--text);
    background: rgba(16, 185, 129, 0.1);
}

.tab-btn.active {
    color: #ffffff;
    background: linear-gradient(135deg, var(--accent), #059669);
    border: 2px solid #032b20;
    border-bottom: 5px solid #032b20;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.tab-btn.active svg {
    color: #ffffff;
}

.tab-pane {
    display: none;
}
.tab-pane.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

/* Form Layout */
.card-header {
    margin-bottom: 24px;
}
.card-header h2 {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0 0 6px 0;
    color: var(--text);
}
.card-header p {
    color: var(--muted);
    font-size: 0.95rem;
    margin: 0;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}
.form-group label {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text);
}

/* Grid layout for Avatar Upload */
.form-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 30px;
}
@media (max-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}
.form-fields-column {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Avatar Dropzone 3D */
.avatar-dropzone {
    height: 180px;
    border: 3px dashed var(--accent);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: rgba(16, 185, 129, 0.05);
    overflow: hidden;
    position: relative;
    transition: all 0.2s ease;
}
.avatar-dropzone:hover {
    border-color: #059669;
    background: rgba(16, 185, 129, 0.1);
    transform: scale(1.02);
}
#avatar-preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--muted);
}
#avatar-preview-placeholder svg {
    margin-bottom: 10px;
    color: var(--accent);
}
#avatar-preview-placeholder p {
    font-size: 0.9rem;
    margin: 0 0 4px 0;
    font-weight: 800;
}
#avatar-preview-placeholder span {
    font-size: 0.8rem;
    opacity: 0.8;
}
#avatar-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
}

/* Range slider (duration selector) */
.range-input {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: #041c16;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    margin-top: 10px;
    cursor: pointer;
}
.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-2), #ea580c);
    border: 3px solid #fff;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Checkbox group */
.checkbox-group {
    display: flex;
    align-items: flex-end;
}
.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    padding-bottom: 12px;
}
.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Recent Projects Cards 3D */
.recent-projects-card {
    background: rgba(10, 54, 42, 0.5);
    border: 3px solid rgba(16, 185, 129, 0.25);
    border-bottom: 6px solid rgba(4, 28, 22, 0.7);
    border-radius: 24px;
    padding: 24px;
    margin-top: 32px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}
.project-card-link {
    display: flex;
    flex-direction: column;
    padding: 22px;
    background: var(--panel);
    border: 3px solid rgba(16, 185, 129, 0.2);
    border-bottom: 6px solid rgba(4, 28, 22, 0.7);
    border-radius: 20px;
    color: var(--text);
    text-decoration: none;
    transition: all 0.2s ease;
}
.project-card-link:hover {
    border-color: var(--accent);
    border-bottom-color: #059669;
    transform: translateY(-4px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.2);
}
.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.project-type-badge {
    font-size: 0.8rem;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.avatar-badge {
    background: rgba(217, 119, 6, 0.15);
    color: #f59e0b;
    border: 2px solid #d97706;
}
.story-badge {
    background: rgba(37, 99, 235, 0.15);
    color: #60a5fa;
    border: 2px solid #2563eb;
}
.status-indicator {
    font-size: 0.8rem;
    font-weight: 800;
}
.status-indicator.draft { color: #94a3b8; }
.status-indicator.running { color: #3b82f6; animation: pulse 1.5s infinite; }
.status-indicator.done { color: #10b981; }
.status-indicator.failed { color: #ef4444; }

.project-card-link h3 {
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0 0 14px 0;
    line-height: 1.4;
    height: 48px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.project-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--muted);
    border-top: 2px dashed rgba(16, 185, 129, 0.2);
    padding-top: 14px;
}
.empty-state {
    color: var(--muted);
    text-align: center;
    padding: 40px;
    background: var(--panel);
    border: 3px dashed rgba(16, 185, 129, 0.25);
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 600;
}

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

/* Detail view premium styling */
.detail-container {
    max-width: 900px;
    margin: 0 auto;
    animation: fadeIn 0.4s ease;
}
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.back-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 800;
    transition: color 0.2s ease;
}
.back-link:hover {
    color: var(--text);
}
.font-sm {
    font-size: 0.85rem;
}

/* 3D Progress Bar Premium */
.progress-wrap-premium {
    height: 24px;
    background: #041c16;
    border-radius: 99px;
    overflow: hidden;
    border: 3px solid rgba(16, 185, 129, 0.25);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
    margin: 18px 0;
}
.progress-bar-premium {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #3b82f6, #f97316);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.status-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 20px;
}
.error-msg-box {
    display: none;
    padding: 14px 20px;
    background: rgba(239, 68, 68, 0.1);
    border: 3px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    color: #ef4444;
    font-weight: 800;
    font-size: 0.95rem;
}
.error-msg-box.visible {
    display: block;
}

/* Premium Video Zone */
.video-render-zone {
    margin-top: 30px;
    border-radius: 24px;
    overflow: hidden;
    background: #000000;
    border: 4px solid rgba(16, 185, 129, 0.25);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}
.empty-video-placeholder {
    height: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: #041c16;
    color: #ffffff;
}
.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(16, 185, 129, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.video-container-box {
    display: flex;
    flex-direction: column;
}
.video-player-premium {
    width: 100%;
    max-height: 520px;
    object-fit: contain;
    background: #000;
}
.download-bar {
    padding: 20px;
    background: var(--panel);
    border-top: 3px solid rgba(16, 185, 129, 0.2);
    display: flex;
    justify-content: center;
}

/* Info Grid for Avatar detail view */
.avatar-info-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    margin-top: 24px;
}
@media (max-width: 640px) {
    .avatar-info-grid {
        grid-template-columns: 1fr;
    }
}
.avatar-photo-frame {
    width: 100%;
    height: 240px;
    border-radius: 18px;
    overflow: hidden;
    border: 3px solid rgba(16, 185, 129, 0.25);
    background: #041c16;
}
.avatar-ref-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.avatar-meta-settings {
    margin-top: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}
.script-text-box {
    background: #041c16;
    border: 3px solid rgba(16, 185, 129, 0.25);
    border-radius: 18px;
    padding: 20px;
    color: var(--text);
    font-size: 1rem;
    line-height: 1.6;
    font-weight: 500;
    max-height: 270px;
    overflow-y: auto;
}

/* Scene Cards Premium Style */
.scenes-section {
    margin-top: 28px;
}
.scenes-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}
.scene-card-premium {
    display: flex;
    gap: 24px;
    padding: 24px;
    background: var(--panel);
    border: 3px solid rgba(16, 185, 129, 0.2);
    border-bottom: 6px solid rgba(4, 28, 22, 0.7);
    border-radius: 20px;
}
@media (max-width: 640px) {
    .scene-card-premium {
        flex-direction: column;
    }
}
.scene-num {
    font-size: 0.85rem;
    font-weight: 900;
    text-transform: uppercase;
    color: var(--accent-2);
    letter-spacing: 1px;
    min-width: 80px;
}
.scene-details {
    flex: 1;
}
.scene-details h3 {
    margin: 0 0 10px 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
}
.scene-narration {
    color: var(--text);
    font-weight: 500;
    line-height: 1.6;
    margin: 0 0 16px 0;
}
.scene-prompt-box {
    background: #041c16;
    border: 2px solid rgba(16, 185, 129, 0.25);
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 0.9rem;
}
.scene-prompt-box strong {
    color: var(--muted);
    display: block;
    margin-bottom: 6px;
}
.scene-prompt-box pre {
    margin: 0;
    color: #60a5fa;
    background: transparent;
    border: none;
    padding: 0;
}
