/* ============================================================
   Hayward Air Rally Scholarship Portal — Stylesheet
   ============================================================ */

/* --- CSS Custom Properties --------------------------------- */
:root {
    --har-navy:       #0b1d3a;
    --har-navy-light: #132b52;
    --har-sky:        #2e86de;
    --har-sky-light:  #54a0ff;
    --har-gold:       #f0a500;
    --har-gold-light: #f5c542;
    --har-white:      #fafbfc;
    --har-gray-50:    #f8f9fa;
    --har-gray-100:   #e9ecef;
    --har-gray-200:   #dee2e6;
    --har-gray-600:   #6c757d;
    --har-gray-800:   #343a40;
    --har-success:    #27ae60;
    --har-danger:     #e74c3c;

    --font-display: 'Outfit', sans-serif;
    --font-body:    'Source Serif 4', Georgia, serif;
}

/* --- Base -------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    color: var(--har-gray-800);
    background: var(--har-white);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
}

h1, h2, h3, h4, h5, h6,
.navbar-brand, .btn, label,
.form-label, th, .modal-title,
.section-title, .card-title {
    font-family: var(--font-display);
}

/* --- Navbar ------------------------------------------------ */
.bg-har-navy {
    background: linear-gradient(135deg, var(--har-navy) 0%, var(--har-navy-light) 100%) !important;
}

.navbar-brand {
    font-weight: 600;
    letter-spacing: 0.02em;
    font-size: 1.15rem;
}

.nav-link-login {
    opacity: 0.5;
    transition: opacity 0.2s;
}
.nav-link-login:hover { opacity: 1; }

/* --- Hero Section ------------------------------------------ */
.hero-section {
    background: linear-gradient(165deg, var(--har-navy) 0%, var(--har-navy-light) 55%, var(--har-sky) 100%);
    color: #fff;
    padding: 0rem 0 2.5rem;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -60%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(240,165,0,0.12) 0%, transparent 70%);
    border-radius: 50%;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 2.4rem;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.hero-subtitle {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 1.15rem;
    opacity: 0.85;
    max-width: 600px;
}

/* --- Application Closed Banner ----------------------------- */
.closed-banner {
    background: var(--har-gray-50);
    border: 2px dashed var(--har-gray-200);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    margin: 3rem auto;
    max-width: 600px;
}

.closed-banner i {
    font-size: 3rem;
    color: var(--har-gray-600);
    margin-bottom: 1rem;
}

/* --- Form Card --------------------------------------------- */
.form-card {
    background: #fff;
    border: 1px solid var(--har-gray-200);
    border-radius: 12px;
    padding: 2.5rem;
    margin-top: -2rem;
    position: relative;
    z-index: 2;
    box-shadow: 0 8px 32px rgba(11, 29, 58, 0.08);
}

.section-title {
    font-weight: 600;
    font-size: 1.3rem;
    color: var(--har-navy);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title i {
    color: var(--har-sky);
}

.section-divider {
    border: none;
    border-top: 2px solid var(--har-gray-100);
    margin: 2rem 0;
}

/* --- Form Controls ----------------------------------------- */
.form-control:focus,
.form-select:focus {
    border-color: var(--har-sky);
    box-shadow: 0 0 0 3px rgba(46, 134, 222, 0.15);
}

.form-label {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--har-gray-800);
    margin-bottom: 0.35rem;
}

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

.char-counter {
    font-family: var(--font-display);
    font-size: 0.78rem;
    color: var(--har-gray-600);
    text-align: right;
    margin-top: 0.25rem;
    transition: color 0.2s;
}

.char-counter.warn  { color: var(--har-gold); }
.char-counter.error { color: var(--har-danger); font-weight: 600; }

textarea.form-control {
    min-height: 140px;
    resize: vertical;
}

/* Honeypot */
.hp-field { position: absolute; left: -9999px; opacity: 0; height: 0; width: 0; overflow: hidden; }

