/* ==========================================================================
   Egyptian Ministry of Education - High School Results Portal Stylesheet
   ========================================================================== */

:root {
    --primary-color: #2b76a7;       /* Blue for main results card */
    --purple-color: #622868;        /* Purple for personal info card */
    --green-color: #1e824c;         /* Green for non-added subjects & status */
    --footer-bg: #446d51;            /* Ministry Footer Dark Green */
    --body-bg: #f8f9fa;
    --text-color: #333333;
    --border-color: #e0e0e0;
    --card-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

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

body {
    font-family: 'Cairo', sans-serif, system-ui;
    background-color: var(--body-bg);
    color: var(--text-color);
    direction: rtl;
    text-align: right;
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 15px;
}

/* ======= Header ======= */
#main-header {
    background-color: #ffffff;
    border-bottom: 2px solid #e9ecef;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 10px 0;
}

.header-container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-link {
    text-decoration: none;
    color: #495057;
    font-weight: 700;
    font-size: 1.05rem;
    transition: color 0.2s ease;
}

.nav-link:hover, .nav-link.active {
    color: var(--green-color);
}

.logo-box {
    display: flex;
    align-items: center;
}

.logo-img {
    height: 75px;
    max-width: 100%;
    object-fit: contain;
}

/* ======= Main Content ======= */
.main-wrapper {
    min-height: calc(100vh - 160px);
    padding-bottom: 40px;
}

/* ======= Search Section ======= */
.search-section {
    background-color: #ffffff;
    padding: 30px 0 25px 0;
    border-bottom: 1px solid #eef0f2;
    text-align: center;
}

.nategalabel {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--green-color);
    margin-bottom: 20px;
}

.search-form {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 15px;
    max-width: 700px;
    margin: 0 auto;
}

.floating-label {
    position: relative;
    min-width: 220px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 1rem;
    font-family: 'Cairo', sans-serif;
    border: 1px solid #ced4da;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-color: #ffffff;
}

.form-control:focus {
    border-color: var(--green-color);
    box-shadow: 0 0 0 3px rgba(30, 130, 76, 0.15);
}

.btn {
    padding: 10px 24px;
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.btn-success:hover {
    background-color: #17683c;
    box-shadow: 0 4px 10px rgba(30, 130, 76, 0.3);
}

.btn-secondary {
    background-color: #6c757d;
    color: #ffffff;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-warning {
    background-color: #f39c12;
    color: #ffffff;
}

.btn-warning:hover {
    background-color: #d68910;
}

.btn-danger {
    background-color: #d9534f;
    color: #ffffff;
}

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

.error-msg {
    color: #d9534f;
    font-weight: 700;
    margin-top: 12px;
}

/* ======= Hero Banner ======= */
.hero-banner {
    padding: 30px 15px;
}

.banner-card {
    background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('https://g12.emis.gov.eg/img/moe.jpg') center/cover no-repeat;
    min-height: 220px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    text-align: center;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.12);
}

.banner-content h2 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 10px;
}

.banner-content p {
    font-size: 1.2rem;
    font-weight: 600;
    opacity: 0.95;
}

/* ======= Result Section ======= */
.result-section {
    padding: 30px 0;
    animation: fadeIn 0.4s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.status-wrapper {
    text-align: center;
    margin-bottom: 35px;
}

.status-title {
    font-size: 2.8rem;
    font-weight: 900;
    color: var(--green-color);
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}

.status-underline {
    width: 65px;
    height: 4px;
    background-color: var(--green-color);
    margin: 0 auto;
    border-radius: 2px;
}

/* Result Grid (2 Columns Layout matching Official Site) */
.result-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 25px;
}

@media (max-width: 900px) {
    .result-grid {
        grid-template-columns: 1fr;
    }
}

