@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400..700&family=Caveat:wght@400..700&family=Inter:wght@300..700&family=JetBrains+Mono:wght@400..700&display=swap');

:root {
    --color-cream: #FBF8F2;
    --color-navy: #0C2A4A;
    --color-blue: #2E6FB8;
    --color-sky-soft: #EAF2FB;
    --color-ink: #2C2C2A;
    --color-muted: #5F5E5A;
    --color-card: #FFFFFF;
    --color-border: #ECE3D3;
    --font-display: "Bricolage Grotesque", "Inter", sans-serif;
    --font-sans: "Inter", sans-serif;
    --font-hand: "Caveat", cursive;
    --font-mono: "JetBrains Mono", monospace;
    --shadow-soft: 0 18px 40px -24px rgba(12, 42, 74, 0.28);
    --shadow-lift: 0 28px 60px -28px rgba(12, 42, 74, 0.35);
    --transition-smooth: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    background-color: var(--color-cream);
    color: var(--color-ink);
    font-family: var(--font-sans);
    line-height: 1.6;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background: rgba(251, 248, 242, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 1.5rem;
}

.nav-container {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.logo-icon {
    width: 2.2rem;
    height: 2.2rem;
    background: var(--color-navy);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    transition: var(--transition-smooth);
}

.logo:hover .logo-icon {
    transform: rotate(-8deg) scale(1.05);
}

.logo-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--color-navy);
}

.api-badge {
    background: var(--color-sky-soft);
    color: var(--color-blue);
    padding: 0.4rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid rgba(46, 111, 184, 0.15);
}

.api-badge.unconfigured {
    background: #FFF2F2;
    color: #D32F2F;
    border-color: rgba(211, 47, 47, 0.15);
}

/* Main Container */
main {
    flex: 1;
    max-width: 1000px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 2.5rem;
}

h1 {
    font-family: var(--font-display);
    color: var(--color-navy);
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 0.75rem;
}

.subtitle {
    color: var(--color-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Handwritten highlights */
.handwritten {
    font-family: var(--font-hand);
    font-size: 1.8rem;
    color: var(--color-blue);
    display: inline-block;
    transform: rotate(-1.5deg);
    margin-left: 0.25rem;
    vertical-align: middle;
}

/* Steps Indicator */
.steps-nav {
    display: flex;
    justify-content: space-between;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.4rem;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow-soft);
    overflow-x: auto;
}

.step-tab {
    flex: 1;
    text-align: center;
    padding: 0.6rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-muted);
    background: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.step-tab.active {
    background: var(--color-navy);
    color: #fff;
    box-shadow: 0 8px 16px -6px rgba(12, 42, 74, 0.4);
}

.step-tab.completed {
    color: var(--color-blue);
    background: var(--color-sky-soft);
}

.step-number {
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    background: rgba(0,0,0,0.06);
    display: grid;
    place-items: center;
    font-size: 0.75rem;
}

.step-tab.active .step-number {
    background: rgba(255,255,255,0.2);
}

.step-tab.completed .step-number {
    background: rgba(46, 111, 184, 0.15);
}

/* Card / Wizards Content */
.wizard-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: var(--shadow-soft);
    display: none;
    transition: var(--transition-smooth);
    position: relative;
}

.wizard-card.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

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

h2 {
    font-family: var(--font-display);
    color: var(--color-navy);
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Form controls */
.form-group {
    margin-bottom: 1.75rem;
}

label {
    display: block;
    font-weight: 600;
    color: var(--color-navy);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.help-text {
    font-size: 0.85rem;
    color: var(--color-muted);
    margin-top: 0.25rem;
}

input[type="text"], 
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    background-color: var(--color-cream);
    font-family: var(--font-sans);
    color: var(--color-ink);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-blue);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(46, 111, 184, 0.1);
}

/* Buttons */
.btn {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.8rem 1.6rem;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
    will-change: transform;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--color-navy);
    color: #fff;
    box-shadow: 0 10px 24px -10px rgba(12, 42, 74, 0.5);
}

.btn-primary:hover {
    background: #0f3760;
    box-shadow: 0 14px 28px -8px rgba(12, 42, 74, 0.6);
}

.btn-secondary {
    background: var(--color-sky-soft);
    color: var(--color-blue);
    border: 1px solid rgba(46, 111, 184, 0.15);
}

