/* ==========================================================================
   Exam Creator — View / Listing styles
   Loaded on: exams, tests, exam, test, view-exams, view-accesslist
   ========================================================================== */

/* ---------- Exam results table ---------- */
.examresults {
    display: table;
}
.er-col-1,
.er-col-2,
.er-col-3,
.er-col-4 {
    display: table-cell;
    padding: 5px;
}

/* ---------- Question list numbers ---------- */
.qlist-num {
    float: left;
    margin-bottom: 3px;
    width: 30px;
    height: 30px;
}
.qlist-num > a {
    color: black;
}
.qlist-num > a:hover {
    color: #746e6e;
}

/* ---------- Hidden exam-info (handled inline in exam-single.php) ---------- */
.examinfo-left   { display: none; }
.examinfo-right  { display: none; }
.examinfo-title  { display: none; }
.examinfo-value  { display: none; }
.examinfo-row    { display: none; }

/* ---------- Take Exam button ---------- */
.oexam-take {
    background-color: #e92c40;
    color: #f5eeee;
    padding: 5px;
    border-radius: 7px;
    padding-right: 7px;
    padding-left: 7px;
    font-weight: bold;
}
.oexam-take:hover {
    color: black;
    background-color: #688d1c;
}

/* ---------- Exam detail view ---------- */
.ec_view_content_container {
    border: 1px solid #EEEEEE;
    border-radius: 4px;
    padding: 4px;
}

.exam_details {
    background: #F5F7F9;
    padding: 2px;
    font-size: 16px;
    border: 1px solid #F0F0F0;
}
.exam_details_span {
    background: #92EA92;
    padding: 5px;
    border: black;
    color: #FDFDFD;
    cursor: pointer;
}

.ec_view_content_list a {
    display: block;
    margin: 4px 0;
    padding: 4px;
    background: #92EA92;
    width: 300px;
    border-radius: 2px;
    border: 1px solid #7fd87f;
    font-family: sans-serif;
    color: white;
    font-size: 1.2em;
    transition: .5s linear;
}
.ec_view_content_list a:hover {
    color: #4e88aa;
    text-decoration: none;
    transition: .5s linear;
}

