:root {
    --bg-dark: #0f1016;
    --bg-card: rgba(22, 24, 35, 0.7);
    --bg-card-highlight: rgba(36, 32, 56, 0.6);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(138, 92, 246, 0.4);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --accent: #8b5cf6;
    --accent-hover: #7c3aed;
    --accent-glow: rgba(139, 92, 246, 0.35);
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --danger: #ef4444;
    --danger-hover: #dc2626;
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.7), 0 1px 1px rgba(255, 255, 255, 0.05) inset;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow-x: hidden;
    background-image: 
        radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.08) 0px, transparent 50%);
}

.app-container {
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    flex-grow: 1;
}

/* Header styling */
.app-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.logo svg {
    color: var(--accent);
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.logo span span {
    color: var(--accent);
}

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

/* Workspace Layout */
.app-workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
    flex-grow: 1;
}

@media (max-width: 968px) {
    .app-workspace {
        grid-template-columns: 1fr;
    }
}

/* Left Side: Preview Area */
.preview-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: sticky;
    top: 24px;
}

.preview-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    width: 100%;
    max-width: 580px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(16px);
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: 520px;
    background-color: #000;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: aspect-ratio 0.3s ease;
}

#outputCanvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Drag & Drop Upload Zone */
.upload-dropzone {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    background-color: rgba(15, 16, 22, 0.85);
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    z-index: 10;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
    border-color: var(--accent);
    background-color: rgba(139, 92, 246, 0.06);
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.1) inset;
}

.upload-icon {
    margin-bottom: 20px;
    color: var(--text-secondary);
    transition: transform 0.3s ease, color 0.3s ease;
}

.upload-dropzone:hover .upload-icon {
    color: var(--accent);
    transform: translateY(-5px);
}

.upload-dropzone h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.upload-dropzone p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.file-limits {
    color: var(--text-muted);
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Player Timeline / Controls */
.player-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 4px 0;
}

.control-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.4);
    transform: scale(1.05);
}

.timeline-container {
    display: flex;
    align-items: center;
    flex-grow: 1;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.timeline-container input[type="range"] {
    flex-grow: 1;
    cursor: pointer;
}

/* Right Side: Controls Area */
.controls-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.info-card {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.info-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.info-text h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: #93c5fd;
}

.info-text p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.editor-panels {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Control Card Container */
.control-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.highlight-card {
    background-color: var(--bg-card-highlight);
    border-color: rgba(139, 92, 246, 0.2);
    position: relative;
    overflow: hidden;
}

.highlight-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), #3b82f6);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 12px;
}

.card-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* File info styling */
.file-details {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.2);
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.file-icon {
    color: var(--accent);
    background: rgba(139, 92, 246, 0.1);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-info-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.file-name {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

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

/* Badge Pill in Card Header */
.format-badge-pill {
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid var(--accent);
    color: #c4b5fd;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    font-family: monospace;
}

/* Format selector grid */
.format-selector-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.format-card-option {
    background: rgba(15, 16, 22, 0.6);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    color: var(--text-primary);
    outline: none;
    position: relative;
    box-sizing: border-box;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.format-card-option:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.format-card-option.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.22) 0%, rgba(59, 130, 246, 0.12) 100%);
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.35), inset 0 0 10px rgba(139, 92, 246, 0.1);
}

.format-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.format-ratio-preview {
    border: 2px solid var(--text-secondary);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.25s ease;
}

.square-ratio {
    width: 32px;
    height: 32px;
}

.portrait-ratio {
    width: 26px;
    height: 32.5px;
}

.format-ratio-preview span {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.format-card-option.active .format-ratio-preview {
    border-color: var(--accent);
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.format-card-option.active .format-ratio-preview span {
    color: #ffffff;
}

.format-check-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    transition: all 0.25s ease;
}

.format-card-option.active .format-check-circle {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    box-shadow: 0 0 8px var(--accent-glow);
}

.format-card-details {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.format-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.format-card-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.format-card-option.active .format-card-sub {
    color: #d1d5db;
}

/* Sliders and fields styling */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.badge {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: monospace;
    font-weight: bold;
}

.grid-controls-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Custom styled inputs range */
input[type="range"].styled-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    margin: 8px 0;
}

input[type="range"].styled-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
    transition: transform 0.1s ease, background-color 0.1s ease;
}

input[type="range"].styled-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--text-primary);
}

input[type="range"].styled-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
    transition: transform 0.1s ease, background-color 0.1s ease;
}

input[type="range"].styled-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    background: var(--text-primary);
}

/* Buttons and Actions styling */
.text-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
}

.text-btn:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.primary-btn, .secondary-btn, .download-btn {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.primary-btn {
    background: var(--accent);
    border: 1px solid var(--accent);
    color: white;
    width: 100%;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.primary-btn:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

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

.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    flex-grow: 1;
    font-size: 0.8rem;
    padding: 8px 12px;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.export-note {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Progress indicator styles */
.progress-container {
    background: rgba(0, 0, 0, 0.25);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.03);
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 500;
}

#progressStatus {
    color: var(--text-primary);
}

#progressPercentage {
    color: var(--accent);
    font-family: monospace;
    font-weight: bold;
}

.progress-bar-bg {
    background: rgba(255, 255, 255, 0.08);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    width: 100%;
}

.progress-bar-fill {
    background: linear-gradient(90deg, var(--accent), #3b82f6);
    height: 100%;
    width: 0%;
    border-radius: 4px;
    transition: width 0.1s linear;
}

.cancel-btn {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 0.8rem;
    font-family: var(--font-sans);
    align-self: center;
    transition: opacity 0.2s ease;
}

.cancel-btn:hover {
    text-decoration: underline;
    opacity: 0.8;
}

/* Success Download styling */
.download-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 10px;
}

.success-banner {
    display: flex;
    gap: 12px;
    background: var(--success-bg);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 12px 16px;
    border-radius: var(--radius-md);
}

.success-icon {
    color: var(--success);
    font-size: 1.2rem;
    font-weight: bold;
}

.success-banner h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--success);
    margin-bottom: 2px;
}

.success-banner p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.download-btn {
    background: var(--success);
    color: white;
    width: 100%;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

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

/* Footer styling */
.app-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    margin-top: auto;
}
