:root {
    /* Color Palette */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --accent: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;

    /* Neutral Colors */
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --bg-card: rgba(26, 26, 46, 0.6);
    --bg-hover: rgba(99, 102, 241, 0.1);

    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    /* Border & Shadow */
    --border: rgba(99, 102, 241, 0.2);
    --border-hover: rgba(99, 102, 241, 0.4);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --glow: 0 0 20px rgba(99, 102, 241, 0.3);

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Container */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: var(--spacing-lg);
}

/* Header */
.header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    animation: fadeInDown 0.6s ease-out;
}

.logo-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.logo-icon {
    width: 48px;
    height: 48px;
    color: var(--primary);
    filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.5));
    animation: float 3s ease-in-out infinite;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.125rem;
    font-weight: 400;
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: var(--spacing-lg);
    animation: fadeIn 0.8s ease-out;
}

/* Controls Panel */
.controls-panel {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-lg);
    height: fit-content;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    overflow-x: hidden;
}

.controls-panel::-webkit-scrollbar {
    width: 8px;
}

.controls-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
}

.controls-panel::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: var(--radius-sm);
}

.controls-panel::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Control Sections */
.control-section {
    margin-bottom: var(--spacing-xl);
}

.control-section:last-child {
    margin-bottom: 0;
}

.section-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.section-title .icon {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(99, 102, 241, 0.05);
}

.upload-area:hover {
    border-color: var(--border-hover);
    background: rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
    box-shadow: var(--glow);
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--primary);
    margin-bottom: var(--spacing-md);
    animation: bounce 2s ease-in-out infinite;
}

.upload-text {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.upload-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* File Info */
.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    animation: slideInRight 0.3s ease-out;
}

.file-name {
    color: var(--success);
    font-weight: 500;
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.btn-remove {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    padding: var(--spacing-xs);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove svg {
    width: 16px;
    height: 16px;
    color: var(--error);
}

.btn-remove:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: scale(1.1);
}

/* Slider Control */
.slider-control {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: var(--radius-sm);
    background: rgba(99, 102, 241, 0.2);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.5);
    transition: var(--transition);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.7);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.5);
    transition: var(--transition);
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.7);
}

.slider-value {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.slider-value span:first-child {
    font-weight: 600;
    color: var(--primary);
    font-size: 1.125rem;
}

.unit {
    color: var(--text-muted);
}

/* Material Grid */
.material-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
}

.material-card {
    background: rgba(99, 102, 241, 0.05);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.material-card:hover {
    border-color: var(--border-hover);
    background: rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.material-card.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
    box-shadow: var(--glow);
}

.material-preview {
    width: 100%;
    height: 60px;
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-sm);
}

.material-name {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.material-card.active .material-name {
    color: var(--primary);
    font-weight: 600;
}

/* Material Select */
.material-select {
    width: 100%;
    background: rgba(99, 102, 241, 0.05);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}

.material-select:hover {
    border-color: var(--border-hover);
    background: rgba(99, 102, 241, 0.1);
}

.material-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--glow);
}

.material-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: var(--spacing-sm);
}

/* HDRI Select */
.hdri-select {
    width: 100%;
    background: rgba(99, 102, 241, 0.05);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
    margin-bottom: var(--spacing-sm);
}

.hdri-select:hover {
    border-color: var(--border-hover);
    background: rgba(99, 102, 241, 0.1);
}

.hdri-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--glow);
}

.hdri-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: var(--spacing-sm);
}

/* HDRI Toggle */
.hdri-toggle {
    margin-top: var(--spacing-md);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    user-select: none;
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    transition: var(--transition);
    border: 1px solid var(--border);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-muted);
    top: 2px;
    left: 2px;
    transition: var(--transition);
}

.toggle-label input[type="checkbox"]:checked+.toggle-slider {
    background: var(--primary);
    border-color: var(--primary);
}

.toggle-label input[type="checkbox"]:checked+.toggle-slider::before {
    transform: translateX(20px);
    background: white;
}

.toggle-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Animation Select */
.animation-select {
    width: 100%;
    background: rgba(99, 102, 241, 0.05);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
    margin-bottom: var(--spacing-md);
}

.animation-select:hover {
    border-color: var(--border-hover);
    background: rgba(99, 102, 241, 0.1);
}

.animation-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--glow);
}

.animation-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: var(--spacing-sm);
}

/* Animation Timeline */
.animation-timeline {
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.timeline-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.timeline-time {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    font-family: 'Courier New', monospace;
}

.timeline-bar {
    position: relative;
    height: 40px;
    margin-bottom: var(--spacing-md);
}

.timeline-progress {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 6px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: var(--radius-sm);
    width: 0%;
    transition: width 0.1s linear;
    pointer-events: none;
    z-index: 1;
}

.timeline-slider {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 100%;
    height: 6px;
    border-radius: var(--radius-sm);
    background: rgba(99, 102, 241, 0.2);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--primary);
    transition: var(--transition);
    position: relative;
    z-index: 2;
}

.timeline-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.5);
}

.timeline-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: 2px solid var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: var(--transition);
}

.timeline-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.5);
}

.animation-buttons {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
}

.btn-animation {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--spacing-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.btn-animation svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.btn-animation:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.btn-animation:active {
    transform: translateY(0);
}

.btn-animation svg {
    transition: var(--transition);
}

.btn-animation:hover svg {
    color: var(--primary);
}

/* Buttons */
.btn-export {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: var(--radius-md);
    padding: var(--spacing-md) var(--spacing-lg);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    box-shadow: var(--shadow);
    margin-bottom: var(--spacing-sm);
}

.btn-export:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--glow);
}

.btn-export:active:not(:disabled) {
    transform: translateY(0);
}

.btn-export:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-export .icon {
    width: 20px;
    height: 20px;
}

.btn-export-secondary {
    background: linear-gradient(135deg, var(--accent), var(--secondary));
}

.btn-export-secondary:last-child {
    margin-bottom: 0;
}

/* Preview Panel */
.preview-panel {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    min-height: 700px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.preview-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.preview-controls {
    display: flex;
    gap: var(--spacing-sm);
}

.btn-icon {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--spacing-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.btn-icon:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--border-hover);
}

.btn-icon.active {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary);
}

.btn-icon.active svg {
    color: var(--primary);
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    min-height: 500px;
}

.placeholder-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-muted);
}

.placeholder-icon {
    width: 80px;
    height: 80px;
    color: var(--border);
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.placeholder-content p {
    font-size: 1.125rem;
    margin-bottom: var(--spacing-xs);
}

.placeholder-hint {
    font-size: 0.875rem;
    opacity: 0.7;
}

.preview-footer {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border);
}

.hint {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.875rem;
    color: var(--text-muted);
}

.icon-small {
    width: 16px;
    height: 16px;
    color: var(--primary);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 15, 35, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--spacing-md);
}

#loadingText {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--spacing-md) var(--spacing-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    min-width: 300px;
    animation: slideInRight 0.3s ease-out;
}

.toast.success {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.toast.error {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.toast.warning {
    border-color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .controls-panel {
        max-height: none;
    }

    h1 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: var(--spacing-md);
    }

    h1 {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .material-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .toast-container {
        left: var(--spacing-md);
        right: var(--spacing-md);
    }

    .toast {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .logo-header {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    h1 {
        font-size: 1.5rem;
    }

    .material-grid {
        grid-template-columns: 1fr;
    }
}