/* CSS Variables for theming */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a24;
    --bg-hover: #252532;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --accent-primary: #6366f1;
    --accent-secondary: #818cf8;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --border-color: #2a2a3a;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 50%;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
}

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

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

/* App Container */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Two Column Layout */
.two-column-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.left-column,
.right-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.right-column .card,
.right-column .btn-large {
    margin-bottom: 0;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 32px;
    padding: 24px 0;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Video Preview */
.video-preview-container {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 9/16;
    max-height: 400px;
    margin: 0 auto;
    background: #000;
}

.video-preview-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    display: flex;
    justify-content: center;
}

.btn-upload {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-upload:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Form Elements */
.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

input[type="text"],
input[type="url"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    resize: none;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Entry/Line Card */
.entry-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
    position: relative;
}

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

.entry-number {
    font-weight: 600;
    color: var(--accent-secondary);
}

.entry-content {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.voice-selector {
    flex-shrink: 0;
}

.voice-btn {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    border: 3px solid var(--accent-primary);
    background: var(--bg-card);
    cursor: pointer;
    overflow: hidden;
    padding: 0;
    transition: all 0.2s;
}

.voice-btn:hover {
    transform: scale(1.1);
    border-color: var(--accent-secondary);
}

.voice-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.text-input-wrapper {
    flex: 1;
}

.text-input-wrapper textarea {
    min-height: 56px;
}

.remove-entry-btn {
    background: transparent;
    border: none;
    color: var(--error);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    transition: background 0.2s;
}

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

/* Options Grid */
.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.toggle-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-option:hover {
    background: var(--bg-hover);
}

.toggle-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent-primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

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

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-large {
    width: 100%;
    padding: 16px 32px;
    font-size: 1.125rem;
}

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

/* Spinner */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Status Card */
.status-card {
    border-color: var(--accent-primary);
}

#statusContent {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 16px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.875rem;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Result Card */
.result-card {
    border-color: var(--success);
}

.result-content video {
    width: 100%;
    max-height: 400px;
    border-radius: var(--radius-md);
    background: black;
    margin-bottom: 16px;
}

.result-actions {
    display: flex;
    gap: 12px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.voice-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 24px;
    overflow-y: auto;
}

.voice-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 12px;
    border-radius: var(--radius-md);
    transition: background 0.2s;
}

.voice-option:hover {
    background: var(--bg-hover);
}

.voice-option.selected {
    background: var(--accent-primary);
}

.voice-option-img {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.voice-option.selected .voice-option-img {
    border-color: white;
}

.voice-option-name {
    font-size: 0.75rem;
    text-align: center;
    color: var(--text-secondary);
}

.voice-option.selected .voice-option-name {
    color: white;
}

/* Footer */
.footer {
    margin-top: auto;
    padding: 24px 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 900px) {
    .two-column-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .app-container {
        padding: 16px;
    }

    .header h1 {
        font-size: 1.75rem;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .voice-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .result-actions {
        flex-direction: column;
    }
}/* Custom Image Upload */
.custom-image-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    margin-top: -12px;
    /* Pull up to overlap slightly or sit tight */
    margin-bottom: 4px;
}

.btn-icon-upload {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    z-index: 10;
}

.btn-icon-upload:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: scale(1.1);
}

.entry-img-preview {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--accent-primary);
    background: #000;
}

.entry-img-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-preview-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    line-height: 1;
}

.remove-preview-btn:hover {
    background: var(--error);
}

/* Adjust voice selector to accommodate extra button */
.voice-selector {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}