/* =========================================
   Exam Papers Portal — Main Stylesheet
   ========================================= */

:root {
    --primary:     #1a3a5c;
    --primary-dark:#122a44;
    --primary-light:#2a5a8c;
    --accent:      #e67e22;
    --success:     #27ae60;
    --danger:      #c0392b;
    --warning:     #f39c12;
    --info:        #2980b9;
    --bg:          #f0f4f8;
    --card-bg:     #ffffff;
    --text:        #2c3e50;
    --text-muted:  #6c7a89;
    --border:      #dce3eb;
    --shadow:      0 2px 12px rgba(0,0,0,0.10);
    --shadow-hover:0 6px 24px rgba(0,0,0,0.16);
    --radius:      10px;
    --radius-sm:   6px;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-light); }

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

/* ---- HEADER ---- */
.site-header {
    background: var(--primary);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.staff-header { background: #0f2238; }

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    gap: 16px;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    color: #fff;
    text-decoration: none;
}

.site-brand .fa {
    font-size: 2rem;
    color: var(--accent);
}

.brand-name {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.brand-sub {
    display: block;
    font-size: 0.75rem;
    color: #a8c0d8;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.site-nav a {
    color: #cde;
    font-size: 0.875rem;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.site-nav a:hover { background: rgba(255,255,255,0.15); color: #fff; }

.btn-staff {
    background: var(--accent) !important;
    color: #fff !important;
    font-weight: 600;
}

.btn-staff:hover { background: #d35400 !important; }

.btn-logout {
    background: rgba(192,57,43,0.8) !important;
    color: #fff !important;
}

.btn-logout:hover { background: #c0392b !important; }

.staff-user-badge {
    color: #a8c0d8;
    font-size: 0.875rem;
    padding: 7px 12px;
    background: rgba(255,255,255,0.08);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ---- HERO / BANNER ---- */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    padding: 60px 20px;
    text-align: center;
}

.hero h1 {
    font-size: 2.4rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.hero p {
    font-size: 1.1rem;
    color: #b8d4ec;
    max-width: 600px;
    margin: 0 auto 28px;
}

.hero-search {
    display: flex;
    max-width: 480px;
    margin: 0 auto;
    background: #fff;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.hero-search input {
    flex: 1;
    border: none;
    padding: 14px 20px;
    font-size: 1rem;
    color: var(--text);
    outline: none;
}

.hero-search button {
    background: var(--accent);
    border: none;
    padding: 14px 22px;
    color: #fff;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

.hero-search button:hover { background: #d35400; }

/* ---- MAIN CONTENT ---- */
.main-content {
    flex: 1;
    padding: 40px 0;
}

/* ---- SECTION HEADINGS ---- */
.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
}

.section-sub {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 28px;
}

/* ---- PROGRAM GRID ---- */
.programs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 22px;
    margin-top: 24px;
}

.program-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    border: 2px solid transparent;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    text-decoration: none;
    color: var(--text);
}

.program-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-light);
    color: var(--text);
}

.program-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
}

.program-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

.program-card p {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
    flex: 1;
}

.program-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-muted);
}

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

/* ---- BREADCRUMB ---- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.breadcrumb a { color: var(--primary); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: var(--border); }
.breadcrumb .current { color: var(--text); font-weight: 600; }

/* ---- FILTER BAR ---- */
.filter-bar {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 22px;
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 24px;
}

.filter-bar label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.filter-bar select,
.filter-bar input[type="text"] {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 0.875rem;
    color: var(--text);
    background: #fff;
    outline: none;
    transition: border-color 0.2s;
    min-width: 160px;
}

.filter-bar select:focus,
.filter-bar input[type="text"]:focus {
    border-color: var(--primary-light);
}

/* ---- PAPERS TABLE ---- */
.papers-table-wrap {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.papers-table thead {
    background: var(--primary);
    color: #fff;
}

.papers-table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.papers-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    vertical-align: middle;
}

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

.papers-table tbody tr:hover { background: #f6f9fc; }

.course-tag {
    display: inline-block;
    background: #e8f0fc;
    color: var(--primary);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.78rem;
    font-weight: 600;
}

.year-badge {
    background: #fff3e0;
    color: #e67e22;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.78rem;
    font-weight: 600;
}

.sem-badge {
    background: #e8f5e9;
    color: #27ae60;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.78rem;
    font-weight: 600;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--success);
    color: #fff;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
}

.btn-download:hover {
    background: #219a52;
    color: #fff;
    transform: translateY(-1px);
}

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .fa {
    font-size: 3.5rem;
    margin-bottom: 16px;
    color: var(--border);
}

.empty-state h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--text-muted);
}

/* ---- ALERTS ---- */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.9rem;
}

