/* --- Core Design System & Variables --- */
:root {
    --bg-color: #0b0c16;
    --card-bg: rgba(18, 20, 38, 0.5);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-border-hover: rgba(139, 92, 246, 0.4);
    
    --primary: #8b5cf6; /* Violet */
    --primary-glow: rgba(139, 92, 246, 0.3);
    --secondary: #06b6d4; /* Cyan */
    --secondary-glow: rgba(6, 182, 212, 0.3);
    --accent: #ec4899; /* Pink */
    
    --success: #10b981; /* Emerald */
    --success-glow: rgba(16, 185, 129, 0.2);
    --warning: #f59e0b; /* Amber */
    --warning-glow: rgba(245, 158, 11, 0.15);
    --danger: #ef4444; /* Red */
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dark: #64748b;
    
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Neon Glow Backgrounds */
.glow-bg {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary-glow) 0%, rgba(11, 12, 22, 0) 70%);
    top: -200px;
    right: -200px;
    z-index: -1;
    pointer-events: none;
    animation: pulseGlow 15s infinite alternate;
}

@keyframes pulseGlow {
    0% { transform: scale(1) translate(0, 0); opacity: 0.8; }
    100% { transform: scale(1.2) translate(-50px, 50px); opacity: 0.5; }
}

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

/* --- Header --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.logo-icon svg {
    width: 22px;
    height: 22px;
    color: white;
}

.logo-area h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-area h1 span {
    color: var(--secondary);
}

.subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.privacy-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 99px;
    font-size: 13px;
    color: var(--secondary);
    backdrop-filter: blur(10px);
}

.privacy-badge svg {
    width: 14px;
    height: 14px;
}

/* --- Premium Glassmorphism Panels --- */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 28px;
    transition: border-color var(--transition-normal);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 24px;
    flex-grow: 1;
    align-items: start;
}

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

/* --- Left Workspace Panel --- */
.workspace-panel {
    min-height: 520px;
    display: flex;
    flex-direction: column;
}

/* Drag & Drop Area */
.dropzone-area {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-normal);
}

.dropzone-area:hover, .dropzone-area.drag-over {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.03);
    box-shadow: inset 0 0 20px rgba(139, 92, 246, 0.05);
}

.file-hidden-input {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.dropzone-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    pointer-events: none;
}

.dropzone-illustration {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.animated-circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, var(--primary-glow) 0%, rgba(139, 92, 246, 0) 70%);
    animation: pulse 2.5s infinite ease-in-out;
}

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

.cloud-icon {
    width: 36px;
    height: 36px;
    color: var(--primary);
    position: relative;
    z-index: 1;
    transition: transform var(--transition-normal);
}

.dropzone-area:hover .cloud-icon, .dropzone-area.drag-over .cloud-icon {
    transform: translateY(-4px);
    color: var(--secondary);
}

.dropzone-content h3 {
    font-size: 18px;
    font-weight: 600;
}

.dropzone-sub {
    font-size: 14px;
    color: var(--text-muted);
}

.browse-btn {
    color: var(--secondary);
    font-weight: 500;
    text-decoration: underline;
}

.format-support-text {
    font-size: 12px;
    color: var(--text-dark);
}

/* Queue List Area */
.queue-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex-grow: 1;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.queue-header h2 {
    font-size: 18px;
    font-weight: 600;
}

/* File Grid */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 16px;
    max-height: 480px;
    overflow-y: auto;
    padding-right: 8px;
}

/* Scrollbar styling for file grid */
.file-grid::-webkit-scrollbar {
    width: 6px;
}
.file-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 99px;
}
.file-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 99px;
}
.file-grid::-webkit-scrollbar-thumb:hover {
    background: var(--primary-glow);
}

/* File Card */
.file-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all var(--transition-fast);
}