/* ---------- Exam Results Section ---------- */
.ec-results-section {
    margin-top: 20px;
}
.ec-results-section h3 {
    margin-bottom: 12px;
}
.ec-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border: 1px solid var(--border-color, rgba(128,128,128,0.2));
    border-radius: 8px;
    margin-bottom: 8px;
    background: var(--card-bg, rgba(128,128,128,0.06));
}
.ec-result-info {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    font-size: 0.95em;
    color: inherit;
}
.ec-result-info strong {
    color: inherit;
}
.ec-result-when {
    font-size: 0.85em;
    opacity: 0.55;
}
.ec-result-btn {
    padding: 6px 16px;
    border: 1px solid #2563eb;
    border-radius: 6px;
    background: #2563eb;
    color: #fff;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}
.ec-result-btn:hover {
    background: #1d4ed8;
}

/* ---------- Toppers Section ---------- */
.ec-toppers-section {
    margin-top: 24px;
}
.ec-toppers-section h3 {
    margin-bottom: 12px;
}
.ec-toppers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}
.ec-topper-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--border-color, rgba(128,128,128,0.2));
    border-radius: 8px;
    background: var(--card-bg, rgba(128,128,128,0.06));
}
.ec-topper-rank {
    font-weight: 700;
    font-size: 0.9em;
    color: #2563eb;
    min-width: 28px;
}
.ec-topper-avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}
.ec-topper-info {
    flex: 1;
    min-width: 0;
}
.ec-topper-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ec-topper-name a {
    color: inherit;
}
.ec-topper-stats {
    display: flex;
    gap: 12px;
    font-size: 0.85em;
    opacity: 0.65;
    margin-top: 2px;
}
.ec-topper-marks {
    font-weight: 600;
    color: #16a34a;
}
.ec-topper-time {
    opacity: 0.7;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
    .ec-result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .ec-result-info {
        gap: 10px;
    }
    .ec-toppers-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Dark mode
   ========================================================================== */
html[data-theme="dark"] .qlist-num > a {
    color: #c8d4e0;
}
html[data-theme="dark"] .ec_view_content_container {
    border-color: #3a4a5a;
}
html[data-theme="dark"] .exam_details {
    background: #1a2332;
    border-color: #2e4a66;
}
html[data-theme="dark"] .exam_details_span {
    background: #1a5a1a;
}
html[data-theme="dark"] .ec_view_content_list a {
    background: #1a5a1a;
    border-color: #2a7a2a;
    color: #dce6f0;
}
html[data-theme="dark"] .ec_view_content_list a:hover {
    color: #7fbfdf;
}
html[data-theme="dark"] .oexam-take {
    background-color: #b02030;
    color: #f0e0e0;
}
html[data-theme="dark"] .oexam-take:hover {
    background-color: #4a6a10;
    color: #dce6f0;
}
html[data-theme="dark"] .ec-topper-rank {
    color: #6090d0;
}
html[data-theme="dark"] .ec-topper-marks {
    color: #40b060;
}

/* ==========================================================================
   Exam Single Page — Hero Banner & CTA
   ========================================================================== */
.ec-hero-banner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 24px;
    margin-bottom: 8px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 100%);
    border: 1px solid #d0d9f0;
}
.ec-hero-closed {
    background: linear-gradient(135deg, #fff5f5 0%, #fee2e2 100%);
    border-color: #fecaca;
}
.ec-hero-login {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-color: #fde68a;
}
.ec-hero-status {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
}
.ec-hero-closed .ec-hero-status { color: #991b1b; }
.ec-hero-login .ec-hero-status { color: #92400e; }
.ec-hero-login .ec-hero-status a { color: #2563eb; font-weight: 700; text-decoration: underline; }

.ec-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: #e0e7ff;
    color: #3730a3;
    white-space: nowrap;
    text-decoration: none !important;
    transition: background 0.15s, color 0.15s;
}
a.ec-type-badge:hover {
    background: #c7d2fe;
    color: #312e81;
}
.ec-cat-badge {
    background: #dcfce7;
    color: #166534;
}
a.ec-cat-badge:hover {
    background: #bbf7d0;
    color: #14532d;
}
.ec-al-link-badge {
    background: #fef3c7;
    color: #92400e;
}
a.ec-al-link-badge:hover {
    background: #fde68a;
    color: #78350f;
}
.ec-subject-badge {
    background: #fef3c7;
    color: #92400e;
}
a.ec-subject-badge:hover {
    background: #fde68a;
    color: #78350f;
}
.ec-topic-badge {
    background: #f3e8ff;
    color: #6b21a8;
}
a.ec-topic-badge:hover {
    background: #e9d5ff;
    color: #581c87;
}
.ec-hero-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    width: 100%;
}
.ec-hero-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.ec-take-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 10px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff !important;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none !important;
    box-shadow: 0 4px 14px rgba(37,99,235,0.35);
    transition: transform 0.15s, box-shadow 0.15s;
}
.ec-take-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37,99,235,0.45);
    color: #fff !important;
    text-decoration: none !important;
}
.ec-take-btn svg { flex-shrink: 0; }

.ec-countdown-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #555;
}
.ec-countdown-label {
    font-weight: 600;
    color: #92400e;
}

/* ==========================================================================
   Exam Single Page — Two-column panels
   ========================================================================== */
.ec-two-col {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-top: 12px;
    flex-wrap: wrap;
}
.ec-info-panel, .ec-ql-panel {
    flex: 1 1 260px;
    min-width: 0;
    background: #fff;
    border: 1px solid #e4e8ee;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    padding: 16px 18px 18px;
}
.ec-panel-header, .ec-ql-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}
.ec-panel-title, .ec-ql-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
    color: #1a1a2e;
    letter-spacing: 0.01em;
}
.ec-panel-title svg, .ec-ql-title svg {
    color: #6366f1;
    flex-shrink: 0;
}

/* Key stats highlight row */
.ec-key-stats {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}
.ec-key-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 6px;
    background: linear-gradient(135deg, #f8faff 0%, #eef2ff 100%);
    border-radius: 10px;
    border: 1px solid #e0e7ff;
}
.ec-key-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: #1e293b;
    line-height: 1.2;
}
.ec-key-value small {
    font-size: 0.7em;
    font-weight: 600;
    color: #64748b;
}
.ec-key-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: #64748b;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Stats list */
.ec-stats-list {
    margin: 0;
    padding: 0;
}
.ec-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid #f5f5f8;
}
.ec-stat-row:last-child { border-bottom: none; }
.ec-stat-row dt {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.84rem;
    color: #555;
    font-weight: 400;
    flex: 1;
}
.ec-stat-row dt svg {
    color: #94a3b8;
    flex-shrink: 0;
}
.ec-stat-row dd {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
    text-align: right;
}
.ec-stat-note {
    font-size: 0.78em;
    color: #888;
    padding: 4px 0 2px;
    line-height: 1.4;
    font-style: italic;
}

/* Toppers section toggle */
.ec-toppers-toggle {
    display: flex;
    align-items: center;
}

