/* ===============================
   CSS Variables
   =============================== */
:root {
    --primary-color: #0073e6;
    --primary-dark: #005bb5;
    --primary-darker: #005792;
    --secondary-color: #e0f7fa;
    --success-color: green;
    --error-color: red;
    --danger-color: #e74c3c;
    --danger-dark: #c0392b;
    --text-color: #333;
    --light-gray: #f8f9fa;
    --border-color: #cce4f7;
    --border-radius: 8px;
    --box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    --button-spacing: 10px;
}

/* ===============================
   General Reset & Typography
   =============================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, var(--secondary-color), #ffffff);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 70px 20px 20px;
    min-height: 100vh;
    margin: 0;
}

/* ===============================
   Button Spacing & Layout
   =============================== */
.button-group {
    display: flex;
    gap: var(--button-spacing);
    margin: 15px 0;
}

button,
.button {
    margin: var(--button-spacing) 0;
}

/* ===============================
   Container Wrapper
   =============================== */
.main-wrapper {
    width: 100%;
    max-width: 500px;
}

/* ===============================
   Container
   =============================== */
    .container {
        max-width: 960px;
        margin: 30px auto;
        padding: 0 20px;
    }

/* ===============================
   Card Styling
   =============================== */
.card {
    background-color: #ffffff;
    padding: 30px 25px;
    border-radius: 15px;
    box-shadow: var(--box-shadow);
    text-align: center;
    margin-top: 30px;
}

.card h2 {
    color: var(--primary-darker);
    margin-bottom: 20px;
    font-weight: 600;
}

/* ===============================
   Logo & School Info
   =============================== */
.logo {
    width: 80px;
    margin-bottom: 15px;
}

.school-name {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-darker);
    margin-bottom: 5px;
}

.location {
    font-size: 16px;
    color: var(--text-color);
    margin-bottom: 8px;
}

.exam-title {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 25px;
    color: var(--primary-color);
}

/* ===============================
   Form Elements
   =============================== */
.result-form label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    text-align: left;
}

input[type="text"],
input[type="password"],
input[type="file"],
textarea,
select,
.result-form input[type="text"],
.result-form select {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    margin-bottom: 15px;
    font-family: 'Poppins', sans-serif;
}

textarea {
    font-size: 15px;
    font-family: monospace;
}

/* ===============================
   Buttons
   =============================== */
button,
a.logout-link,
.result-form button,
.back-button,
.refresh-btn,
.save-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: var(--border-radius);
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: inline-block;
    text-decoration: none;
    margin: var(--button-spacing) 0;
}

button:hover,
a.logout-link:hover,
.result-form button:hover,
.back-button:hover,
.refresh-btn:hover,
.save-btn:hover {
    background-color: var(--primary-dark);
}

.refresh-btn {
    padding: 8px 15px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Modal Buttons */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--button-spacing);
    margin-top: 20px;
}

.cancel-btn {
    background: #f1f1f1;
    border: 1px solid #ddd;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    margin: 0;
}

.confirm-delete-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    margin: 0;
}

.confirm-delete-btn:hover {
    background: var(--danger-dark);
}

/* ===============================
   Result Display
   =============================== */
.result-card {
    padding-top: 25px;
}

.result-box {
    background-color: #f0f9f5;
    border: 2px solid #d6eadf;
    padding: 20px;
    margin: 20px 0;
    border-radius: 10px;
    font-size: 16px;
    text-align: left;
}

.result-box p {
    margin-bottom: 10px;
}

.passed {
    color: var(--success-color);
    font-weight: 600;
}

.failed {
    color: var(--error-color);
    font-weight: 600;
}

.not-found {
    color: #e63946;
    font-size: 16px;
    margin-top: 20px;
}

/* ===============================
   Messages & Status
   =============================== */
.success-msg {
    color: var(--success-color);
    font-weight: 500;
    margin: 15px 0;
}

.error-msg {
    color: var(--error-color);
    font-weight: 500;
    margin: 15px 0;
}

/* ===============================
   Header/Navbar Styling
   =============================== */
.navbar {
    background-color: white;
    padding: 15px 0;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 999;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 24px;
    color: var(--text-color);
    text-decoration: none;
}

.brand span {
    color: var(--primary-color);
}

.header-logo {
    height: 60px;
    margin-right: 30px;
    vertical-align: middle;
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    margin-left: 20px;
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    padding: 10px 15px;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    margin: 0;
}

.nav-link i {
    margin-right: 8px;
    font-size: 18px;
}

.nav-link:hover {
    color: var(--primary-color);
    background-color: var(--light-gray);
}

.nav-link.active {
    color: var(--primary-color);
}

/* ===============================
   Dashboard & Tables
   =============================== */
.table-wrapper {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-top: 20px;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.table-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

#resultsTable {
    width: 100% !important;
}

.actions {
    display: flex;
    gap: var(--button-spacing);
}

.edit-btn, .delete-btn {
    background: none;
    border: none;
    color: #555;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    margin: 0;
}

.edit-btn:hover {
    color: var(--primary-color);
}

.delete-btn:hover {
    color: var(--danger-color);
}

/* ===============================
   Modal Styles
   =============================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 20px;
    border-radius: 8px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.close-modal {
    float: right;
    font-size: 24px;
    cursor: pointer;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.form-group textarea {
    min-height: 80px;
}

/* ===============================
   DataTables Overrides
   =============================== */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.3em 0.8em;
    margin-left: 2px;
    border-radius: 4px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary-color);
    color: white !important;
    border: 1px solid var(--primary-color);
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--primary-dark);
    color: white !important;
    border: 1px solid var(--primary-dark);
}

/* ===============================
   Footer
   =============================== */
.footer {
    margin-top: 25px;
    font-size: 14px;
    color: #555;
    text-align: center;
    font-weight: 400;
    opacity: 0.9;
}

/* ===============================
   Responsive Design
   =============================== */
@media screen and (max-width: 500px) {
    body {
        padding: 10px;
        align-items: flex-start;
        padding-top: 120px;
    }

    .main-wrapper {
        max-width: 100%;
    }

    .card {
        margin-top: 60px;
        padding: 20px 15px;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    }

    .logo {
        width: 60px;
    }

    .school-name {
        font-size: 20px;
    }

    .location {
        font-size: 14px;
    }

    .exam-title {
        font-size: 15px;
        margin-bottom: 20px;
    }

    .result-form label {
        font-size: 14px;
    }

    .result-form input[type="text"] {
        font-size: 15px;
        padding: 8px;
    }

    .result-form button {
        font-size: 15px;
        padding: 9px 16px;
    }

    .button-group {
        flex-direction: column;
        gap: 8px;
    }
}

@media screen and (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-menu {
        margin-top: 15px;
        flex-direction: column;
        width: 100%;
    }

    .nav-item {
        margin-left: 0;
        margin-bottom: 5px;
    }

    .nav-link {
        width: 100%;
        padding: 10px;
    }

    .table-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}