.btn-secondary:hover {
    background: #dde9f7;
}

.btn-ghost {
    background: transparent;
    color: var(--color-muted);
}

.btn-ghost:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--color-navy);
}

.btn-danger {
    background: #FFEBEB;
    color: #D32F2F;
    border: 1px solid rgba(211, 47, 47, 0.15);
}

.btn-danger:hover {
    background: #FFD6D6;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.button-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.button-group-right {
    display: flex;
    gap: 1rem;
}

/* Upload Area */
.upload-dropzone {
    border: 2px dashed var(--color-border);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    background: var(--color-cream);
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
    border-color: var(--color-blue);
    background: var(--color-sky-soft);
}

.upload-icon {
    font-size: 2.5rem;
    color: var(--color-blue);
    transition: var(--transition-smooth);
}

.upload-dropzone:hover .upload-icon {
    transform: translateY(-4px) rotate(-4deg);
}

.file-list {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.file-item {
    background: var(--color-cream);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.file-size {
    font-size: 0.8rem;
    color: var(--color-muted);
}

/* Notes & Handwritten alerts */
.note-bubble {
    background: #FFFBF0;
    border: 1px solid #F3E8C4;
    border-radius: 16px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.note-bubble-text {
    font-family: var(--font-hand);
    font-size: 1.35rem;
    color: #B27B00;
    line-height: 1.3;
}

/* Interactive tables for transcript editing */
.transcript-table-container {
    border: 1px solid var(--color-border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.transcript-table {
    width: 100%;
    border-collapse: collapse;
}

.transcript-table th {
    background: var(--color-cream);
    color: var(--color-navy);
    font-weight: 600;
    font-size: 0.85rem;
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
}

.transcript-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

.transcript-table tr:last-child td {
    border-bottom: none;
}

.timestamp-badge {
    background: var(--color-sky-soft);
    color: var(--color-blue);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
}

.transcript-table textarea {
    padding: 0.5rem;
    font-size: 0.85rem;
    min-height: 50px;
    resize: vertical;
}

/* Script Chat style */
.script-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.script-line {
    display: flex;
    gap: 1rem;
    background: var(--color-cream);
    border: 1px solid var(--color-border);
    padding: 1rem;
    border-radius: 16px;
    transition: var(--transition-smooth);
}

.script-line:hover {
    box-shadow: 0 4px 12px rgba(12, 42, 74, 0.04);
}

.speaker-avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--color-navy);
    color: #fff;
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.speaker-avatar.female {
    background: var(--color-blue);
}

.line-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.speaker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.speaker-name {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--color-navy);
}

.line-actions {
    display: flex;
    gap: 0.5rem;
}

.action-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-muted);
    font-size: 0.9rem;
    padding: 0.2rem;
    border-radius: 4px;
    transition: var(--transition-smooth);
}

.action-icon-btn:hover {
    color: var(--color-navy);
    background: rgba(0,0,0,0.05);
}

.script-line textarea {
    padding: 0.5rem;
    font-size: 0.9rem;
    background: #fff;
    min-height: 60px;
}

/* Voices Grid */
.voice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.voice-card {
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 1.5rem;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.voice-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.voice-gender-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--color-sky-soft);
    color: var(--color-blue);
    display: grid;
    place-items: center;
    font-size: 1.1rem;
}

.voice-card-title {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--color-navy);
    font-size: 1.1rem;
}

/* Audio Player */
.audio-player-container {
    background: var(--color-cream);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

audio {
    width: 100%;
    outline: none;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(251, 248, 242, 0.9);
    backdrop-filter: blur(4px);
    border-radius: 24px;
    z-index: 10;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.loading-overlay.active {
    display: flex;
}

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

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

.loading-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-navy);
}

.loading-progress-container {
    width: 60%;
    background: var(--color-border);
    height: 6px;
    border-radius: 99px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--color-blue);
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--color-muted);
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--color-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--color-border);
    background: var(--color-cream);
    margin-top: auto;
}

/* API Key Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(12, 42, 74, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 24px;
    max-width: 500px;
    width: 90%;
    padding: 2.5rem;
    box-shadow: var(--shadow-lift);
    transform: translateY(20px);
    transition: var(--transition-smooth);
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.video-preview-wrapper {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    background: #000;
    aspect-ratio: 16 / 9;
    margin-bottom: 1.5rem;
}

video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
