/* ===== CSS Variables / Design Tokens ===== */
:root {
    /* Colors */
    --color-primary: #2563EB;
    --color-primary-hover: #1D4ED8;
    --color-secondary: #3B82F6;
    --color-cta: #F97316;
    --color-cta-hover: #EA580C;
    --color-danger: #EF4444;
    --color-danger-hover: #DC2626;
    --color-success: #10B981;
    
    /* Dark Theme */
    --bg-base: #0F172A;
    --bg-surface: #1E293B;
    --bg-elevated: #334155;
    --bg-glass: rgba(30, 41, 59, 0.8);
    
    /* Text */
    --text-primary: #F8FAFC;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;
    
    /* Border */
    --border-color: rgba(148, 163, 184, 0.2);
    --border-glass: rgba(255, 255, 255, 0.1);
    
    /* Effects */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px rgba(37, 99, 235, 0.3);
    
    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Transitions */
    --transition-fast: 150ms ease-out;
    --transition-normal: 200ms ease-out;
    --transition-slow: 300ms ease-out;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* Visually hidden for screen readers */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== App Container ===== */
.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: 
        radial-gradient(ellipse at top, rgba(37, 99, 235, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(249, 115, 22, 0.1) 0%, transparent 50%),
        var(--bg-base);
}

/* ===== Header ===== */
.header {
    text-align: center;
    padding: 2rem 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    color: var(--color-primary);
    filter: drop-shadow(0 0 10px rgba(37, 99, 235, 0.5));
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--color-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ===== Main Content ===== */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 1.5rem 2rem;
    gap: 3rem;
}

/* ===== Section Titles ===== */
.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--color-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Hero Section ===== */
.hero-section {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

/* ===== Video Preview ===== */
.preview-container {
    width: 100%;
}

.preview-wrapper {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.preview-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.preview-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--text-muted);
    background: var(--bg-surface);
}

.preview-placeholder.hidden {
    display: none;
}

.placeholder-icon {
    width: 64px;
    height: 64px;
    opacity: 0.5;
}

.preview-placeholder p {
    font-size: 0.95rem;
    text-align: center;
    max-width: 280px;
}

/* Recording Indicator */
.recording-indicator {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.recording-indicator.hidden {
    display: none;
}

.rec-dot {
    width: 12px;
    height: 12px;
    background: var(--color-danger);
    border-radius: 50%;
    animation: pulse 1s ease-in-out infinite;
}

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

/* ===== Controls ===== */
.controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
}

.btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.btn-icon {
    width: 20px;
    height: 20px;
}

.btn-icon-small {
    width: 18px;
    height: 18px;
}

/* Start Button */
.btn-start {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

.btn-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}

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

.btn-start.hidden {
    display: none;
}

/* Stop Button */
.btn-stop {
    background: linear-gradient(135deg, var(--color-danger) 0%, #F87171 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.btn-stop:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

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

.btn-stop.hidden {
    display: none;
}

/* ===== Download Section ===== */
.download-section {
    width: 100%;
    max-width: 500px;
    animation: slideUp 0.3s ease-out;
}

.download-section.hidden {
    display: none;
}

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

.download-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
}

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

.download-icon {
    width: 40px;
    height: 40px;
    color: var(--color-success);
    flex-shrink: 0;
}

.download-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.download-header p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.download-buttons {
    display: flex;
    gap: 0.75rem;
}

.btn-format {
    flex: 1;
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: white;
    text-align: center;
}

.btn-webm {
    background: linear-gradient(135deg, var(--color-success) 0%, #34D399 100%);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-webm:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-mp4 {
    background: linear-gradient(135deg, var(--color-cta) 0%, #FB923C 100%);
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3);
}

.btn-mp4:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4);
}

/* ===== Features Section ===== */
.features-section {
    width: 100%;
    max-width: 1100px;
    padding: 2rem 0;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    padding: 1.5rem;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    transition: all var(--transition-normal);
}

.feature-card:hover {
    transform: translateY(-4px);
    border-color: var(--color-primary);
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.2);
}

.feature-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.feature-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.feature-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.feature-card p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===== How To Section ===== */
.howto-section {
    width: 100%;
    max-width: 900px;
    padding: 2rem 0;
}

.howto-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.howto-step {
    text-align: center;
    padding: 1.5rem;
}

.step-number {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--color-cta) 0%, #FB923C 100%);
    border-radius: 50%;
}

.howto-step h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.howto-step p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ===== FAQ Section ===== */
.faq-section {
    width: 100%;
    max-width: 800px;
    padding: 2rem 0;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.faq-item {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.faq-item summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    cursor: pointer;
    list-style: none;
    transition: background var(--transition-normal);
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary:hover {
    background: rgba(37, 99, 235, 0.1);
}

.faq-question {
    font-weight: 600;
    font-size: 0.9375rem;
}

.faq-icon {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    transition: transform var(--transition-normal);
    flex-shrink: 0;
}

.faq-item[open] .faq-icon {
    transform: rotate(180deg);
}

.faq-answer {
    padding: 0 1.25rem 1rem;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ===== Use Cases Section ===== */
.usecases-section {
    width: 100%;
    max-width: 1100px;
    padding: 2rem 0;
}

.usecases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.usecase-card {
    padding: 1.5rem;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    transition: all var(--transition-normal);
}

.usecase-card:hover {
    border-color: var(--color-cta);
    box-shadow: 0 10px 30px rgba(249, 115, 22, 0.15);
}

.usecase-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--color-cta);
}

.usecase-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===== Modal ===== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg), 0 0 60px rgba(37, 99, 235, 0.2);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 1.5rem 1.5rem 1rem;
    text-align: center;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.modal-header p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.modal-body {
    padding: 0.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.audio-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.audio-option:hover {
    border-color: var(--color-primary);
    background: rgba(37, 99, 235, 0.1);
}

.option-info {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.option-icon {
    width: 24px;
    height: 24px;
    color: var(--color-secondary);
    flex-shrink: 0;
}

.option-title {
    display: block;
    font-weight: 600;
    font-size: 0.9375rem;
    margin-bottom: 0.125rem;
}

.option-desc {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    flex-shrink: 0;
}

.toggle-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    display: block;
    width: 48px;
    height: 26px;
    background: var(--bg-base);
    border-radius: 26px;
    cursor: pointer;
    transition: background var(--transition-normal);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all var(--transition-normal);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--color-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
    background: white;
}

.toggle-switch input:focus-visible + .toggle-slider {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem 1.5rem;
    justify-content: flex-end;
}

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

.btn-secondary:hover {
    background: var(--bg-base);
    border-color: var(--text-muted);
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 2rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
}

.footer-note {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .header {
        padding: 1.5rem 1rem;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .logo-icon {
        width: 32px;
        height: 32px;
    }
    
    .main {
        padding: 0 1rem 1.5rem;
        gap: 2rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.9375rem;
    }
    
    .download-card {
        flex-direction: column;
        text-align: center;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .howto-steps {
        grid-template-columns: 1fr;
    }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}
