/* App Styles - Matches Landing Page Design */

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

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-dark: #3730a3;  /* WCAG AA compliant for white text (6.06:1) */
    --primary-light: rgba(99, 102, 241, 0.1);
    --primary-glow: rgba(99, 102, 241, 0.4);
    --secondary: #64748b;
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #ffffff;
    --bg-alt: #f8fafc;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #64748b;  /* Improved contrast for WCAG AA (4.54:1 on bg-alt) */
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

html {
    scroll-behavior: smooth;
}

/* Skip link for accessibility - visible on focus */
.skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-dark);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    z-index: 9999;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 10px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-alt);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation - Same as landing page */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 1.25rem;
}

.logo-icon {
    width: 36px;
    height: 36px;
    color: var(--primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--text);
}

/* Main App Area */
.app-main {
    flex: 1;
    padding: 100px 24px 40px;
}

.app-container {
    max-width: 640px;
    margin: 0 auto;
}

/* App Header */
.app-header {
    text-align: center;
    margin-bottom: 32px;
}

.app-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

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

/* Upload Section */
.upload-section {
    margin-bottom: 24px;
}

.upload-area {
    background: var(--bg);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-icon {
    color: var(--primary);
    margin-bottom: 16px;
}

.upload-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

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

.supported-formats {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.format-badge {
    background: var(--bg-alt);
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* File Card */
.file-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.file-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.file-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.file-details {
    flex: 1;
}

.file-name {
    display: block;
    font-weight: 600;
    color: var(--text);
    font-size: 0.95rem;
    margin-bottom: 2px;
    word-break: break-all;
}

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

.btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-remove {
    color: var(--text-muted);
}

.btn-remove:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Settings Card */
.settings-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
}

/* Primary Setting */
.primary-setting {
    margin-bottom: 20px;
}

.primary-setting label {
    display: block;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 10px;
}

.duration-input-group {
    display: flex;
    gap: 12px;
}

.duration-input {
    flex: 1;
    padding: 14px 16px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    text-align: center;
    transition: border-color 0.2s;
    /* Hide spinner buttons */
    -moz-appearance: textfield;
}

.duration-input::-webkit-outer-spin-button,
.duration-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.duration-input:focus {
    outline: none;
    border-color: var(--primary);
}

.duration-select {
    padding: 14px 16px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    cursor: pointer;
    min-width: 120px;
}

.duration-select:focus {
    outline: none;
    border-color: var(--primary);
}

.setting-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 12px;
    text-align: center;
}

/* Split Buttons */
.split-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.btn-split {
    flex: 1;
    padding: 16px 20px;
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-quick {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #7c3aed 100%);
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-smart {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    box-shadow: 0 4px 14px rgba(100, 116, 139, 0.3);
}

.split-hint {
    font-size: 0.8rem;
    color: var(--text-light);
    text-align: center;
    line-height: 1.5;
}

.split-hint strong {
    color: var(--text-muted);
}

.btn-split:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-split:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-text,
.btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-text[hidden],
.btn-loading[hidden] {
    display: none !important;
}

.spinner {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

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

/* Progress Card */
.progress-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.progress-header .card-title {
    margin-bottom: 0;
}

.progress-percent {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary) 0%, #8b5cf6 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

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

/* Results Card */
.results-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 8px;
}

.results-header .card-title {
    margin-bottom: 0;
}

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

/* Chunks List */
.chunks-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.chunk-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-alt);
    border-radius: var(--radius);
    transition: all 0.2s;
}

.chunk-item:hover {
    background: var(--primary-light);
}

.chunk-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.chunk-name {
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chunk-details {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.chunk-actions {
    display: flex;
    gap: 4px;
    margin-left: 12px;
}

.btn-play,
.btn-download {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

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

.btn-play:hover {
    background: var(--primary-dark);
    color: white;
    border-color: var(--primary-dark);
}

.btn-download {
    background: var(--success);
    color: white;
}

.btn-download:hover {
    transform: scale(1.05);
}

/* Results Actions */
.results-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-download-all {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    background: var(--primary-dark);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-download-all:hover {
    background: #312e81;
}

.btn-reset {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-reset:hover {
    background: var(--bg-alt);
    color: var(--text);
}

/* Footer */
.app-footer {
    padding: 32px 24px;
    text-align: center;
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
}

.privacy-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #047857;  /* Darker green for WCAG AA contrast (4.87:1 on bg-alt) */
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 16px;
}

.privacy-badge svg {
    flex-shrink: 0;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 24px;
    margin-bottom: 16px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-copyright {
    font-size: 0.8rem;
    color: var(--text-light);
    margin: 0;
}

/* Responsive */
@media (max-width: 640px) {
    .nav-links a:not(:last-child) {
        display: none;
    }

    .app-main {
        padding: 88px 16px 24px;
    }

    .app-header h1 {
        font-size: 1.5rem;
    }

    .upload-area {
        padding: 32px 20px;
    }

    .settings-card,
    .progress-card,
    .results-card {
        padding: 20px;
    }

    .duration-input-group {
        flex-direction: column;
    }

    .duration-input,
    .duration-select {
        width: 100%;
    }

    .chunk-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .chunk-actions {
        width: 100%;
        margin-left: 0;
    }

    .chunk-actions button {
        flex: 1;
    }

    .results-actions {
        flex-direction: column;
    }

    .btn-download-all,
    .btn-reset {
        width: 100%;
    }
}

/* Scrollbar styling */
.chunks-list::-webkit-scrollbar {
    width: 6px;
}

.chunks-list::-webkit-scrollbar-track {
    background: var(--bg-alt);
    border-radius: 3px;
}

.chunks-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.chunks-list::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}
