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

:root {
    /* Lavender Light Mode Palette */
    --primary: #9b87f5;
    --primary-dark: #7c5fdb;
    --primary-light: #b8a7f7;
    --accent: #d4c5f9;

    --bg-main: #fafafa;
    --bg-sidebar: #ffffff;
    --bg-card: #f8f7fc;
    --bg-input: #ffffff;
    --bg-hover: #f3f1fb;

    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: #999999;

    --border: #e8e4f3;
    --border-focus: #9b87f5;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.1);

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;

    --transition: all 0.2s ease;
}

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

.container {
    display: grid;
    grid-template-columns: 420px 1fr;
    min-height: 100vh;
    gap: 0;
}

/* Sidebar Styles */
.sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.sidebar-header {
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    padding: 0.2rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.lang-toggle button {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.8125rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.lang-toggle button:hover,
.lang-toggle button:focus-visible {
    color: var(--text-primary);
    outline: none;
}

.lang-toggle button:focus-visible {
    box-shadow: 0 0 0 2px rgba(155, 135, 245, 0.3);
}

.lang-toggle button.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.lang-toggle .divider {
    color: var(--text-muted);
    font-weight: 400;
}

.lang-toggle-global {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(6px);
}

@media (max-width: 600px) {
    .lang-toggle-global {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-card);
    padding: 0.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.tab-btn {
    flex: 1;
    padding: 0.625rem 1rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

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

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.2s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Form Styles */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.625rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(155, 135, 245, 0.1);
}

.form-group select {
    cursor: pointer;
}

/* File Upload */
.file-upload {
    position: relative;
}

.file-upload input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

.file-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
    background: var(--bg-card);
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.file-upload:hover .file-upload-label {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.upload-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.image-preview {
    display: none;
    position: relative;
}

.image-preview.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: var(--bg-card);
    border: 2px solid var(--primary);
    border-radius: var(--radius-md);
    min-height: 200px;
}

.image-preview.active~.file-upload-label {
    display: none;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    width: auto;
    height: auto;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.remove-image-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--text-primary);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 10;
    box-shadow: var(--shadow-sm);
}

.remove-image-btn:hover {
    background: var(--text-secondary);
    transform: scale(1.1);
}

.remove-image-btn:active {
    transform: scale(0.95);
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-download {
    width: 100%;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

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

.btn-primary.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-primary.loading .btn-text {
    opacity: 0;
}

.btn-primary.loading .btn-loader {
    opacity: 1;
}

.btn-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    opacity: 0;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.btn-download {
    background: var(--text-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.btn-download:hover {
    background: var(--text-secondary);
    box-shadow: var(--shadow-md);
}

/* Video Canvas */
.video-canvas {
    display: flex;
    flex-direction: column;
    padding: 2rem;
    gap: 1.5rem;
    background: var(--bg-main);
}

.video-container {
    flex: 1;
    min-height: 400px;
    max-height: calc(100vh - 8rem);
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.placeholder.hidden {
    display: none;
}

.placeholder-content {
    text-align: center;
    padding: 3rem;
}

.placeholder-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.placeholder-content p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.video-player {
    display: none;
    max-width: 100%;
    max-height: calc(100vh - 10rem);
    width: auto;
    height: auto;
    object-fit: contain;
}

.video-player.active {
    display: block;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.loading-overlay.active {
    display: flex;
}

.loading-content {
    text-align: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1.5rem;
}

.loading-text {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.loading-subtext {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Video Controls */
.video-controls {
    display: none;
    gap: 1rem;
}

.video-controls.active {
    display: flex;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .sidebar {
        max-height: 50vh;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}

@media (max-width: 640px) {
    .sidebar {
        padding: 1.5rem 1rem;
    }

    .video-canvas {
        padding: 1.5rem 1rem;
    }

    .tab-btn {
        font-size: 0.8125rem;
        padding: 0.5rem 0.75rem;
    }

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