.alert-success { background: #d4edda; color: #155724; border-left: 4px solid var(--success); }
.alert-danger   { background: #f8d7da; color: #721c24; border-left: 4px solid var(--danger); }
.alert-warning  { background: #fff3cd; color: #856404; border-left: 4px solid var(--warning); }
.alert-info     { background: #d1ecf1; color: #0c5460; border-left: 4px solid var(--info); }

/* ---- FORMS ---- */
.form-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
}

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

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 7px;
}

.form-group label .required { color: var(--danger); margin-left: 3px; }

.form-control {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.9rem;
    color: var(--text);
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(42,90,140,0.12);
}

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

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    text-decoration: none;
}

.btn:active { transform: translateY(1px); }

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

.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
    box-shadow: 0 4px 12px rgba(26,58,92,0.3);
}

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

.btn-success:hover { background: #219a52; color: #fff; }

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

.btn-danger:hover { background: #a93226; color: #fff; }

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

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

.btn-lg { padding: 13px 30px; font-size: 1rem; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-block { width: 100%; justify-content: center; }

/* ---- LOGIN PAGE ---- */
.login-page {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.login-box {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 8px 40px rgba(0,0,0,0.25);
    padding: 44px 40px;
    width: 100%;
    max-width: 420px;
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo .fa {
    font-size: 3rem;
    color: var(--primary);
}

.login-logo h2 {
    font-size: 1.4rem;
    color: var(--primary);
    margin-top: 10px;
}

.login-logo p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.input-with-icon {
    position: relative;
}

.input-with-icon .fa {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.input-with-icon .form-control {
    padding-left: 38px;
}

.ad-note {
    background: #e8f0fc;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 0.82rem;
    color: var(--primary);
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

/* ---- STAFF DASHBOARD ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    flex-shrink: 0;
}

.stat-icon.blue    { background: var(--primary); }
.stat-icon.green   { background: var(--success); }
.stat-icon.orange  { background: var(--accent); }
.stat-icon.info    { background: var(--info); }

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ---- FILE UPLOAD DROP ZONE ---- */
.file-drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
    border-color: var(--primary-light);
    background: #f0f6ff;
}

.file-drop-zone .fa {
    font-size: 2.5rem;
    color: var(--border);
    margin-bottom: 12px;
    display: block;
}

.file-drop-zone p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.file-drop-zone .browse-link {
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
}

.file-selected-info {
    display: none;
    margin-top: 14px;
    background: #e8f5e9;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.85rem;
    color: var(--success);
    align-items: center;
    gap: 10px;
}

.file-selected-info.visible { display: flex; }

/* ---- PAPER ACTIONS (staff) ---- */
.action-btns {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ---- PAGE TITLE BAR ---- */
.page-titlebar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 22px 0;
    margin-bottom: 32px;
}

.page-titlebar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

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

.page-titlebar p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ---- PROGRAM HEADER (program.php) ---- */
.program-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    padding: 36px 0;
    margin-bottom: 32px;
}

.program-header-inner {
    display: flex;
    align-items: center;
    gap: 20px;
}

.program-header-icon {
    width: 68px;
    height: 68px;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
}

.program-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

.program-header p {
    font-size: 0.9rem;
    color: #b8d4ec;
    margin-top: 4px;
}

/* ---- FOOTER ---- */
.site-footer {
    background: var(--primary-dark);
    color: #a8c0d8;
    padding: 24px 0;
    margin-top: auto;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.85rem;
}

.footer-links {
    display: flex;
    gap: 10px;
    align-items: center;
}

.footer-links a { color: #a8c0d8; }
.footer-links a:hover { color: #fff; }

/* ---- CONFIRM MODAL ---- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

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

.modal-box {
    background: #fff;
    border-radius: var(--radius);
    padding: 32px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 16px 48px rgba(0,0,0,0.25);
}

.modal-box h3 { color: var(--primary); margin-bottom: 12px; }
.modal-box p  { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 22px; }

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ---- PAGINATION ---- */
.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    padding: 24px 0 8px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    border: 1.5px solid var(--border);
    background: #fff;
    color: var(--text);
    transition: background 0.2s, color 0.2s;
}

.pagination a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }
.pagination .disabled { color: var(--border); pointer-events: none; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .hero h1 { font-size: 1.7rem; }
    .header-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
    .site-nav { gap: 4px; }
    .site-nav a { padding: 6px 10px; font-size: 0.82rem; }
    .programs-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .papers-table th:nth-child(3),
    .papers-table td:nth-child(3) { display: none; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .page-titlebar .container { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
    .login-box { padding: 28px 20px; }
    .stats-grid { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; align-items: flex-start; }
    .papers-table th:nth-child(4),
    .papers-table td:nth-child(4) { display: none; }
}
