/* ============================================
   Avatar Studio - CSS
   Clean, modern, professional design
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #6C5CE7;
    --primary-light: #A29BFE;
    --primary-bg: #F3F0FF;
    --dark: #2D3436;
    --text: #2D3436;
    --text-light: #636E72;
    --white: #fff;
    --border: #DFE6E9;
    --success: #00B894;
    --radius: 16px;
    --shadow: 0 4px 20px rgba(108, 92, 231, 0.08);
}

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(160deg, #F8F7FF 0%, #F0EEFF 50%, #F5F3FF 100%);
    color: var(--text);
    min-height: 100vh;
}

/* --- Global Nav --- */
.global-nav { background: #1F313F; padding: 0; z-index: 10500; position: relative; }
.gnav-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; }
.gnav-brand { font-family: "Nunito",sans-serif; font-size: 13px; font-weight: 800; color: #fff; text-decoration: none; padding: 8px 0; opacity: 0.9; }
.gnav-links { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.gnav-links::-webkit-scrollbar { display: none; }
.gnav-link { font-family: "Nunito",sans-serif; font-size: 12px; font-weight: 700; color: rgba(255,255,255,0.6); text-decoration: none; padding: 8px 12px; white-space: nowrap; border-bottom: 2px solid transparent; transition: all 0.2s; }
.gnav-link:hover { color: #fff; background: rgba(255,255,255,0.05); }
.gnav-active { color: #fff; border-bottom-color: #A29BFE; }

/* --- Header --- */
.studio-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(20px);
    border-bottom: 2px solid var(--border);
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-icon { font-size: 28px; }
.header-left h1 { font-size: 20px; font-weight: 900; color: var(--primary); }
.header-sub { font-size: 12px; color: var(--text-light); font-weight: 600; display: block; }
.header-right { display: flex; align-items: center; gap: 10px; }
.user-name { font-size: 13px; color: var(--text-light); }
.btn-sm { font-family: inherit; font-size: 12px; font-weight: 700; padding: 5px 14px; border-radius: 20px; border: 2px solid var(--border); background: none; color: var(--text-light); text-decoration: none; cursor: pointer; }
.btn-sm:hover { border-color: var(--primary); color: var(--primary); }

/* --- Main --- */
.studio-main { max-width: 700px; margin: 0 auto; padding: 24px 16px 50px; }

/* --- Steps bar --- */
.steps-bar { display: flex; align-items: center; justify-content: center; gap: 0; margin-bottom: 24px; }
.step-dot {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 900;
    background: var(--border); color: var(--text-light);
    transition: all 0.3s;
}
.step-dot.active { background: var(--primary); color: white; box-shadow: 0 4px 12px rgba(108,92,231,0.3); }
.step-dot.done { background: var(--success); color: white; }
.step-line { width: 60px; height: 3px; background: var(--border); border-radius: 2px; }

/* --- Panel --- */
.studio-panel {
    background: var(--white);
    border-radius: var(--radius);
    padding: 28px 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 2px solid transparent;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.studio-panel h2 { font-size: 20px; font-weight: 900; margin-bottom: 8px; }
.panel-desc { font-size: 14px; color: var(--text-light); margin-bottom: 16px; }

/* --- Upload zone --- */
.upload-zone {
    border: 3px dashed var(--border); border-radius: 14px;
    min-height: 200px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.3s; overflow: hidden; margin-bottom: 16px;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--primary); background: rgba(108,92,231,0.03); }
.upload-placeholder { text-align: center; padding: 30px; }
.upload-icon { font-size: 52px; display: block; margin-bottom: 8px; }
.upload-placeholder p { font-size: 15px; }
.upload-hint { font-size: 12px; color: var(--text-light); }
.upload-preview { position: relative; width: 100%; text-align: center; padding: 10px; }
.upload-preview img { max-height: 280px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.remove-btn { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border-radius: 50%; background: rgba(0,0,0,0.6); color: white; border: none; font-size: 16px; cursor: pointer; }

/* --- Buttons --- */
.next-btn, .generate-btn {
    width: 100%; padding: 14px; border: none; border-radius: 14px;
    font-family: inherit; font-size: 16px; font-weight: 800;
    background: var(--primary); color: white; cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(108,92,231,0.25);
}
.next-btn:hover, .generate-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(108,92,231,0.35); }
.next-btn:disabled { background: #B2BEC3; box-shadow: none; cursor: default; transform: none; }
.generate-btn { background: linear-gradient(135deg, #6C5CE7, #A29BFE); font-size: 18px; padding: 16px; }
.back-btn {
    padding: 12px 24px; border: 2px solid var(--border); border-radius: 14px;
    background: none; font-family: inherit; font-size: 14px; font-weight: 700;
    color: var(--text-light); cursor: pointer; transition: all 0.2s;
}
.back-btn:hover { border-color: var(--primary); color: var(--primary); }
.step-buttons { display: flex; gap: 10px; margin-top: 16px; }
.step-buttons .next-btn, .step-buttons .generate-btn { flex: 1; }

/* --- Voice grid --- */
.voice-section { margin-bottom: 20px; }
.field-label { font-size: 14px; font-weight: 800; margin-bottom: 8px; display: block; }
.voice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.voice-option {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 10px; border: 2px solid var(--border); border-radius: 10px;
    cursor: pointer; transition: all 0.2s; font-size: 13px;
}
.voice-option:hover { border-color: var(--primary-light); }
.voice-option.selected { border-color: var(--primary); background: var(--primary-bg); }
.voice-option input { display: none; }
.voice-gender { font-size: 18px; flex-shrink: 0; }
.voice-name { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.voice-play {
    background: none; border: none; font-size: 14px; cursor: pointer;
    opacity: 0.5; transition: opacity 0.2s; padding: 2px 4px; border-radius: 6px;
}
.voice-play:hover { opacity: 1; background: rgba(108,92,231,0.1); }
.vg-f { background: rgba(255,105,180,0.1); border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }
.vg-m { background: rgba(70,130,180,0.1); border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }

/* --- Text --- */
.text-section textarea {
    width: 100%; padding: 14px; border: 2.5px solid var(--border); border-radius: 12px;
    font-family: inherit; font-size: 15px; resize: vertical; min-height: 120px;
    color: var(--text); transition: border-color 0.3s; line-height: 1.6;
}
.text-section textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(108,92,231,0.08); }
.text-footer { display: flex; justify-content: flex-end; margin-top: 4px; }
.text-footer span { font-size: 11px; color: var(--text-light); }

/* --- Summary --- */
.summary-card {
    background: var(--primary-bg); border-radius: 12px; padding: 16px; margin-bottom: 16px;
}
.summary-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.summary-row:last-child { margin-bottom: 0; }
.summary-label { font-size: 13px; font-weight: 800; color: var(--primary); min-width: 55px; }
.summary-value { font-size: 14px; color: var(--text); }
.summary-thumb { width: 60px; height: 60px; border-radius: 10px; object-fit: cover; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.summary-text-preview { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* --- Processing --- */
.processing-panel { text-align: center; padding: 40px 24px; }
.processing-anim { position: relative; width: 80px; height: 80px; margin: 0 auto 16px; }
.proc-ring {
    width: 80px; height: 80px; border-radius: 50%;
    border: 4px solid var(--border); border-top-color: var(--primary);
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.proc-icon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 28px; }
.proc-status { font-size: 15px; color: var(--primary); font-weight: 700; margin: 12px 0; }
.proc-bar { width: 80%; max-width: 300px; height: 8px; background: var(--border); border-radius: 4px; margin: 0 auto 12px; overflow: hidden; }
.proc-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-light)); border-radius: 4px; width: 0; transition: width 0.5s; }
.proc-note { font-size: 12px; color: var(--text-light); }

/* --- Result --- */
.result-panel { text-align: center; }
.result-panel h2 { margin-bottom: 16px; }
.video-wrap { margin-bottom: 16px; }
.result-video { width: 100%; max-width: 480px; border-radius: 14px; box-shadow: 0 8px 30px rgba(0,0,0,0.12); }
.result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.action-btn {
    font-family: inherit; font-size: 14px; font-weight: 700;
    padding: 10px 22px; border-radius: 14px; border: none;
    cursor: pointer; text-decoration: none; display: inline-block; transition: all 0.3s;
}
.download-btn { background: var(--success); color: white; }
.new-btn { background: var(--primary); color: white; }
.action-btn:hover { transform: translateY(-2px); filter: brightness(1.1); }

/* --- Gallery --- */
.gallery-section { margin-top: 20px; }
.gallery-section h2 { font-size: 18px; font-weight: 900; margin-bottom: 14px; }
.video-grid { display: flex; flex-direction: column; gap: 10px; }
.video-card {
    display: flex; align-items: center; gap: 12px;
    background: var(--white); border-radius: 12px; padding: 10px;
    box-shadow: var(--shadow); border: 1px solid var(--border); position: relative;
}
.video-card-player { width: 100px; height: 70px; border-radius: 8px; overflow: hidden; flex-shrink: 0; position: relative; background: #000; }
.video-card-player video { width: 100%; height: 100%; object-fit: cover; }
.play-overlay {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.3); color: white; font-size: 24px; border: none; cursor: pointer;
}
.video-card-info { flex: 1; min-width: 0; }
.video-card-text { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-card-meta { font-size: 11px; color: var(--text-light); }
.video-delete { position: absolute; top: 6px; right: 6px; background: none; border: none; cursor: pointer; font-size: 14px; opacity: 0.4; }
.video-delete:hover { opacity: 1; }

/* --- Login --- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card {
    background: white; border-radius: 24px; padding: 48px 40px; text-align: center;
    box-shadow: 0 16px 50px rgba(108,92,231,0.12); max-width: 400px; width: 100%;
    border: 3px solid rgba(108,92,231,0.1);
}
.login-icon { font-size: 56px; margin-bottom: 12px; }
.login-card h1 { font-size: 28px; font-weight: 900; color: var(--primary); margin-bottom: 4px; }
.login-sub { font-size: 14px; color: var(--text-light); font-weight: 600; margin-bottom: 14px; }
.login-card > p { font-size: 15px; color: var(--text-light); margin-bottom: 24px; line-height: 1.5; }
.btn-login {
    display: inline-block; font-family: inherit; font-size: 16px; font-weight: 800;
    color: white; background: linear-gradient(135deg, var(--primary), var(--primary-light));
    padding: 14px 36px; border-radius: 18px; text-decoration: none;
    transition: all 0.3s; box-shadow: 0 6px 20px rgba(108,92,231,0.3);
}
.btn-login:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(108,92,231,0.35); }

/* --- Responsive --- */
@media (max-width: 600px) {
    .voice-grid { grid-template-columns: repeat(2, 1fr); }
    .studio-panel { padding: 20px 16px; }
    .step-buttons { flex-direction: column; }
    .gnav-brand { display: none; }
    .gnav-inner { justify-content: center; }
    .gnav-link { font-size: 11px; padding: 8px 8px; }
}
