/* ============================================================
   ExamManager — Custom CSS
   Base color: #006699
   ============================================================ */



/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 14px;
    color: #1a1a1a;
    background: #f4f5f7;
}

/* ── Layout shell ─────────────────────────────────────────── */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.app-sidebar {
    width: 230px;
    min-width: 230px;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Logo */
.sidebar-logo {
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
}

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

/* Nav */
.sidebar-nav {
    flex: 1;
    padding: 10px 8px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.sidebar-nav-section {
    font-size: 10.5px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 10px 10px 4px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 500;
    color: #4b5563;
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
    user-select: none;
}

.sidebar-nav-item:hover {
    background: #f0f7ff;
    color: #006699;
    text-decoration: none;
}

.sidebar-nav-item.active {
    background: #e0f0f8;
    color: #006699;
}

.sidebar-nav-item i {
    font-size: 18px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav-arrow {
    font-size: 14px !important;
    width: auto !important;
    transition: transform 0.2s;
    color: #9ca3af;
}

[aria-expanded="true"] .sidebar-nav-arrow {
    transform: rotate(180deg);
}

/* Submenu */
.sidebar-nav-submenu {
    margin: 1px 0 2px 0;
}

.sidebar-nav-sub-item {
    display: block;
    padding: 6px 10px 6px 38px;
    font-size: 13px;
    color: #6b7280;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.12s, color 0.12s;
}

.sidebar-nav-sub-item:hover {
    background: #f0f7ff;
    color: #006699;
    text-decoration: none;
}

.sidebar-nav-sub-item.active {
    color: #006699;
    font-weight: 500;
}

.sidebar-nav-sub-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 4px 10px;
}

/* User block */
.sidebar-user {
    padding: 10px 8px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 10px;
    border-radius: 7px;
    cursor: pointer;
    margin: 6px 8px;
    transition: background 0.12s;
}

.sidebar-user:hover {
    background: #f0f7ff;
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #e0f0f8;
    color: #006699;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 500;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 11px;
    color: #9ca3af;
}

.sidebar-user-arrow {
    font-size: 15px;
    color: #9ca3af;
}

/* ── Main area ────────────────────────────────────────────── */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* Topbar */
.app-topbar {
    height: 52px;
    min-height: 52px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 8px;
}

.app-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #9ca3af;
}

.app-breadcrumb i {
    font-size: 15px;
}

.app-breadcrumb .bc-current {
    color: #1a1a1a;
    font-weight: 500;
}

.app-breadcrumb a {
    color: #6b7280;
    text-decoration: none;
}

.app-breadcrumb a:hover {
    color: #006699;
}

.app-topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Content */
.app-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: #f4f5f7;
}

/* ── Page header (μέσα στο content) ───────────────────────── */
.page-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 18px;
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

.page-count {
    font-size: 13px;
    color: #9ca3af;
}

/* ── Table card ───────────────────────────────────────────── */
.table-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

.table-card table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.table-card thead th {
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-align: left;
    white-space: nowrap;
}

.table-card tbody tr {
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background 0.1s;
}

.table-card tbody tr:last-child {
    border-bottom: none;
}

.table-card tbody tr:hover td {
    background: #f0f7ff;
}

.table-card tbody td {
    padding: 10px 16px;
    color: #1a1a1a;
}

.table-card tbody td.text-muted-col {
    color: #9ca3af;
}

/* Sticky header για μεγάλους πίνακες */
.table-sticky thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

/* ── Pagination ───────────────────────────────────────────── */
.pagination-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.pagination-per-page {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
}

.pagination-per-page select {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 12px;
    color: #374151;
    cursor: pointer;
}

.pagination-info {
    font-size: 12px;
    color: #9ca3af;
    white-space: nowrap;
}

.pagination-controls {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 2px;
}

.pagination-controls .page-item .page-link {
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 13px;
    color: #4b5563;
    border: 1px solid transparent;
    background: none;
    padding: 0 6px;
    transition: background 0.1s, color 0.1s;
}

.pagination-controls .page-item .page-link:hover {
    background: #f0f7ff;
    color: #006699;
    border-color: #bdd9e8;
}

.pagination-controls .page-item.active .page-link {
    background: #006699;
    color: #ffffff;
    border-color: #006699;
    font-weight: 500;
}

.pagination-controls .page-item.disabled .page-link {
    color: #d1d5db;
    pointer-events: none;
}

/* ── Status badges ────────────────────────────────────────── */
.badge-active {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    background: #dcfce7;
    color: #166534;
}

.badge-pending {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    background: #fef9c3;
    color: #854d0e;
}

.badge-inactive {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

/* ── Buttons ──────────────────────────────────────────────── */
.app-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    background: #006699;
    color: #ffffff;
    border: none;
    border-radius: 7px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s;
}

.app-btn-primary:hover {
    background: #005580;
    color: #ffffff;
    text-decoration: none;
}

.app-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: #ffffff;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s, border-color 0.12s;
}

.app-btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #1a1a1a;
    text-decoration: none;
}

