
/* =========================================================
   CampusTrack
   Main Stylesheet
   ========================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", Arial, sans-serif;
    background: #f5f7fa;
    color: #172033;
    min-height: 100vh;
}

/* =========================================================
   HEADER
   ========================================================= */

.navbar,
.main-header {
    width: 100%;
    background: #101827;
    color: white;
    border-bottom: 1px solid #1f2b3d;
}

.navbar {
    min-height: 82px;
    padding: 0 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
}

.main-header {
    padding: 18px 42px;
}

.header-container {
    max-width: 1400px;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

/* =========================================================
   LOGO
   ========================================================= */

.logo {
    display: flex;
    align-items: center;
    gap: 13px;
    flex-shrink: 0;
}

.logo-mark {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #d4a72c;
    color: #101827;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    letter-spacing: 1px;
}

.logo h1,
.header-container h1 {
    font-size: 23px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.logo span:not(.logo-mark) {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: #9ca8ba;
}

/* =========================================================
   SYSTEM STATUS
   ========================================================= */

.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #b7c1cf;
    white-space: nowrap;
}

.status-dot {
    width: 9px;
    height: 9px;
    background: #37c978;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(55, 201, 120, 0.10);
}

/* =========================================================
   NAVIGATION / TABS
   ========================================================= */

nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.navbar nav {
    flex: 1;
    justify-content: center;
}

nav a {
    text-decoration: none;
    color: #b8c1cf;
    padding: 9px 13px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 500;
    transition: 0.2s ease;
    white-space: nowrap;
}

nav a:hover {
    color: white;
    background: #1b2638;
}

nav a.active {
    color: #101827;
    background: #d4a72c;
    font-weight: 700;
}

/* =========================================================
   MAIN CONTAINER
   ========================================================= */

.container {
    width: min(1400px, calc(100% - 48px));
    margin: 0 auto;
    padding: 34px 0 50px;
}

/* =========================================================
   HERO
   ========================================================= */

.hero {
    min-height: 220px;
    background: linear-gradient(
        135deg,
        #111c2e 0%,
        #17263b 100%
    );
    border-radius: 18px;
    padding: 38px 44px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    margin-bottom: 28px;
}

.hero::after {
    content: "";
    position: absolute;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    border: 1px solid rgba(212, 167, 44, 0.14);
    right: -80px;
    top: -100px;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.eyebrow {
    color: #d4a72c;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.8px;
    margin-bottom: 10px;
}

.hero h2 {
    font-size: 40px;
    line-height: 1.1;
    margin-bottom: 12px;
    font-weight: 750;
}

.hero-description {
    max-width: 560px;
    color: #b6c0cf;
    line-height: 1.7;
    font-size: 15px;
}

.hero-logo {
    position: relative;
    z-index: 2;
    width: 110px;
    height: 110px;
    border: 1px solid rgba(212, 167, 44, 0.5);
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d4a72c;
    font-size: 34px;
    font-weight: 800;
    letter-spacing: 2px;
    background: rgba(255, 255, 255, 0.025);
}

/* =========================================================
   DASHBOARD STATS
   ========================================================= */

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    background: white;
    border: 1px solid #e5e9ef;
    border-radius: 14px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 5px 18px rgba(16, 24, 39, 0.05);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 11px;
    background: #f5ecd0;
    color: #9a7518;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
}

.stat-card p {
    color: #6d7786;
    font-size: 13px;
    margin-bottom: 4px;
}

.stat-card h3 {
    font-size: 25px;
    color: #182235;
}

/* =========================================================
   DASHBOARD FEATURES
   ========================================================= */

.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.feature-card {
    background: white;
    border: 1px solid #e5e9ef;
    border-radius: 15px;
    padding: 26px;
    box-shadow: 0 5px 18px rgba(16, 24, 39, 0.04);
}

.feature-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5ecd0;
    border-radius: 11px;
    margin-bottom: 15px;
    font-size: 21px;
}

.feature-card h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.feature-card p {
    color: #6d7786;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* =========================================================
   BUTTONS
   ========================================================= */

.dashboard-button,
.add-student-button,
.save-button,
.cancel-button,
.edit-button,
.delete-button {
    border: none;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: 0.2s ease;
}

.dashboard-button {
    display: inline-block;
    background: #101827;
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}

.dashboard-button:hover {
    background: #1d2b40;
}

.add-student-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #d4a72c;
    color: #101827;
    padding: 11px 17px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.add-student-button:hover {
    background: #e2b83c;
    transform: translateY(-1px);
}

.edit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #edf2f7;
    color: #26364c;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}

.edit-button:hover {
    background: #dfe6ef;
}

.delete-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff0f0;
    color: #c73a3a;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}

.delete-button:hover:not(:disabled) {
    background: #ffdcdc;
}

.delete-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* =========================================================
   PAGE HEADER
   ========================================================= */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 29px;
    color: #172033;
    margin-bottom: 5px;
}