/* --- Buttons ----------------------------------------------- */
.btn-har-primary {
    background: var(--har-sky);
    color: #fff;
    border: none;
    font-family: var(--font-display);
    font-weight: 600;
    padding: 0.7rem 2.5rem;
    border-radius: 8px;
    transition: all 0.2s;
}
.btn-har-primary:hover {
    background: var(--har-sky-light);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(46, 134, 222, 0.3);
}
.btn-har-primary:disabled {
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

.btn-har-gold {
    background: var(--har-gold);
    color: var(--har-navy);
    border: none;
    font-family: var(--font-display);
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s;
}
.btn-har-gold:hover {
    background: var(--har-gold-light);
    color: var(--har-navy);
}

/* --- Footer ------------------------------------------------ */
.site-footer {
    background: var(--har-gray-50);
    border-top: 1px solid var(--har-gray-200);
    font-family: var(--font-display);
    font-size: 0.85rem;
}

.footer-link {
    color: var(--har-gray-600);
    text-decoration: none;
    transition: color 0.15s;
}
.footer-link:hover { color: var(--har-sky); }

/* --- Login Page -------------------------------------------- */
.login-wrapper {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: #fff;
    border: 1px solid var(--har-gray-200);
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(11, 29, 58, 0.08);
}

.login-card h2 {
    font-weight: 700;
    color: var(--har-navy);
}

/* --- Admin Dashboard --------------------------------------- */
.admin-header {
    background: linear-gradient(135deg, var(--har-navy) 0%, var(--har-navy-light) 100%);
    color: #fff;
    padding: 1.5rem 0;
}

.admin-header .badge {
    font-weight: 400;
}

.admin-toolbar {
    background: var(--har-gray-50);
    border-bottom: 1px solid var(--har-gray-200);
    padding: 0.75rem 0;
}

/* DataTables overrides */
.dataTables_wrapper {
    font-family: var(--font-display);
    font-size: 0.9rem;
}

table.dataTable thead th {
    background: var(--har-gray-50);
    font-weight: 600;
    color: var(--har-navy);
    border-bottom: 2px solid var(--har-gray-200) !important;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

table.dataTable tbody td {
    vertical-align: middle;
    padding: 0.65rem 0.75rem;
}

table.dataTable tbody tr:hover {
    background: rgba(46, 134, 222, 0.04) !important;
}

.score-btn {
    min-width: 64px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.82rem;
    border-radius: 6px;
}

.score-btn.scored {
    background: var(--har-navy-light);
    border-color: var(--har-navy-light);
    color: #fff;
}

.total-score-badge {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    color: var(--har-navy);
}

/* --- Scoring Modal ----------------------------------------- */
.modal-header-har {
    background: linear-gradient(135deg, var(--har-navy) 0%, var(--har-navy-light) 100%);
    color: #fff;
    border-bottom: none;
}

.modal-header-har .btn-close { filter: invert(1); }

.essay-section {
    background: var(--har-gray-50);
    border: 1px solid var(--har-gray-200);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.essay-section h6 {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--har-sky);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.5rem;
}

.essay-section p {
    font-size: 0.95rem;
    line-height: 1.65;
    margin-bottom: 0;
    white-space: pre-wrap;
}

/* --- Success Modal ----------------------------------------- */
.success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--har-success), #2ecc71);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    color: #fff;
    font-size: 2.2rem;
}

/* --- Responsive -------------------------------------------- */
@media (max-width: 768px) {
    .hero-title { font-size: 1.8rem; }
    .form-card  { padding: 1.5rem; margin-top: -1rem; }
    .login-card { margin: 1rem; }

    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* --- Utility Animations ------------------------------------ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in-up {
    animation: fadeInUp 0.5s ease-out both;
}

.fade-in-up-d1 { animation-delay: 0.1s; }
.fade-in-up-d2 { animation-delay: 0.2s; }
.fade-in-up-d3 { animation-delay: 0.3s; }

/* --- Spinner ----------------------------------------------- */
.spinner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 29, 58, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    display: none;
}

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

/* --- AI Score Badge ---------------------------------------- */
.ai-score-badge {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.82rem;
    min-width: 42px;
    display: inline-block;
}

.ai-score-section {
    background: var(--har-gray-50);
    border: 1px solid var(--har-gray-200);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* --- Document Upload Section ------------------------------- */
.doc-upload-row {
    animation: fadeInUp 0.25s ease-out both;
}

.doc-upload-row .form-label {
    font-size: 0.82rem;
}

/* --- Document List (Modal) --------------------------------- */
.docs-section .list-group-item {
    border-radius: 8px !important;
    margin-bottom: 0.35rem;
    border: 1px solid var(--har-gray-200);
    transition: background 0.15s;
}

.docs-section .list-group-item:hover {
    background: var(--har-gray-50);
}