.app-btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: #ffffff;
    color: #dc2626;
    border: 1px solid #fca5a5;
    border-radius: 7px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s;
}

.app-btn-danger:hover {
    background: #fef2f2;
    border-color: #dc2626;
    color: #dc2626;
    text-decoration: none;
}

/* ── Profile Offcanvas ────────────────────────────────────── */
.app-offcanvas-profile .offcanvas-header {
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 20px;
}

.app-offcanvas-profile .offcanvas-body {
    padding: 16px 20px;
}

/* ── Actions Offcanvas ────────────────────────────────────── */
.app-offcanvas-actions .offcanvas-header {
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 20px;
}

.app-offcanvas-actions .offcanvas-body {
    padding: 16px 20px;
}

/* ── Page offcanvas (φίλτρα / ενέργειες) ─────────────────── */
.app-offcanvas .offcanvas-header {
    border-bottom: 1px solid #e5e7eb;
    padding: 14px 16px;
}

.app-offcanvas .offcanvas-title {
    font-size: 14px;
    font-weight: 600;
}

.app-offcanvas .offcanvas-body {
    padding: 0;
    display: flex;
    flex-direction: column;
}

.offcanvas-section {
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.offcanvas-section-label {
    font-size: 10.5px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}

.offcanvas-action-list {
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.offcanvas-action-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13.5px;
    color: #4b5563;
    text-decoration: none;
    transition: background 0.1s, color 0.1s;
}

.offcanvas-action-item:hover {
    background: #f0f7ff;
    color: #006699;
    text-decoration: none;
}

.offcanvas-action-item i {
    font-size: 17px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.offcanvas-action-item.danger {
    color: #dc2626;
}

.offcanvas-action-item.danger:hover {
    background: #fef2f2;
    color: #dc2626;
}

.offcanvas-action-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 4px 10px;
}

/* ── Forms ────────────────────────────────────────────────── */
.form-label {
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 5px;
}

.form-control, .form-select {
    font-size: 13.5px;
    border-color: #d1d5db;
    border-radius: 7px;
}

.form-control:focus, .form-select:focus {
    border-color: #006699;
    box-shadow: 0 0 0 3px rgba(0, 102, 153, 0.12);
}

input[readonly] {
    background-color: #f9fafb;
    cursor: not-allowed;
}

/* ── Utilities ────────────────────────────────────────────── */
.hidden { display: none; }

iframe {
    width: 100%;
    height: 95%;
}

sup, sub { font-size: 0.75em; line-height: 1; }
sup { vertical-align: 0.6em; }
sub { vertical-align: -0.4em; }

/* ── Offcanvas filter form ────────────────────────────────── */
.offcanvas-section .form-group {
    margin-bottom: 14px;
}

.offcanvas-section .form-group label {
    font-size: 10.5px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: block;
    margin-bottom: 5px;
}

.offcanvas-section .form-control,
.offcanvas-section .form-select {
    font-size: 13px;
}

.offcanvas-section .form-check-input:checked {
    background-color: #006699;
    border-color: #006699;
}

/* ── Module picker grid ───────────────────────────────────── */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.module-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 20px 16px;
    text-align: center;
    text-decoration: none;
    transition: border-color 0.12s, background 0.12s;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.module-card:hover {
    border-color: #006699;
    background: #f0f7ff;
    text-decoration: none;
}

.module-card-code {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
}

.module-card-count {
    font-size: 12px;
    color: #9ca3af;
}

/* ── Crud form ────────────────────────────────────────────── */
.form-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 52px - 48px); /* viewport - topbar - padding */
}

.form-card-header {
    padding: 14px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    flex-shrink: 0; /* δεν συμπιέζεται */
}

.form-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
}

.form-card-body {
    padding: 4px 0;
    flex: 1;          /* παίρνει όλο τον υπόλοιπο χώρο */
    overflow-y: auto; /* scroll μόνο εδώ */
    min-height: 0;    /* σημαντικό για σωστό overflow σε flex */
}

.form-footer {
    padding: 12px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0; /* δεν συμπιέζεται */
}

.crud-grid {
    display: grid;
}

.crud-grid--2 {
    grid-template-columns: 1fr 1fr;
}

.crud-field {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    border-right: 1px solid #f3f4f6;
}

.crud-field:nth-child(2n) {
    border-right: none;
}

.crud-field--span2 {
    grid-column: span 2;
    border-right: none;
}

.form-footer {
    padding: 12px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-error-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 7px;
    font-size: 13px;
    color: #dc2626;
    margin: 12px 16px 0;
}

.crud-label {
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 5px;
}

.list-group-oversized {
    max-height: 15rem;
    overflow: auto;
}


/* Edit Mode Sub Menou */
/* Κρύβουμε το checkbox που ελέγχει την κατάσταση */
#nav-toggle {
    display: none;
}

/* Το κουμπί που ανοίγει το offcanvas */
.open-btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    border-radius: 5px;
    font-family: sans-serif;
    user-select: none;
}