/* Card Styling */
.card {
    background-color: #ffffff;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.card-header {
    padding: 12px 20px;
    color: #ffffff;
    font-size: 1.35rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-purple {
    background-color: var(--purple-color);
}

.header-blue {
    background-color: var(--primary-color);
}

.header-green {
    background-color: var(--green-color);
}

.p-0 {
    padding: 0 !important;
}

.mt-4 {
    margin-top: 25px !important;
}

.mb-4 {
    margin-bottom: 25px !important;
}

/* Tables */
.info-table, .marks-table {
    width: 100%;
    border-collapse: collapse;
}

.info-table tr, .marks-table tr {
    border-bottom: 1px solid #eeeeee;
}

.info-table tr:nth-child(even), .marks-table tbody tr:nth-child(even) {
    background-color: #fcfcfc;
}

.info-table tr:nth-child(odd), .marks-table tbody tr:nth-child(odd) {
    background-color: #efefef;
}

.info-table td, .marks-table td {
    padding: 14px 20px;
    font-size: 1.1rem;
    font-weight: 700;
}

.info-table .label-td {
    color: #333333;
    width: 35%;
    border-left: 1px solid #e8e8e8;
}

.info-table .value-td {
    color: #495057;
}

.marks-table td:last-child {
    text-align: left;
    padding-left: 30px;
    font-weight: 800;
}

.failed-degree-badge {
    background-color: #fcdad7;
    color: #e74c3c;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.05rem;
    box-shadow: 0 1px 3px rgba(231, 76, 60, 0.2);
}

.total-row {
    background-color: #ffffff !important;
}

.total-row td {
    font-size: 1.3rem !important;
    font-weight: 900 !important;
    padding: 16px 20px !important;
}

.total-label {
    text-align: center;
}

.total-value {
    text-align: left;
    padding-left: 30px !important;
}

/* ======= Footer ======= */
#footer {
    background-color: var(--footer-bg);
    color: #ffffff;
    padding: 18px 0;
    text-align: center;
}

.copyright {
    cursor: pointer;
    user-select: none;
    display: inline-block;
    transition: opacity 0.2s ease;
}

.copyright:hover {
    opacity: 0.9;
}

.copyright p {
    font-size: 1.05rem;
    margin: 0;
}

/* ======= Modal Overlays ======= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.modal-card {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.auth-card {
    max-width: 440px;
}

.admin-card {
    max-width: 850px;
}

.modal-header {
    background-color: #2c3e50;
    color: #ffffff;
    padding: 16px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-btn {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
}

.close-btn:hover {
    opacity: 1;
}

.modal-body {
    padding: 22px;
    overflow-y: auto;
}

.modal-subtitle {
    color: #495057;
    font-weight: 600;
}

.error-text {
    color: #d9534f;
    font-weight: 700;
    margin-top: 10px;
    font-size: 0.95rem;
}

.modal-footer {
    padding: 15px 22px;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ======= Admin Modal Components ======= */
.live-stats-bar {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #ffffff;
    padding: 15px 20px;
    border-radius: 8px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 22px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.stat-item {
    font-size: 1.15rem;
    font-weight: 700;
}

.stat-val {
    font-size: 1.4rem;
    font-weight: 900;
    color: #ffeaa7;
    margin: 0 4px;
}

.percentage-badge {
    background-color: #27ae60;
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 1.3rem;
}

.admin-section {
    margin-bottom: 22px;
    border-bottom: 1px dashed #e0e0e0;
    padding-bottom: 18px;
}

.admin-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.section-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #2c3e50;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.highlight-box {
    background-color: #fffde7;
    border: 1px solid #ffe082;
    border-radius: 8px;
    padding: 16px;
}

.distribute-controls {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    margin-top: 10px;
}

.flex-grow-1 {
    flex-grow: 1;
}

.help-text {
    display: block;
    margin-top: 8px;
    color: #795548;
    font-weight: 600;
}

.admin-edit-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.admin-edit-table th, .admin-edit-table td {
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    text-align: center;
}

.admin-edit-table th {
    background-color: #f1f3f5;
    font-weight: 800;
    color: #495057;
}

.admin-edit-table input[type="number"] {
    width: 100px;
    text-align: center;
    font-weight: 800;
    font-size: 1.05rem;
}

.text-center {
    text-align: center !important;
}

.table-responsive {
    overflow-x: auto;
}
