:root {
    /* Base Scaling for A11y */
    --base-font: 16px;
    
    /* Dark Theme (Default) - High Contrast */
    --bg-main: #0a0a0a;
    --bg-surface: #1a1a1a;
    --bg-surface-hover: #262626;
    --text-main: #ffffff;
    --text-muted: #a0a0a0;
    --accent: #00E5FF;
    --accent-hover: #00b3cc;
    --border: #333333;
    --input-bg: #000000;
}

html.theme-light {
    /* Light Theme - High Contrast */
    --bg-main: #f0f4f8;
    --bg-surface: #ffffff;
    --bg-surface-hover: #e8ecf1;
    --text-main: #000000;
    --text-muted: #4a4a4a;
    --accent: #0056D2;
    --accent-hover: #0041a0;
    --border: #cccccc;
    --input-bg: #ffffff;
}

* { 
    box-sizing: border-box; 
}

html { 
    font-size: var(--base-font); 
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: background-color 0.2s, color 0.2s;
}

/* --- Header / Navigation --- */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: var(--bg-surface);
    border-bottom: 2px solid var(--border);
    z-index: 10;
}

.logo { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    color: var(--accent); 
}

.logo h1 { 
    margin: 0; 
    font-size: 1.5rem; 
    font-weight: 700; 
    color: var(--text-main); 
}

.a11y-controls { 
    display: flex; 
    gap: 1.5rem; 
    align-items: center; 
}

.font-scaler {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1.1rem;
}

button {
    background: var(--bg-surface);
    color: var(--text-main);
    border: 2px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s;
}

button:hover, button:focus { 
    background: var(--bg-surface-hover); 
    border-color: var(--accent); 
    outline: none;
}

button.btn-primary { 
    background: var(--accent); 
    color: #000; 
    border: none; 
}

html.theme-light button.btn-primary { 
    color: #fff; 
}

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

/* --- Main Layout --- */
.app-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.builder-panel {
    width: 50%;
    padding: 2rem;
    overflow-y: auto;
    border-right: 2px solid var(--border);
}

.builder-panel h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

.editor-panel {
    width: 50%;
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
}

.editor-header {
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border);
    background: var(--bg-surface);
}

.editor-header h2 { 
    margin: 0; 
    font-size: 1.25rem; 
}

#json-editor { 
    flex: 1; 
    width: 100%; 
    font-size: 1.1rem; 
}

/* --- Grid & Cards --- */
.component-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); 
    gap: 1.5rem; 
    margin-bottom: 3rem; 
}

.card {
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

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

.card-title { 
    font-weight: 600; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    font-size: 1.15rem; 
}

.card-icon { 
    color: var(--accent); 
    width: 20px;
}

.stepper { 
    display: flex; 
    align-items: center; 
    background: var(--input-bg); 
    border: 2px solid var(--border); 
    border-radius: 6px; 
    overflow: hidden; 
}

.stepper button { 
    border: none; 
    background: transparent; 
    padding: 0.5rem 1rem; 
    border-radius: 0; 
}

.stepper button:hover { 
    background: var(--bg-surface-hover); 
    color: var(--accent); 
}

.stepper input { 
    width: 50px; 
    text-align: center; 
    border: none; 
    background: transparent; 
    color: var(--text-main); 
    font-weight: bold; 
    font-size: 1.1rem; 
    outline: none;
}

/* --- Settings Drawer --- */
.settings-drawer {
    display: none;
    flex-direction: column;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 2px dashed var(--border);
    margin-top: 0.5rem;
}

.settings-drawer.active { 
    display: flex; 
}

.toggle-row { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    cursor: pointer; 
    font-weight: 600;
}

.toggle-row input[type="checkbox"] { 
    width: 22px; 
    height: 22px; 
    accent-color: var(--accent); 
    cursor: pointer;
}

.settings-drawer label.sub-label { 
    font-size: 0.95rem; 
    font-weight: 500; 
    color: var(--text-muted);
}

.settings-drawer input[type="text"] {
    width: 100%; 
    padding: 0.85rem; 
    border-radius: 6px; 
    border: 2px solid var(--border);
    background: var(--input-bg); 
    color: var(--text-main); 
    font-family: 'Roboto Mono', monospace;
    font-size: 1rem;
}

.settings-drawer input[type="text"]:focus { 
    border-color: var(--accent); 
    outline: none; 
}

/* --- Editor Markers --- */
.start-indicator {
    position: absolute;
    background: rgba(0, 229, 255, 0.15);
    border-top: 2px dashed var(--accent);
    z-index: 20 !important;
}

.stop-indicator {
    position: absolute;
    background: rgba(255, 60, 60, 0.2);
    border-bottom: 3px solid #ff3c3c;
    z-index: 20 !important;
}

.component-stop-indicator {
    position: absolute;
    background: rgba(255, 150, 0, 0.15);
    border-bottom: 2px dashed #ff9900;
    z-index: 20 !important;
}

/* --- Schema Name Input --- */
.schema-name-input {
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    outline: none;
    width: 220px;
    transition: border-color 0.2s;
}
.schema-name-input:focus {
    border-color: var(--accent);
}