/* Το υπόβαθρο του Offcanvas (αρχικά κρυμμένο δεξιά) */
.offcanvas-menu {
    position: fixed;
    top: 0;
    right: -300px; /* Κρυμμένο έξω από την οθόνη */
    width: 300px;
    height: 100%;
    background-color: #111;
    color: white;
    box-shadow: -2px 0 5px rgba(0,0,0,0.5);
    transition: right 0.3s ease; /* Ομαλό εφέ κίνησης */
    padding: 20px;
    box-sizing: border-box;
    font-family: sans-serif;
    z-index: 1000;
}

/* Το κουμπί κλεισίματος μέσα στο offcanvas */
.close-btn {
    font-size: 24px;
    cursor: pointer;
    float: right;
}

/* Η λίστα με τις επιλογές */
.offcanvas-menu ul {
    list-style: none;
    padding: 0;
    margin-top: 5px;
}

.offcanvas-menu ul li a {
    display: block;
    padding: 15px 0;
    color: #ccc;
    text-decoration: none;
    border-bottom: 1px solid #222;
    transition: color 0.2s;
}

.offcanvas-menu ul li a:hover {
    color: white;
}

/* Η "ΜΑΓΕΙΑ" ΤΟΥ CSS: Όταν το checkbox είναι επιλεγμένο, εμφάνισε το offcanvas */
#nav-toggle:checked ~ .offcanvas-menu {
    right: 0; /* Έρχεται μέσα στην οθόνη */
}

/* ── PDF viewer layout ────────────────────────────────────── */
.pdf-viewer-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    height: 100%;
    overflow: hidden;
}

.pdf-file-list {
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
    padding: 8px 0;
}

.pdf-file-group {
    margin-bottom: 4px;
}

.pdf-file-group-title {
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
    background: #006699;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 5px 12px;
}

.pdf-file-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    font-size: 12.5px;
    color: #4b5563;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.1s, color 0.1s;
}

.pdf-file-item:hover {
    background: #f0f7ff;
    color: #006699;
}

.pdf-file-item i {
    font-size: 15px;
    color: #dc2626;
    flex-shrink: 0;
}

.pdf-file-item.active {
    background: #e0f0f8;
    color: #006699;
    font-weight: 500;
}

.pdf-file-empty {
    padding: 6px 12px;
    font-size: 12px;
    color: #9ca3af;
    font-style: italic;
}

.pdf-preview-panel {
    overflow: hidden;
    background: #f4f5f7;
}

/* ── Student answer cards ─────────────────────────────────── */
.student-answer-card {
    padding: 8px 12px;
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.1s;
}

.student-answer-card:hover {
    background: #f9fafb;
}

.student-answer-card.score-none   { border-left: 3px solid #9ca3af; }
.student-answer-card.score-fail   { border-left: 3px solid #dc2626; }
.student-answer-card.score-border { border-left: 3px solid #f59e0b; }
.student-answer-card.score-pass   { border-left: 3px solid #16a34a; }

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

.student-name {
    font-size: 13px;
    font-weight: 500;
    color: #1a1a1a;
}

.student-passport {
    font-size: 12px;
    color: #9ca3af;
}

.student-answer-card-footer {
    display: flex;
    align-items: center;
    gap: 8px;
}

.score-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: auto;
}

.score-badge.score-none   { background: #f3f4f6; color: #6b7280; }
.score-badge.score-fail   { background: #fef2f2; color: #dc2626; }
.score-badge.score-border { background: #fffbeb; color: #d97706; }
.score-badge.score-pass   { background: #f0fdf4; color: #16a34a; }

.btn-xs {
    padding: 4px 10px;
    font-size: 12px;
}

/* ── Answers form ─────────────────────────────────────────── */
.form-card-subtitle {
    font-size: 13px;
    color: #9ca3af;
    margin-left: auto;
}

.answers-toggle {
    padding: 4px 0;
}

.answers-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: #4b5563;
    cursor: pointer;
}

.answers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 6px;
    max-height: 320px;
    overflow-y: auto;
    padding: 4px 0;
}

.answer-row {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 5px 8px;
    background: #f9fafb;
}

.answer-row:hover {
    background: #f0f7ff;
    border-color: #bdd9e8;
}

.answer-num {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    min-width: 20px;
}

.answer-options {
    display: flex;
    align-items: center;
    gap: 6px;
}

.answer-option {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
}

.pdf-preview-panel .form-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.pdf-preview-panel .form-card-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.pdf-preview-panel .form-footer {
    flex-shrink: 0;
}

.table-scroll-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 52px - 48px - 56px - 60px); /* topbar, padding, page-header, pagination */
}

.table-scroll-wrapper table {
    width: 100%;
    min-width: max-content; /* δεν συμπιέζεται οριζόντια */
}

.table-scroll-wrapper thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f9fafb; /* πρέπει να είναι solid, όχι transparent */
}

.table-empty {
    text-align: center;
    padding: 32px;
    color: #9ca3af;
}