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

:root {
    --bg: #0f0f0f;
    --surface: #1a1a1a;
    --surface-hover: #242424;
    --border: #2a2a2a;
    --text: #e8e8e8;
    --text-muted: #888;
    --accent: #f59e0b;
    --accent-hover: #d97706;
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
    --radius: 12px;
}

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

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* === Header === */
header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.logo {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}
.logo:hover {
    text-decoration: none;
    color: var(--accent);
}

/* === Main === */
main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* === Upload Section === */
.upload-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.drop-zone {
    width: 100%;
    max-width: 600px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--surface);
}
.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent);
    background: var(--surface-hover);
}

.drop-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.drop-zone p {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

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

/* === Progress === */
.progress-container {
    width: 100%;
    max-width: 600px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin: 0.75rem 0;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.3s;
    width: 0%;
}

#upload-filename {
    font-weight: 500;
}

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

/* === Processing === */
.processing-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--surface);
    border-radius: var(--radius);
    max-width: 600px;
    width: 100%;
}

.processing-container[hidden] {
    display: none;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

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

/* === Recent Videos === */
.recent-section {
    margin-top: 3rem;
}

.recent-section h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

.video-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.video-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-radius: 8px;
    color: var(--text);
    transition: background 0.2s;
}
.video-card:hover {
    background: var(--surface-hover);
    text-decoration: none;
}

.video-card-status {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    flex-shrink: 0;
}
.status-processing { background: #1e3a5f; color: #60a5fa; }
.status-ready { background: #14532d; color: #4ade80; }
.status-published { background: #422006; color: #fbbf24; }
.status-error { background: #450a0a; color: #f87171; }
.status-youtube_published,
.status-facebook_published,
.status-partial { background: #422006; color: #fbbf24; }

.video-card-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-card-date {
    color: var(--text-muted);
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* === Review Section === */
.review-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.review-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .review-grid {
        grid-template-columns: 1fr;
    }
}

.video-preview video {
    width: 100%;
    border-radius: var(--radius);
    background: #000;
}

/* === Form === */
.edit-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-field {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 0.6rem 0.8rem;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
}
.input-field:focus {
    outline: none;
    border-color: var(--accent);
}

.textarea-large {
    min-height: 160px;
    resize: vertical;
}

.textarea-small {
    min-height: 60px;
    resize: vertical;
}

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

/* === Capture Frame Button === */
.capture-frame-btn {
    margin-top: 0.5rem;
    width: 100%;
}

/* === Regenerate Section === */
.regenerate-section {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.regenerate-section[hidden] {
    display: none;
}

.regenerate-section .input-field {
    flex: 1;
}

.regenerate-section .btn {
    flex-shrink: 0;
}

.btn-group-top {
    display: flex;
    gap: 0.5rem;
}

.btn-group-top .btn {
    flex: 1;
}

/* === Buttons === */
.form-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.btn {
    padding: 0.65rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent);
    color: #000;
}
.btn-primary:hover {
    background: var(--accent-hover);
}

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

.btn-outline {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-outline:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

.btn-group-secondary {
    display: flex;
    gap: 0.5rem;
}
.btn-group-secondary .btn {
    flex: 1;
}

/* === Publish Status === */
.publish-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-radius: 8px;
}

.publish-status[hidden] {
    display: none;
}

.publish-results {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: 8px;
}

.publish-results[hidden] {
    display: none;
}

.result-label {
    font-weight: 500;
    margin-right: 0.5rem;
}

.result-link {
    word-break: break-all;
}

.error-text {
    color: var(--error);
    font-size: 0.9rem;
}

/* === Transcript === */
.transcript-section {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.transcript-section summary {
    padding: 1rem 1.25rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
}
.transcript-section summary:hover {
    color: var(--text);
}

.transcript-content {
    padding: 0 1.25rem 1.25rem;
    line-height: 1.7;
    color: var(--text-muted);
    white-space: pre-wrap;
}

/* === Thumbnail Preview === */
.thumbnail-preview {
    margin-top: 0.5rem;
}

.thumbnail-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* === Toast === */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
}

.toast {
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    animation: slideIn 0.3s ease;
    max-width: 350px;
}

.toast-success { background: #14532d; color: #4ade80; }
.toast-error { background: #450a0a; color: #f87171; }
.toast-warning { background: #422006; color: #fbbf24; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