.page-header p {
    color: #6d7786;
    font-size: 14px;
}

/* =========================================================
   STUDENTS / DEPARTMENTS SECTION
   ========================================================= */

.students-section {
    background: white;
    border: 1px solid #e3e7ed;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 5px 18px rgba(16, 24, 39, 0.04);
}

.students-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.students-header h3 {
    font-size: 20px;
    margin-bottom: 5px;
}

.students-header p {
    color: #6d7786;
    font-size: 14px;
}

.students-header strong {
    color: #172033;
}

/* =========================================================
   TABLE CONTAINERS
   ========================================================= */

.students-table-container,
.table-container {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #e4e8ee;
    border-radius: 11px;
}

/* =========================================================
   TABLES
   ========================================================= */

.students-table,
.table-container table {
    width: 100%;
    border-collapse: collapse;
    min-width: 850px;
}

.students-table th,
.table-container th {
    background: #f7f8fa;
    color: #596576;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 14px 15px;
    text-align: left;
    border-bottom: 1px solid #e2e6eb;
}

.students-table td,
.table-container td {
    padding: 15px;
    border-bottom: 1px solid #edf0f3;
    color: #2e394a;
    font-size: 14px;
    vertical-align: middle;
}

.students-table tbody tr:last-child td,
.table-container tbody tr:last-child td {
    border-bottom: none;
}

.students-table tbody tr:hover,
.table-container tbody tr:hover {
    background: #fafbfd;
}

.students-table td strong,
.table-container td strong {
    color: #172033;
    font-weight: 700;
}

.students-table small,
.table-container small {
    color: #7b8796;
    font-size: 12px;
}

/* =========================================================
   STATUS
   ========================================================= */

.status-badge,
.status-active,
.status-inactive {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.status-badge.active,
.status-active {
    background: #e6f7ed;
    color: #197342;
}

.status-badge.inactive,
.status-inactive {
    background: #fbeaea;
    color: #b33434;
}

/* =========================================================
   ACTIONS
   ========================================================= */

.student-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.student-actions form {
    margin: 0;
}

/* =========================================================
   EMPTY STATE
   ========================================================= */

.empty-state {
    text-align: center;
    background: white;
    border: 1px dashed #cfd6df;
    border-radius: 14px;
    padding: 55px 25px;
    color: #5f6b7a;
}

.empty-state h3 {
    color: #172033;
    font-size: 21px;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 20px;
}

.empty-state a {
    display: inline-flex;
    background: #d4a72c;
    color: #101827;
    padding: 10px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
}

.empty-state a:hover {
    background: #e2b83c;
}

/* =========================================================
   FORMS
   ========================================================= */

.form-container {
    max-width: 850px;
    margin: 0 auto;
    background: white;
    border: 1px solid #e3e7ed;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 5px 18px rgba(16, 24, 39, 0.04);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    color: #283549;
    font-size: 14px;
    font-weight: 650;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid #d6dce4;
    border-radius: 8px;
    background: white;
    color: #172033;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #d4a72c;
    box-shadow: 0 0 0 3px rgba(212, 167, 44, 0.12);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #9aa4b2;
}

/* =========================================================
   FORM ACTIONS
   ========================================================= */

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 28px;
}

.save-button {
    background: #101827;
    color: white;
    padding: 11px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
}

.save-button:hover {
    background: #1c2a3e;
}

.cancel-button {
    background: #eef1f5;
    color: #344054;
    padding: 11px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
}

.cancel-button:hover {
    background: #e2e6ec;
}

/* =========================================================
   FOOTER
   ========================================================= */

footer {
    text-align: center;
    padding: 25px 20px 35px;
    color: #7c8795;
    font-size: 12px;
}

/* =========================================================
   LECTURES
   ========================================================= */

.table-container table {
    min-width: 1050px;
}

.table-container th,
.table-container td {
    white-space: nowrap;
}

.table-container td:nth-child(2) {
    min-width: 190px;
}

.table-container td:nth-child(3),
.table-container td:nth-child(4) {
    min-width: 150px;
}

.table-container td:last-child {
    min-width: 145px;
}