/* Panel action buttons */
.ec-panel-actions {
    margin-top: 12px;
    text-align: center;
}
.ec-msg-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 8px;
    background: #e0f2fe;
    color: #0369a1 !important;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none !important;
    transition: background 0.15s;
}
.ec-msg-btn:hover {
    background: #bae6fd;
    text-decoration: none !important;
}
.ec-msg-btn svg { flex-shrink: 0; }

/* Stat value links */
.ec-stat-link {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 700;
    transition: color 0.15s;
}
.ec-stat-link:hover {
    color: #3730a3;
    text-decoration: underline;
}

/* Explore more exams link */
.ec-explore-link {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
    text-align: center;
}
.ec-explore-link a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #4f46e5 !important;
    background: #eef2ff;
    text-decoration: none !important;
    transition: background 0.15s, color 0.15s;
}
.ec-explore-link a:hover {
    background: #e0e7ff;
    color: #3730a3 !important;
    text-decoration: none !important;
}
.ec-explore-link a svg { flex-shrink: 0; }

/* ==========================================================================
   Exam Single Page — Question Links (heatmap) panel
   ========================================================================== */
.ec-ql-panel {
    flex: 2 1 320px;
}
.ec-ql-badge {
    display: inline-block;
    background: #eef2ff;
    color: #3d5bf0;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 10px;
    line-height: 1.6;
    margin-left: auto;
}
.heatmap-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 6px;
    justify-items: center;
    align-items: center;
}
.heat-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: #333;
    border-radius: 8px;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s;
    font-weight: 700;
    font-size: 13px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}
.heat-link:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0,0,0,0.20);
    text-decoration: none;
}
.heat-link.no-takes {
    background: #f4f5f7 !important;
    color: #555;
    border: 1px solid #dde1e8;
}
.heat-link.no-takes:hover { color: #3d5bf0; }
.heat-link.has-takes:hover { color: #fff; }

.ec-ql-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}
.ec-ql-toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.83rem;
    color: #555;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: #666;
}
.legend-gradient {
    width: 70px;
    height: 8px;
    background: linear-gradient(to right, hsl(0,52%,68%), hsl(40,52%,70%), hsl(80,50%,70%), hsl(128,46%,72%));
    border-radius: 4px;
    border: 1px solid #ddd;
}
.ec-ql-legend-note {
    font-style: italic;
    font-size: 0.7rem;
    color: #999;
    margin-left: 4px;
}

/* ==========================================================================
   Exam Single Page — Section headers (Results, Comments, Toppers)
   ========================================================================== */
.ec-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e7ff;
}
.ec-section-header svg {
    color: #6366f1;
    flex-shrink: 0;
}

/* Recalculate button */
.ec-recalc-wrap {
    display: inline-block;
    float: right;
    margin: 14px 0;
}
.ec-recalc-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #f9fafb;
    color: #374151;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.ec-recalc-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}
