:root {
    --primary: #4e73df;
    --secondary: #858796;
    --success: #1cc88a;
    --dark: #f8f9fc;
    --darker: #f0f2f5;
    --light-text: #3a3b45;
    --card-bg: #ffffff;
    --sidebar-width: 250px;
    --glass: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--darker);
    color: var(--light-text);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: white;
    height: 100vh;
    position: fixed;
    padding: 20px;
    border-right: 1px solid var(--glass-border);
    box-shadow: 4px 0 10px rgba(0,0,0,0.02);
    overflow-y: auto;
}

/* Sidebar Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 5px;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
}
.sidebar:hover::-webkit-scrollbar-thumb {
    background-color: #94a3b8;
}

.sidebar h2 {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 30px;
    text-align: center;
    font-weight: 700;
    text-transform: uppercase;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    color: var(--light-text);
    text-decoration: none;
    border-radius: 10px;
    margin-bottom: 5px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    background: #f1f3f9;
    color: var(--primary);
}

.nav-link.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(78, 115, 223, 0.2);
}

button.nav-group-btn {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: 'Inter', sans-serif;
    color: var(--light-text);
}

button.nav-group-btn.active {
    color: white;
}

button.nav-group-btn:focus {
    outline: none;
}

.nav-link svg {
    margin-right: 10px;
    width: 20px;
    height: 20px;
}

svg.chevron {
    width: 16px;
    height: 16px;
    margin-right: 0;
    transition: transform 0.3s ease;
}

svg.chevron.open {
    transform: rotate(180deg);
}

.nav-group-content {
    padding-left: 20px;
    border-left: 2px solid #e5e7eb;
    margin-left: 12px;
    margin-top: 5px;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 40px;
    width: calc(100% - var(--sidebar-width));
}

.dashboard-header {
    margin-bottom: 30px;
}

.dashboard-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

/* Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.03);
    transition: all 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.08);
}

.card h3 {
    font-size: 0.85rem;
    color: var(--secondary);
    margin-bottom: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card .value {
    font-size: 2.2rem;
    font-weight: 700;
    color: #2e2f37;
}

/* Forms & Tables */
.glass-container {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.03);
}

input, select, textarea {
    width: 100%;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #d1d3e2;
    border-radius: 8px;
    color: #495057;
    margin-top: 5px;
    transition: border-color 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(78,115,223,0.1);
}

button.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 20px;
    transition: background 0.3s;
}

button.btn-primary:hover {
    filter: brightness(1.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th {
    text-align: left;
    padding: 15px;
    color: var(--secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    border-bottom: 2px solid #eaecf4;
}

td {
    padding: 15px;
    border-bottom: 1px solid #eaecf4;
    color: #5a5c69;
}

tr:hover td {
    background-color: #f8f9fc;
}
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-success { background: rgba(28, 200, 138, 0.2); color: #1cc88a; border: 1px solid #1cc88a; }
.alert-error { background: rgba(231, 74, 59, 0.2); color: #e74a3b; border: 1px solid #e74a3b; }

/* Badges */
.badge {
    display: inline-block;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background-color: rgba(78, 115, 223, 0.1);
    color: var(--primary);
    border: 1px solid rgba(78, 115, 223, 0.2);
}

.badge-light {
    background-color: #f8f9fc;
    color: var(--secondary);
    border: 1px solid #eaecf4;
}

/* Question Cards for Preview */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--glass-border);
}

.question-card {
    background: white;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}

.question-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.question-number {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-delete {
    background: #fff5f5;
    color: #e74a3b;
    border: 1px solid #fed7d7;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-delete:hover {
    background: #e74a3b;
    color: white;
}

.option-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 15px 0;
}

.option-item {
    display: flex;
    align-items: center;
    background: #f8f9fc;
    border-radius: 8px;
    padding: 0 10px;
}

.option-label {
    font-weight: 700;
    color: var(--secondary);
    padding-right: 10px;
    border-right: 1px solid #eee;
}

.option-item input {
    background: transparent;
    border: none;
    padding: 10px;
}

.correct-answer-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f1f3f9;
}

.correct-answer-row select {
    width: auto;
    min-width: 100px;
}

.reasoning-area {
    margin-top: 15px;
}

.reasoning-area textarea {
    min-height: 80px;
    line-height: 1.6;
}

/* Float Save Button */
.save-bar {
    position: sticky;
    bottom: 20px;
    background: white;
    padding: 15px 30px;
    border-radius: 12px;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    z-index: 100;
}

/* iOS style toggle switch */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  margin: 0 6px 0 0;
  vertical-align: middle;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 34px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
input:checked + .slider {
  background-color: #10b981; /* Green for ON */
}
input:checked + .slider:before {
  transform: translateX(16px);
}