.table-container td:last-child .edit-button,
.table-container td:last-child .delete-button {
    margin-right: 5px;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1100px) {

    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .features {
        grid-template-columns: 1fr;
    }

    .navbar {
        padding: 0 25px;
    }

    .main-header {
        padding: 18px 25px;
    }

    .container {
        width: min(100% - 32px, 1400px);
    }
}

@media (max-width: 900px) {

    .navbar {
        flex-wrap: wrap;
        min-height: auto;
        padding-top: 15px;
        padding-bottom: 15px;
    }

    .navbar nav {
        order: 3;
        width: 100%;
        flex-basis: 100%;
        justify-content: flex-start;
    }

    .system-status {
        margin-left: auto;
    }

    .header-container {
        flex-wrap: wrap;
    }
}

@media (max-width: 800px) {

    .navbar,
    .header-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .navbar {
        padding: 20px;
        gap: 15px;
    }

    .main-header {
        padding: 20px;
    }

    .header-container {
        gap: 18px;
    }

    nav {
        width: 100%;
        justify-content: flex-start;
    }

    nav a {
        font-size: 13px;
    }

    .hero {
        padding: 30px;
    }

    .hero h2 {
        font-size: 32px;
    }

    .hero-logo {
        width: 85px;
        height: 85px;
        font-size: 27px;
    }

    .students-header,
    .page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .add-student-button {
        width: 100%;
    }
}