.ec-recalc-btn svg { flex-shrink: 0; color: #6b7280; }

/* Comments section */
.ec-comments-section {
    margin-top: 24px;
}

/* ==========================================================================
   Exam Single Page — Responsive
   ========================================================================== */
@media (max-width: 700px) {
    .ec-two-col { flex-direction: column; }
    .ec-info-panel, .ec-ql-panel { flex-basis: 100%; }
    .ec-hero-banner { text-align: center; }
    .ec-hero-row { justify-content: center; }
    .ec-key-stats { gap: 6px; }
    .ec-key-value { font-size: 1.1rem; }
}

/* ==========================================================================
   Exam Single Page — Dark mode
   ========================================================================== */
html[data-theme="dark"] .ec-hero-banner {
    background: linear-gradient(135deg, #1e2a4a 0%, #1a2332 100%);
    border-color: #2e4a66;
}
html[data-theme="dark"] .ec-hero-closed {
    background: linear-gradient(135deg, #3b1414 0%, #2d1010 100%);
    border-color: #5a2020;
}
html[data-theme="dark"] .ec-hero-login {
    background: linear-gradient(135deg, #3d2e0a 0%, #2d220a 100%);
    border-color: #5a4a10;
}
html[data-theme="dark"] .ec-hero-status { color: #d1d5db; }
html[data-theme="dark"] .ec-hero-closed .ec-hero-status { color: #fca5a5; }
html[data-theme="dark"] .ec-hero-login .ec-hero-status { color: #fbbf24; }
html[data-theme="dark"] .ec-hero-login .ec-hero-status a { color: #7a9bff; }
html[data-theme="dark"] .ec-type-badge { background: #312e81; color: #a5b4fc; }
html[data-theme="dark"] a.ec-type-badge:hover { background: #3730a3; color: #c7d2fe; }
html[data-theme="dark"] .ec-cat-badge { background: #14532d; color: #86efac; }
html[data-theme="dark"] a.ec-cat-badge:hover { background: #166534; color: #bbf7d0; }
html[data-theme="dark"] .ec-al-link-badge { background: #78350f; color: #fde68a; }
html[data-theme="dark"] a.ec-al-link-badge:hover { background: #92400e; color: #fef3c7; }
html[data-theme="dark"] .ec-subject-badge { background: #78350f; color: #fde68a; }
html[data-theme="dark"] a.ec-subject-badge:hover { background: #92400e; color: #fef3c7; }
html[data-theme="dark"] .ec-topic-badge { background: #4c1d95; color: #d8b4fe; }
html[data-theme="dark"] a.ec-topic-badge:hover { background: #5b21b6; color: #e9d5ff; }
html[data-theme="dark"] .ec-stat-link { color: #818cf8; }
html[data-theme="dark"] .ec-stat-link:hover { color: #a5b4fc; }
html[data-theme="dark"] .ec-take-btn {
    background: linear-gradient(135deg, #3b5bf0 0%, #2d4ed8 100%);
    box-shadow: 0 4px 14px rgba(59,91,240,0.3);
}
html[data-theme="dark"] .ec-countdown-label { color: #fbbf24; }
html[data-theme="dark"] .ec-countdown-wrap { color: #9ca3af; }

html[data-theme="dark"] .ec-info-panel,
html[data-theme="dark"] .ec-ql-panel {
    background: #1e2533;
    border-color: #2e3a4a;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
html[data-theme="dark"] .ec-panel-header,
html[data-theme="dark"] .ec-ql-header { border-bottom-color: #2e3a4a; }
html[data-theme="dark"] .ec-panel-title,
html[data-theme="dark"] .ec-ql-title { color: #e0e6f0; }
html[data-theme="dark"] .ec-panel-title svg,
html[data-theme="dark"] .ec-ql-title svg { color: #818cf8; }
html[data-theme="dark"] .ec-key-stat {
    background: linear-gradient(135deg, #252d40 0%, #1e2a42 100%);
    border-color: #3a4a66;
}
html[data-theme="dark"] .ec-key-value { color: #e0e6f0; }
html[data-theme="dark"] .ec-key-value small { color: #94a3b8; }
html[data-theme="dark"] .ec-key-label { color: #94a3b8; }
html[data-theme="dark"] .ec-ql-badge { background: #1e2a4a; color: #7a9bff; }
html[data-theme="dark"] .ec-stat-row { border-bottom-color: #2e3544; }
html[data-theme="dark"] .ec-stat-row dt { color: #9ca3b8; }
html[data-theme="dark"] .ec-stat-row dt svg { color: #64748b; }
html[data-theme="dark"] .ec-stat-row dd { color: #e0e6f0; }
html[data-theme="dark"] .ec-stat-note { color: #666; }
html[data-theme="dark"] .ec-msg-btn { background: #1e3a5a; color: #7dd3fc !important; }
html[data-theme="dark"] .ec-msg-btn:hover { background: #1e4a6a; }
html[data-theme="dark"] .ec-explore-link { border-top-color: #2e3a4a; }
html[data-theme="dark"] .ec-explore-link a { background: #1e2a4a; color: #a5b4fc !important; }
html[data-theme="dark"] .ec-explore-link a:hover { background: #2e3a5a; color: #c7d2fe !important; }
html[data-theme="dark"] .ec-ql-controls { border-top-color: #2e3a4a; }
html[data-theme="dark"] .ec-ql-toggle-label { color: #9ca3b8; }
html[data-theme="dark"] .heatmap-legend { color: #9ca3b8; }
html[data-theme="dark"] .legend-gradient { border-color: #4a5568; }
html[data-theme="dark"] .ec-ql-legend-note { color: #64748b; }
html[data-theme="dark"] #heatmapToggle { accent-color: #7a9bff; }
html[data-theme="dark"] .heat-link.no-takes {
    background: #252d3a !important;
    color: #9ca3b8;
    border-color: #3a4a5a;
}
html[data-theme="dark"] .heat-link.no-takes:hover { color: #7a9bff !important; }
html[data-theme="dark"] .ec-section-header { color: #e0e6f0; border-bottom-color: #2e3a5a; }
html[data-theme="dark"] .ec-section-header svg { color: #818cf8; }
html[data-theme="dark"] .ec-recalc-btn { background: #252d3a; border-color: #3a4a5a; color: #d1d5db; }
html[data-theme="dark"] .ec-recalc-btn:hover { background: #2e3a4a; border-color: #4a5a6a; }
html[data-theme="dark"] .ec-recalc-btn svg { color: #9ca3b8; }
