:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --bg: #0f172a;
    --surface: #1e293b;
    --border: #334155;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --green: #22c55e;
    --yellow: #eab308;
    --red: #ef4444;
    --radius: 8px;
}

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

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

/* --- Viewer Layout --- */
#viewer-container {
    display: flex;
    height: 100vh;
}

#three-canvas {
    flex: 1;
    position: relative;
}

#three-canvas canvas {
    display: block;
}

#info-panel {
    width: 320px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#info-panel h1 {
    font-size: 1.25rem;
    color: var(--text);
}

#stand-info {
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    padding: 16px;
    display: none;
}

#stand-info.visible { display: block; }

#stand-info h3 { margin-bottom: 8px; color: var(--primary); }
#stand-info p { font-size: 0.875rem; color: var(--text-muted); margin: 4px 0; }

#legend {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-color.green { background: var(--green); }
.legend-color.yellow { background: var(--yellow); }
.legend-color.red { background: var(--red); }

#no-stands {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
    padding: 20px 0;
}

#stand-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stand-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    cursor: pointer;
    transition: border-color 0.2s;
    font-size: 0.8125rem;
}

.stand-card:hover { border-color: var(--primary); }
.stand-card.selected { border-color: var(--primary); background: rgba(37,99,235,0.1); }

.stand-card .number { font-weight: 600; }
.stand-card .details { color: var(--text-muted); font-size: 0.75rem; margin-top: 2px; }

/* --- Admin Layout --- */
.admin-layout {
    display: flex;
    height: 100vh;
}

.admin-sidebar {
    width: 340px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-sidebar h2 {
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.admin-main {
    flex: 1;
    position: relative;
}

/* --- Forms --- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 0.8125rem;
    font-family: inherit;
}

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

.form-row {
    display: flex;
    gap: 8px;
}

.form-row .form-group { flex: 1; }

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

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--green); color: white; }
.btn-danger { background: var(--red); color: white; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { background: var(--surface); }
.btn-sm { padding: 4px 10px; font-size: 0.75rem; }
.btn-block { width: 100%; }

/* --- Lists --- */
.list-section { margin-bottom: 12px; }

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 4px;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.list-item:hover { border-color: var(--primary); }
.list-item.active { border-color: var(--primary); background: rgba(37,99,235,0.1); }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.6875rem;
    font-weight: 500;
}

.badge-available { background: rgba(34,197,94,0.2); color: var(--green); }
.badge-reserved { background: rgba(234,179,8,0.2); color: var(--yellow); }
.badge-sold { background: rgba(239,68,68,0.2); color: var(--red); }
.badge-pending { background: rgba(234,179,8,0.2); color: var(--yellow); }
.badge-confirmed { background: rgba(34,197,94,0.2); color: var(--green); }
.badge-cancelled { background: rgba(239,68,68,0.2); color: var(--red); }

/* --- Toast --- */
#toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 20px;
    font-size: 0.8125rem;
    z-index: 9999;
    display: none;
    max-width: 360px;
}

#toast.show { display: block; }
#toast.success { border-color: var(--green); }
#toast.error { border-color: var(--red); }

/* --- Tabs --- */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.tab {
    padding: 8px 16px;
    font-size: 0.8125rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    transition: color 0.2s, border-color 0.2s;
}

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

/* --- Modal --- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 999;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 420px;
    width: 90%;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#placement-indicator {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--surface);
    border: 1px solid var(--yellow);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 0.8125rem;
    display: none;
    z-index: 10;
}

#placement-indicator.active { display: block; }
