/* Reset e variáveis */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-sidebar: #f0f2f5;
    --bg-card: #ffffff;
    --bg-hover: #e8ecf1;
    --bg-active: #e3e8ef;
    --bg-panel: #f8f8fa;
    
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a5a;
    --text-muted: #7a7a8a;
    
    --border-color: #d1d5db;
    --border-hover: #b0b8c4;
    
    --accent: #6c5ce7;
    --accent-hover: #5a4bd1;
    --accent-light: #f0edff;
    
    --success: #10b981;
    --danger: #ef4444;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    
    --radius: 10px;
    --radius-sm: 6px;
    --transition: all 0.2s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    flex-shrink: 0;
    z-index: 100;
}
.sidebar h1 { font-size: 18px; margin-bottom: 16px; color: var(--accent); display: flex; align-items: center; gap: 8px; }
.sidebar .new-project { background: var(--accent); color: white; border: none; padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; font-weight: 600; width: 100%; margin-bottom: 16px; }
.project-list { flex: 1; overflow-y: auto; }
.project-item { padding: 10px 14px; margin-bottom: 4px; border-radius: var(--radius-sm); cursor: pointer; border: 1px solid transparent; }
.project-item:hover { background: var(--bg-hover); }
.project-item.active { background: var(--bg-active); border-color: var(--accent); }
.project-item .name { font-weight: 500; font-size: 13px; }
.project-item .meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.main-content { flex: 1; padding: 24px 32px; overflow-y: auto; height: 100vh; }

.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border-color); margin-bottom: 24px; }
.tab-btn { padding: 10px 20px; background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 14px; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.header h2 { font-size: 22px; font-weight: 600; }
.header .actions { display: flex; gap: 8px; }
.header .actions button { padding: 6px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-color); background: var(--bg-secondary); color: var(--text-secondary); cursor: pointer; font-size: 12px; font-weight: 500; }
.header .actions button.primary { background: var(--accent); border-color: var(--accent); color: white; }
.header .actions button.danger { border-color: var(--danger); color: var(--danger); }

.catalog-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.catalog-item { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 12px; cursor: pointer; position: relative; }
.catalog-item .preview { width: 100%; height: 140px; background: var(--bg-hover); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 40px; margin-bottom: 8px; overflow: hidden; position: relative; }
.catalog-item .preview img, .catalog-item .preview video { width: 100%; height: 100%; object-fit: cover; }
.catalog-item .name { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.catalog-item .marker { font-size: 11px; color: var(--accent); font-family: monospace; background: var(--accent-light); padding: 1px 8px; border-radius: 10px; display: inline-block; }

.catalog-item .tooltip-desc {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 10;
    pointer-events: none;
    margin-bottom: 6px;
}
.catalog-item:hover .tooltip-desc { display: block; }

.scene-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.scene-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); cursor: pointer; transition: var(--transition); }
.scene-card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-md); }
.scene-card .scene-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 8px; }
.scene-card .scene-number { font-size: 11px; color: var(--accent); font-weight: 600; background: var(--accent-light); padding: 2px 10px; border-radius: 10px; }
.scene-card .scene-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.scene-card .scene-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }

.scene-editor { display: none; padding: 20px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.scene-editor.active { display: block; }
.scene-editor .editor-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border-color); }
.scene-editor .editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.scene-editor .full-width { grid-column: 1 / -1; }
.scene-editor .half-width { grid-column: span 1; }
.scene-editor label { display: block; font-size: 12px; margin-bottom: 4px; color: var(--text-secondary); font-weight: 500; }
.scene-editor input, .scene-editor textarea, .scene-editor select { width: 100%; padding: 8px 12px; background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: var(--radius-sm); color: var(--text-primary); font-size: 13px; margin-bottom: 12px; font-family: inherit; }
.scene-editor textarea { resize: vertical; min-height: 60px; font-family: 'Courier New', monospace; }

.autocomplete-container { position: relative; }
.autocomplete-list { position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-sm); max-height: 200px; overflow-y: auto; z-index: 1001; display: none; box-shadow: var(--shadow-lg); }
.autocomplete-list.active { display: block; }
.autocomplete-item { padding: 8px 12px; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.autocomplete-item:hover { background: var(--bg-hover); }

.output-preview { background: var(--bg-panel); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 16px; max-height: 400px; overflow-y: auto; font-family: 'Courier New', monospace; font-size: 13px; white-space: pre-wrap; margin-top: 12px; }

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); z-index: 1000; justify-content: center; align-items: center; }
.modal-overlay.active { display: flex; }
.modal { background: var(--bg-secondary); border-radius: var(--radius); padding: 28px; max-width: 500px; width: 90%; border: 1px solid var(--border-color); }
.modal input, .modal textarea, .modal select { width: 100%; padding: 8px 12px; margin-bottom: 12px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.modal-actions button { padding: 8px 20px; border-radius: var(--radius-sm); border: none; cursor: pointer; font-size: 13px; }
.modal-actions .cancel { background: var(--bg-hover); color: var(--text-secondary); }
.modal-actions .confirm { background: var(--accent); color: white; }
.modal-actions .danger { background: var(--danger); color: white; }

.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 6px; }
.toast { padding: 10px 20px; border-radius: var(--radius-sm); background: var(--bg-secondary); border: 1px solid var(--border-color); box-shadow: var(--shadow-md); font-size: 13px; }
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--accent); }

.empty-state { text-align: center; padding: 80px 20px; }
.empty-state .icon { font-size: 64px; margin-bottom: 20px; }