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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #475569;
    --radius: 8px;
}

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

.hidden {
    display: none !important;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

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

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

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

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

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

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--text-muted);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* Auth View */
.auth-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 40px;
    background: var(--bg-card);
    border-radius: 12px;
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo h1 {
    font-size: 28px;
    color: var(--primary);
}

.logo p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 8px;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.2s;
}

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

.auth-form .btn {
    width: 100%;
    margin-top: 10px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-left h1 {
    font-size: 20px;
    color: var(--primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

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

/* Main Content */
.main-content {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.toolbar h2 {
    font-size: 24px;
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.project-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border);
}

.project-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.project-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.project-card .project-code {
    font-size: 12px;
    color: var(--text-muted);
    font-family: monospace;
}

.project-card .project-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Status Badge */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-draft { background: var(--secondary); }
.status-processing { background: var(--warning); color: black; }
.status-ready { background: var(--success); color: black; }
.status-exported { background: var(--primary); }

/* Tabs */
.project-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
}

.project-tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.project-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    padding: 20px 0;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
    margin-bottom: 16px;
}

.upload-area:hover {
    border-color: var(--primary);
}

.upload-area p {
    margin-bottom: 8px;
}

.upload-area small {
    color: var(--text-muted);
}

.upload-link {
    color: var(--primary);
    cursor: pointer;
}

/* Guion Preview */
.guion-preview {
    margin-top: 24px;
}

.metadata-box {
    background: var(--bg-input);
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.metadata-box p {
    margin: 4px 0;
    font-size: 14px;
}

.metadata-box strong {
    color: var(--primary);
}

.guion-text {
    background: var(--bg-input);
    padding: 20px;
    border-radius: var(--radius);
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.6;
    max-height: 400px;
    overflow-y: auto;
}

/* Assets */
.assets-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.asset-category h3 {
    margin-bottom: 16px;
}

.asset-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.asset-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--radius);
}

.asset-item .asset-name {
    font-size: 14px;
}

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

/* Scenes */
.scenes-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.scene-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

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

.scene-number {
    font-weight: 600;
    color: var(--primary);
}

.scene-type {
    font-size: 12px;
    padding: 4px 8px;
    background: var(--bg-input);
    border-radius: 4px;
}

.scene-text {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

.scene-meta {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Export */
.export-section {
    max-width: 800px;
}

.export-section h3 {
    margin-bottom: 16px;
}

#config-preview {
    margin-top: 24px;
}

#config-preview h4 {
    margin-bottom: 12px;
}

#config-json {
    background: var(--bg-input);
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 12px;
    max-height: 400px;
    overflow-y: auto;
}

#config-preview .btn {
    margin-right: 8px;
    margin-top: 16px;
}

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

.modal-content {
    background: var(--bg-card);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    padding: 24px;
}

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

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Toast */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius);
    margin-top: 8px;
    animation: slideIn 0.3s ease;
    min-width: 280px;
}

.toast-success {
    background: var(--success);
    color: black;
}

.toast-error {
    background: var(--danger);
    color: white;
}

.toast-info {
    background: var(--primary);
    color: white;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px;
    color: var(--text-muted);
}

/* Loading */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--bg-input);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
    .assets-section {
        grid-template-columns: 1fr;
    }

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

    .header {
        flex-direction: column;
        gap: 12px;
    }

    .toolbar {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
}