@media (max-width: 600px) {

    .container {
        width: calc(100% - 20px);
        padding-top: 20px;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .hero {
        min-height: 190px;
        padding: 25px;
    }

    .hero-logo {
        display: none;
    }

    .hero h2 {
        font-size: 28px;
    }

    .hero-description {
        font-size: 14px;
    }

    .students-section {
        padding: 15px;
    }

    .form-container {
        padding: 20px;
    }

    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .save-button,
    .cancel-button {
        width: 100%;
        text-align: center;
    }

    nav {
        gap: 5px;
    }

    nav a {
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* =========================================================
   ADMIN AUTHENTICATION
   ========================================================= */
.logout-form { display: inline-flex; margin: 0; }
.logout-link { border: 0; background: transparent; color: #d4a72c; padding: 9px 13px; border-radius: 7px; cursor: pointer; font: inherit; white-space: nowrap; }
.logout-link:hover { color: white; background: #1b2638; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #101827; }
.login-card { width: min(100%, 430px); background: white; border-radius: 16px; padding: 34px; box-shadow: 0 18px 60px rgba(0,0,0,.25); }
.login-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 32px; }
.login-brand h1 { color: #172033; font-size: 22px; }
.login-brand p, .login-intro { color: #6d7786; font-size: 14px; margin-top: 4px; }
.login-card h2 { color: #172033; font-size: 25px; margin-bottom: 7px; }
.login-card form { margin-top: 24px; }
.login-submit { width: 100%; padding: 12px; border: 0; border-radius: 8px; background: #d4a72c; color: #101827; font: inherit; font-weight: 700; cursor: pointer; }
.login-submit:hover { background: #e2b83c; }
.login-error { margin-top: 18px; padding: 11px 13px; color: #a52b2b; background: #fff0f0; border-radius: 8px; font-size: 14px; }

/* =========================================================
   STUDENT QR ATTENDANCE PAGE
   ========================================================= */
.student-page { min-height: 100vh; background: #f5f7fa; }
.student-header { background: #101827; border-bottom: 1px solid #1f2b3d; padding: 16px max(24px, calc((100% - 760px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.student-brand { display: flex; align-items: center; gap: 12px; }
.student-brand h1 { color: #fff; font-size: 20px; }
.student-brand p { color: #9ca8ba; font-size: 12px; margin-top: 3px; }
.student-main { width: min(100% - 32px, 620px); margin: 0 auto; padding: 42px 0 30px; }
.student-welcome { margin-bottom: 22px; }
.student-eyebrow { color: #9a7518; font-size: 11px; font-weight: 800; letter-spacing: 1.5px; }
.student-welcome h2 { color: #172033; font-size: clamp(27px, 6vw, 34px); margin: 8px 0; }
.student-welcome p, .student-form-heading p { color: #6d7786; line-height: 1.6; font-size: 14px; }
.student-session-card, .student-form-card, .student-result-card { background: #fff; border: 1px solid #e3e7ed; border-radius: 15px; padding: 23px; box-shadow: 0 5px 18px rgba(16, 24, 39, .04); margin-bottom: 16px; }
.student-session-status { display: flex; align-items: center; gap: 8px; color: #197342; font-size: 13px; font-weight: 700; margin-bottom: 20px; }
.student-session-status span { width: 8px; height: 8px; border-radius: 50%; background: #37c978; }
.student-session-details { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.student-session-details > div { min-width: 0; }
.student-detail-label { display: block; color: #818b99; font-size: 10px; font-weight: 800; letter-spacing: 1px; margin-bottom: 7px; }
.student-session-details strong { display: block; color: #172033; font-size: 15px; overflow-wrap: anywhere; }
.student-session-details small { display: block; color: #7b8796; margin-top: 4px; }
.student-form-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.student-form-heading h2 { color: #172033; font-size: 19px; margin-bottom: 4px; }
.student-form-icon { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border-radius: 11px; background: #f5ecd0; color: #9a7518; font-size: 13px; font-weight: 800; }
.student-submit { width: 100%; padding: 13px 18px; border: 0; border-radius: 8px; background: #101827; color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.student-submit:hover { background: #1d2b40; }
.student-privacy-note { margin-top: 15px; color: #818b99; font-size: 12px; line-height: 1.5; }
.student-alert { padding: 15px 17px; border: 1px solid #f2caca; border-radius: 10px; background: #fff0f0; color: #a52b2b; margin-bottom: 16px; }
.student-alert p { margin-top: 5px; font-size: 14px; line-height: 1.5; }
.student-result-card { text-align: center; padding: 32px 24px; }
.student-result-icon { width: 54px; height: 54px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 50%; background: #e6f7ed; color: #197342; font-size: 28px; font-weight: 800; }
.student-result-card h2 { color: #172033; font-size: 22px; margin: 8px 0; overflow-wrap: anywhere; }
.student-result-card p { color: #6d7786; font-size: 14px; line-height: 1.7; max-width: 430px; margin: 0 auto; }
.student-action-link { display: inline-block; margin-top: 20px; color: #7c5d0d; font-size: 14px; font-weight: 700; text-decoration: none; }
.student-action-link:hover { text-decoration: underline; }
.student-footer { padding: 20px; color: #8a94a2; font-size: 12px; text-align: center; }
.language-toggle { flex: 0 0 auto; padding: 8px 12px; border: 1px solid #465165; border-radius: 8px; color: #fff; font-size: 13px; text-decoration: none; }
.language-toggle:hover { background: #1b2638; }
.student-page[dir="rtl"] .student-welcome, .student-page[dir="rtl"] .student-form-heading, .student-page[dir="rtl"] .student-session-details, .student-page[dir="rtl"] .install-hint { text-align: right; }
.student-page[dir="rtl"] .student-session-status { flex-direction: row-reverse; justify-content: flex-end; }
.student-page[dir="rtl"] .student-form-heading { flex-direction: row-reverse; }
.student-page[dir="rtl"] .student-session-details strong { direction: rtl; }
.student-page[dir="rtl"] .student-result-card { text-align: center; }
.student-page[dir="rtl"] .student-brand > div { text-align: right; }
.student-page[dir="rtl"] .student-brand p { direction: ltr; text-align: right; }
.install-hint { margin-top: 20px; padding: 4px 2px; }
.install-hint h2 { color: #172033; font-size: 16px; margin-bottom: 10px; }
.install-hint p { color: #6d7786; font-size: 13px; line-height: 1.7; margin: 5px 0; }
.logo-mark { background: #fff url("/static/icons/campustrack-192.png") center / cover no-repeat; color: transparent; font-size: 0; }
.logo h1, .header-container h1, .login-brand h1, .student-brand h1 { direction: rtl; letter-spacing: 0; }
.header-container h1::after, .login-brand h1::after { content: "The Higher Institute for Advanced Studies"; display: block; margin-top: 3px; color: #9ca8ba; font-size: 11px; font-weight: 400; direction: ltr; letter-spacing: 0; }
.logo span:not(.logo-mark) { direction: ltr; letter-spacing: 0; }
@media (max-width: 500px) {
    .student-header { padding: 14px 18px; }
    .student-brand { gap: 8px; }
    .student-brand h1 { font-size: 16px; }
    .student-brand p { font-size: 10px; }
    .language-toggle { padding: 7px 9px; font-size: 12px; }
    .student-main { width: calc(100% - 24px); padding-top: 30px; }
    .student-session-card, .student-form-card, .student-result-card { padding: 19px; }
    .student-session-details { grid-template-columns: 1fr; gap: 15px; }
}
