@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:wght@400;600;700&family=DM+Sans:wght@400;500;700&display=swap');

:root {
    --primary: #2c5282;
    --primary-dark: #1a365d;
    --primary-light: #4a90c2;
    --secondary: #d97706;
    --success: #059669;
    --danger: #dc2626;
    --warning: #f59e0b;
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f3f4f6;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --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 10px 30px rgba(0,0,0,0.12);
}

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

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Crimson Pro', serif;
    font-weight: 700;
    line-height: 1.2;
    color: var(--primary-dark);
}

/* Authentication Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.auth-container::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: float 20s infinite ease-in-out;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-30px, 30px) rotate(5deg); }
}

.auth-box {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 50px;
    width: 100%;
    max-width: 450px;
    position: relative;
    z-index: 1;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-box h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--primary-dark);
}

.auth-box p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* Navigation */
.navbar {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border);
    padding: 0;
    box-shadow: var(--shadow-sm);
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    height: 70px;
}

.navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;          /* space between image and text */
    text-decoration: none;
    color: var(--primary);
    font-weight: 700;
    font-size: 1.5rem;
}

.navbar-logo {
    height: 60px;      /* adjust to taste */
    width: auto;
    display: block;
}

.navbar-brand-text {
    line-height: 1;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.user-role {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Navbar Menu */
.navbar-menu {
    display: flex;
    gap: 5px;
    margin-left: 30px;
}

.navbar-link {
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    position: relative;
}

.navbar-link:hover {
    background: rgba(44, 82, 130, 0.08);
    color: var(--primary);
}

.navbar-link.active {
    background: var(--primary);
    color: white;
}

.navbar-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: var(--primary-light);
    border-radius: 2px;
}

/* Main Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 30px;
}

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

.dashboard-header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
}

.dashboard-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Generic 2-column layout for dashboard cards */
.dashboard-row {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    align-items: stretch;      /* make children the same height */
}

/* Each card inside that row */
.dashboard-row .card {
    flex: 1 1 320px;           /* grow/shrink nicely, min width for mobile */
    display: flex;
    flex-direction: column;    /* so header/body stack */
}

/* Make the body fill the remaining height so both cards match */
.dashboard-row .card-body {
    flex: 1;
}

/* On small screens, stack them again */
@media (max-width: 900px) {
    .dashboard-row {
        grid-template-columns: 1fr;
    }
}


/* Cards */
.card {
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    padding: 18px 24px;
    border-bottom: 2px solid var(--bg-tertiary);
}

.card-header h2 {
    font-size: 1.5rem;
    color: var(--primary-dark);
}

.card-body {
    padding: 20px 24px; /* was 30px */

}

.grade-quick-btn {
    background: #e5e7eb;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    cursor: pointer;
}

.grade-quick-btn.active {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #ffffff;
}
#live-notifications .alert {
    transition: opacity 0.25s ease;
}

#live-notifications .alert.is-hiding {
    opacity: 0;
}

.q-close-btn{
  border:0;
  background:transparent;
  font-size:1rem;
  font-weight:900;
  cursor:pointer;
  padding:6px 10px;
  border-radius:8px;
  color: var(--text-secondary);
}
.q-close-btn:hover{ background: rgba(0,0,0,.06); color: #111; }


/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}


