:root {
    --primary-color: #1a237e;
    --primary-light: #283593;
    --accent-color: #ffd54f;
    --primary-bg-light: #e8eaf6;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #333;
    min-height: 100vh;
}

.navbar {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .brand {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar .brand img.brand-logo {
    height: 36px;
    width: auto;
    object-fit: contain;
}

.navbar .brand span {
    color: var(--accent-color);
}

.navbar nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.navbar nav a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    margin-left: 25px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s;
}

.navbar nav a:hover, .navbar nav a.active {
    color: var(--accent-color);
}

.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

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

.page-header h1 {
    font-size: 1.8rem;
    color: var(--primary-color);
    font-weight: 700;
}

.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    padding: 30px;
    margin-bottom: 25px;
}

.card h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.3rem;
    border-bottom: 2px solid var(--primary-bg-light);
    padding-bottom: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    text-align: center;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-card .stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-card .stat-label {
    color: #666;
    margin-top: 5px;
    font-size: 0.95rem;
}

.stat-card.blue { border-top: 4px solid var(--primary-color); }
.stat-card.green { border-top: 4px solid #2e7d32; }
.stat-card.orange { border-top: 4px solid #ef6c00; }
.stat-card.purple { border-top: 4px solid #6a1b9a; }

table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background: var(--primary-bg-light);
}

table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
}

table tbody tr:hover {
    background: #f5f5f5;
}

.btn {
    display: inline-block;
    padding: 10px 22px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    text-align: center;
}

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

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

.btn-success {
    background: #2e7d32;
    color: white;
}

.btn-success:hover {
    background: #388e3c;
}

.btn-danger {
    background: #c62828;
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-warning {
    background: #ef6c00;
    color: white;
}

.btn-warning:hover {
    background: #f57c00;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #444;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    font-family: inherit;
}

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

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.alert {
    padding: 14px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.alert-danger {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.alert-info {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
}

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 50%, #3949ab 100%);
}

.login-box {
    background: white;
    padding: 45px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 420px;
}

.login-box h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 8px;
    font-size: 1.8rem;
}

.login-box .subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 0.95rem;
}

.login-box .login-logo {
    display: block;
    margin: 0 auto 15px;
    max-height: 60px;
    width: auto;
    object-fit: contain;
}

.login-box .btn {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-admin { background: var(--primary-bg-light); color: var(--primary-color); }
.badge-teacher { background: #e8f5e9; color: #2e7d32; }
.badge-mcq { background: #fff3e0; color: #ef6c00; }
.badge-short { background: #e3f2fd; color: #1565c0; }
.badge-long { background: #fce4ec; color: #c62828; }
.badge-active { background: #e8f5e9; color: #2e7d32; }
.badge-inactive { background: #ffebee; color: #c62828; }
.badge-schedule { background: #fff3e0; color: #ef6c00; font-size: 0.7rem; }
.badge-qtype { background: var(--primary-bg-light); color: var(--primary-color); }

.image-upload-area {
    border: 2px dashed #c5cae9;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9ff;
}

.image-upload-area:hover {
    border-color: var(--primary-color);
    background: var(--primary-bg-light);
}

.q-image img {
    max-width: 400px;
    max-height: 300px;
    border-radius: 8px;
    border: 1px solid #ddd;
    padding: 4px;
}

.section-header-blue {
    background: var(--primary-color);
    color: #fff;
    padding: 10px 15px;
    margin: -25px -25px 20px -25px;
    border-radius: 12px 12px 0 0;
    font-size: 1rem;
}

.qt-row {
    border-bottom: 1px solid #eee;
    padding: 12px 0;
}

.qt-row:last-child {
    border-bottom: none;
}

.qt-row-header {
    margin-bottom: 8px;
}

.qt-row-header strong {
    color: var(--primary-color);
    font-size: 0.95rem;
}

.qt-available {
    color: #2e7d32;
    font-weight: 600;
    font-size: 0.85rem;
}

.qt-row-inputs {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.qt-input-group {
    flex: 1;
    min-width: 150px;
}

.qt-input-group input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.9rem;
}

.qt-marks-label {
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    min-width: 80px;
    text-align: right;
}

.qt-type-total {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.marks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.marks-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f5f5f5;
    padding: 8px 12px;
    border-radius: 8px;
}

.marks-item label {
    font-size: 0.85rem;
    white-space: nowrap;
    flex: 1;
}

.marks-item input {
    width: 60px;
    padding: 4px 6px;
    border: 1px solid #ccc;
    border-radius: 6px;
    text-align: center;
}

.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.chapter-check {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #f5f5f5;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.chapter-check:hover {
    background: var(--primary-bg-light);
}

.chapter-check input {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.test-paper {
    background: white;
    max-width: 800px;
    margin: 30px auto;
    padding: 50px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
}

.test-paper .test-header {
    text-align: center;
    border-bottom: 3px double var(--primary-color);
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.test-paper .test-header h1 {
    color: var(--primary-color);
    font-size: 1.6rem;
    margin-bottom: 5px;
}

.test-paper .test-header .meta {
    color: #666;
    font-size: 0.9rem;
}

.test-paper .test-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
    color: #444;
}

.question-block {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.question-block:last-child {
    border-bottom: none;
}

.question-block .q-number {
    font-weight: 700;
    color: var(--primary-color);
}

.question-block .q-text {
    margin: 5px 0 10px;
    line-height: 1.6;
}

.question-block .options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding-left: 20px;
}

.question-block .options .opt {
    padding: 6px 0;
}

.question-block .answer-line {
    border-bottom: 1px dotted #999;
    height: 30px;
    margin-top: 10px;
}

.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: #999;
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.empty-state p {
    font-size: 1.1rem;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

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

.modal {
    background: white;
    border-radius: 12px;
    padding: 30px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.actions {
    display: flex;
    gap: 8px;
}

@media print {
    .navbar, .no-print { display: none !important; }
    .test-paper { box-shadow: none; margin: 0; padding: 20px; }
    body { background: white; }
}

.assign-teacher-card {
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.assign-teacher-header {
    background: var(--primary-bg-light);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #c5cae9;
}

.assign-teacher-header strong {
    font-size: 1rem;
    color: var(--primary-color);
    margin-right: 10px;
}

.accordion-arrow {
    font-size: 0.8rem;
    color: #666;
    transition: transform 0.2s;
}

.assign-badge {
    background: var(--primary-color);
    color: #fff;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.assign-teacher-card table {
    margin: 0;
    border-radius: 0;
}

.assign-teacher-card table th {
    background: #f5f5f5;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #666;
}

.match-pair-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.match-pair-num {
    font-weight: 600;
    color: #555;
    min-width: 22px;
}

.match-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.match-input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.match-display {
    margin-top: 10px;
}

.match-table {
    width: auto;
    min-width: 400px;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.match-table th {
    background: #f0f0f0;
    color: #333;
    padding: 6px 15px;
    border: 1px solid #ddd;
    font-weight: 600;
    text-align: left;
}

.match-table td {
    padding: 5px 15px;
    border: 1px solid #ddd;
}

.color-input-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-input-group input[type="color"] {
    width: 50px;
    height: 40px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
}

.color-input-group input[type="text"] {
    flex: 1;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.theme-option {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.theme-option:hover {
    border-color: var(--primary-color);
}

.theme-option.active {
    border-color: var(--primary-color);
    background: var(--primary-bg-light);
}

.theme-option .theme-preview {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-bottom: 8px;
}

.theme-option .theme-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid #ddd;
}

.theme-option .theme-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
}

.preview-box {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 15px;
}

.preview-navbar {
    padding: 10px 15px;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-body {
    padding: 15px;
    background: #f0f2f5;
}

.preview-btn {
    display: inline-block;
    padding: 6px 14px;
    color: white;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.file-upload-preview {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 8px;
}

.file-upload-preview img {
    max-height: 50px;
    width: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 2px;
}

@media (max-width: 768px) {
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .navbar { padding: 0 15px; }
    .navbar nav a { margin-left: 12px; font-size: 0.8rem; }
    .container { padding: 0 15px; }
    .question-block .options { grid-template-columns: 1fr; }
}