.file-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.file-thumbnail-wrapper {
    aspect-ratio: 4/3;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.file-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-delete-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(15, 16, 28, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.file-delete-btn:hover {
    background: var(--danger);
    color: white;
    transform: scale(1.1);
}

.file-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.file-meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}

.file-badge-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.status-badge {
    padding: 3px 8px;
    border-radius: 99px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.ready {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

.status-badge.processing {
    background: rgba(6, 182, 212, 0.15);
    color: var(--secondary);
    animation: blink 1.5s infinite;
}

@keyframes blink {
    50% { opacity: 0.6; }
}

.status-badge.done {
    background: var(--success-glow);
    color: var(--success);
}

.file-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.file-card-btn {
    flex-grow: 1;
    padding: 6px 0;
    font-size: 11px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all var(--transition-fast);
}

.file-card-btn.download-single {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.file-card-btn.download-single:hover {
    background: var(--success);
    color: white;
}

/* --- Right Control Panel --- */
.control-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.control-panel h2 {
    font-size: 18px;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 12px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
}

/* Segmented Buttons */
.segmented-control {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 4px;
}

.segment-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: 7px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all var(--transition-fast);
}

.segment-btn svg {
    color: var(--text-dark);
}

.segment-btn:hover {
    color: var(--text-main);
}

.segment-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, rgba(139, 92, 246, 0.5) 100%);
    color: white;
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.2);
}

.segment-btn.active svg {
    color: white;
}

/* Sections for configuration */
.settings-section {
    transition: all var(--transition-normal);
}

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

/* Headers for Sliders */
.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 500;
}

.value-display {
    font-size: 14px;
    font-weight: 700;
    color: var(--secondary);
}

/* Custom Sliders */
.slider-container {
    padding: 8px 0;
}

.custom-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.08);
    outline: none;
    cursor: pointer;
}

.custom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--secondary);
    border: 3px solid var(--bg-color);
    box-shadow: 0 0 10px var(--secondary-glow);
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.custom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Text Inputs Wrapper */
.text-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.form-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 12px;
    color: white;
    font-family: var(--font-sans);
    font-size: 14px;
    outline: none;
    transition: all var(--transition-fast);
}

.form-input:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
    background: rgba(255, 255, 255, 0.05);
}

.text-input-wrapper .form-input {
    padding-right: 48px;
}

.input-suffix {
    position: absolute;
    right: 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    pointer-events: none;
}

.settings-hint {
    font-size: 11px;
    color: var(--text-dark);
    margin-top: 4px;
    line-height: 1.4;
}

/* Dimensions Inputs Row */
.dimension-inputs-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.half-width {
    flex: 1;
}

.aspect-lock-column {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 45px; /* match height of form inputs */
    padding-bottom: 2px;
}

.aspect-lock-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.aspect-lock-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
}

.aspect-lock-btn.active {
    color: var(--secondary);
    border-color: rgba(6, 182, 212, 0.3);
    background: rgba(6, 182, 212, 0.05);
}

.lock-icon {
    width: 16px;
    height: 16px;
}

/* Form Select Styling */
.select-wrapper {
    position: relative;
}

.select-wrapper::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-top-color: var(--text-muted);
    pointer-events: none;
}

.select-wrapper select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    padding-right: 40px;
}

/* Warning alert box */
.alert-box {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 12.5px;
    line-height: 1.4;
}

.alert-warning {
    background: var(--warning-glow);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fcd34d;
}

.alert-warning svg {
    flex-shrink: 0;
    color: var(--warning);
}

/* --- Actions & Buttons --- */
.action-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: auto;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-sans);
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    border: none;
    outline: none;
    transition: all var(--transition-fast);
}

.btn-sm {
    padding: 8px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 20px;
    font-size: 15px;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Primary Button (Squeeze) */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary) 50%, var(--secondary) 100%);
    background-size: 200% auto;
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    background-position: right center;
    box-shadow: 0 6px 20px var(--primary-glow);
    transform: translateY(-1px);
}

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

/* Danger outline button */
.btn-danger-outline {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.btn-danger-outline:hover {
    background: var(--danger);
    color: white;
}

/* Success Button (ZIP Download) */
.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 15px var(--success-glow);
}

.btn-success:hover {
    box-shadow: 0 6px 20px var(--success-glow);
    transform: translateY(-1px);
}

/* Spinner */
.loading-spinner {
    animation: rotate 1.2s infinite linear;
}

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

/* --- Progress Bar --- */
.progress-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.progress-details {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 500;
}

#progressText {
    color: var(--text-muted);
}

#progressPercentage {
    color: var(--secondary);
    font-weight: 700;
}

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

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 99px;
    box-shadow: 0 0 10px var(--secondary-glow);
    transition: width var(--transition-fast) ease-out;
}

/* Batch download section */
.batch-download-area {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
}

/* --- Utility Helper Classes --- */
.hidden {
    display: none !important;
}

/* --- Footer --- */
.app-footer {
    text-align: center;
    padding: 16px 0;
    font-size: 12px;
    color: var(--text-dark);
}