.stat-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid var(--border, #e5e7eb);
    padding: 0.75rem 1rem;              /* smaller padding */
    min-height: auto;                   /* don't force tall cards */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

.stat-card:nth-child(1) {
    /* Total Questions */
    border-left-color: #3b82f6; /* blue */
}
.stat-card.success {
    border-left-color: var(--success);
}

.stat-card.warning {
    border-left-color: var(--warning);
}

.stat-card.danger {
    border-left-color: var(--danger);
}

.stat-label {
    font-size: 0.7rem;                  /* smaller label */
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary, #6b7280);
    margin-bottom: 0.15rem;
}

.stat-value {
    font-size: 1.25rem;                 /* slightly smaller than before */
    font-weight: 700;
}

/* Forms */
.form-group {
    margin-bottom: 25px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    width: 100%;
}

.file-input-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 2px dashed var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-input-label:hover {
    border-color: var(--primary);
    background: var(--bg-secondary);
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    left: -9999px;
}

/* Buttons */
.btn {
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-family: 'DM Sans', sans-serif;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

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

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

.btn-success:hover {
    background: #047857;
}

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

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

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

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

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

/* Questions List */
.questions-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.question-item {
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 2px solid var(--border);
    overflow: hidden;
    transition: all 0.3s ease;
}

.question-item.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.question-header {
    padding: 20px 25px;
    background: var(--bg-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.question-header:hover {
    background: #e5e7eb;
}

.question-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.question-code {
    font-family: 'Crimson Pro', serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    min-width: 60px;
}

.question-text {
    font-size: 1.05rem;
    color: var(--text-primary);
}

.question-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
}

.question-status.pending {
    background: #fef3c7;
    color: #92400e;
}

.question-status.approved {
    background: #d1fae5;
    color: #065f46;
}

.question-status.rejected {
    background: #fee2e2;
    color: #991b1b;
}

.question-status.not-answered {
    background: #f3f4f6;
    color: #6b7280;
}

.question-content {
    padding: 25px;
    border-top: 2px solid var(--border);
}

.submission-info {
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

thead th {
    background: var(--bg-tertiary);
    padding: 15px 20px;
    text-align: left;
    font-weight: 700;
    color: var(--primary-dark);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

tbody td {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

tbody tr:hover {
    background: var(--bg-tertiary);
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success);
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger);
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid var(--warning);
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 4px solid var(--primary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlide 0.3s ease-out;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 25px 30px;
    border-bottom: 2px solid var(--border);
}

.modal-header h2 {
    font-size: 1.8rem;
}

.modal-body {
    padding: 30px;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 2px solid var(--border);
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

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

.flex-gap {
    display: flex;
    gap: 15px;
}
/* Short line in header */
.question-text-short {
    font-size: 0.95rem;
    color: #4b5563;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Full description inside expanded area */
.question-full-text {
    font-size: 0.95rem;
    color: #374151;
    line-height: 1.4;
    margin-bottom: 10px;
}

/* Slight divider between title row and body */
.question-content {
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px dashed #e5e7eb;

}

.question-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    cursor: pointer;
}

/* Left side: code + short text */
.question-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;           /* important so text can truncate */
}

/* Question code */
.question-code {
    font-weight: 700;
    color: #1f2933;
    white-space: nowrap;
}

/* Short text in row */
.question-text-short {
    font-size: 0.95rem;
    color: #4b5563;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.question-status {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 999px;
    white-space: nowrap;
}

/* colours per status */
.question-status.approved,
.question-status.graded {
    background: #dcfce7;
    color: #166534;
}

.question-status.pending {
    background: #fef9c3;
    color: #92400e;
}

.question-status.rejected {
    background: #fee2e2;
    color: #b91c1c;
}

.question-status.not-answered {
    background: #e5e7eb;
    color: #4b5563;
}
@media (max-width: 640px) {
    .question-header {
        align-items: flex-start;
    }

    .question-status {
        margin-left: auto; /* push it to the right even when title wraps */
    }
}

/* Mobile tweaks */
@media (max-width: 640px) {
    .question-text-short {
        font-size: 0.9rem;
    }
    .question-full-text {
        font-size: 0.9rem;
    }
}


/* Responsive */
@media (max-width: 768px) {
    .auth-box {
        padding: 30px;
    }
    
    .navbar-container {
        padding: 0 15px;
    }
    
    .container {
        padding: 20px 15px;
    }
    
    
    .dashboard-header h1 {
        font-size: 2rem;
    }
     .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)); /* 2×2 grid */
        gap: 0.75rem;
    }

    .stat-card {
        padding: 0.6rem 0.7rem;
        border-radius: 10px;
    }

    .stat-label {
        font-size: 0.65rem;
    }

    .stat-value {
        font-size: 1.1rem;
    }
}

/* Extra-small screens if you want it even tighter */
@media (max-width: 480px) {
    .stats-grid {
        gap: 0.5rem;
    }

    .stat-card {
        padding: 0.5rem 0.6rem;
    }
}