/* ============================================================
   SCPS Scholarships — Design System
   Seminole County Public Schools
   ============================================================ */


/* ---- Skip Navigation (ADA - WCAG 2.4.1) ---- */

.skip-nav {
    position: absolute;
    top: -100%;
    left: 0;
    background: #d4a017;
    color: #0d1f3c;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    z-index: 10000;
    border-radius: 0 0 0.5rem 0;
    transition: top 0.2s ease;
}

.skip-nav:focus {
    top: 0;
}


/* ---- CSS Custom Properties ---- */

:root {
    /* Brand Colors */
    --scps-navy:        #1b3a6b;
    --scps-navy-dark:   #0d1f3c;
    --scps-navy-light:  #2a5298;
    --scps-gold:        #d4a017;
    --scps-gold-bright: #f4b942;
    --scps-gold-dark:   #a07810;

    /* Semantic Colors */
    --color-primary:    #1b6ec2;
    --color-success:    #198754;
    --color-warning:    #d97706;
    --color-danger:     #dc3545;
    --color-info:       #0ea5e9;

    /* Light Mode Surfaces */
    --bg-page:          #f0f4f8;
    --bg-surface:       #ffffff;
    --bg-navbar:        var(--scps-navy);

    /* Light Mode Text */
    --text-primary:     #1a2b4a;
    --text-secondary:   #4a5568;
    --text-muted:       #718096;

    /* Light Mode Borders & Shadows */
    --border-color:         #e2e8f0;
    --card-shadow:          0 1px 3px rgba(27, 58, 107, 0.08), 0 4px 16px rgba(27, 58, 107, 0.06);
    --card-shadow-hover:    0 4px 12px rgba(27, 58, 107, 0.15), 0 8px 32px rgba(27, 58, 107, 0.10);

    /* Light Mode Form Inputs */
    --input-bg:             #ffffff;
    --input-border:         #cbd5e0;

    /* Light Mode Table */
    --table-bg:         #ffffff;
    --table-hover:      rgba(27, 58, 107, 0.04);

    /* ADA Focus Ring — gold ring on navy brand (#f4b942 at 60% opacity gives clear visibility) */
    --focus-ring: 0 0 0 3px rgba(244, 185, 66, 0.65);

    /* Transitions */
    --t-fast:   0.15s ease;
    --t-med:    0.3s ease;

    /* Layout */
    --navbar-height: 64px;
}

[data-theme="dark"] {
    /* Dark Mode Surfaces */
    --bg-page:      #0f1923;
    --bg-surface:   #1a2535;
    --bg-navbar:    #0d1f3c;

    /* Dark Mode Text */
    --text-primary:     #e2e8f0;
    --text-secondary:   #a0aec0;
    --text-muted:       #718096;

    /* Dark Mode Borders & Shadows */
    --border-color:         #2d3748;
    --card-shadow:          0 1px 3px rgba(0, 0, 0, 0.25), 0 4px 16px rgba(0, 0, 0, 0.18);
    --card-shadow-hover:    0 4px 12px rgba(0, 0, 0, 0.35), 0 8px 32px rgba(0, 0, 0, 0.25);

    /* Dark Mode Form Inputs */
    --input-bg:         #1a2535;
    --input-border:     #2d3748;

    /* Dark Mode Table */
    --table-bg:     #1a2535;
    --table-hover:  rgba(255, 255, 255, 0.05);
}


/* ---- Base ---- */

html {
    font-size: 14px;
    scroll-behavior: smooth;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html { font-size: 16px; }
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-primary);
    transition: background-color var(--t-med), color var(--t-med);
    margin: 0;
    padding: 0;
}


/* ---- Universal ADA Focus Styles (WCAG 2.4.7) ---- */

*:focus-visible {
    outline: none !important;
    box-shadow: var(--focus-ring) !important;
    border-radius: 4px;
}

.btn:focus,
.btn:active:focus,
.form-control:focus,
.form-check-input:focus,
.form-select:focus {
    box-shadow: var(--focus-ring) !important;
    outline: none;
}

a:focus-visible {
    box-shadow: var(--focus-ring) !important;
    outline: none !important;
}


/* ---- Navbar ---- */

.navbar-scps {
    background-color: var(--bg-navbar) !important;
    transition: background-color var(--t-med);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
    min-height: var(--navbar-height);
    padding: 0.5rem 1rem;
}

/* Brand wrapper */
.navbar-brand-scps {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    padding: 0.25rem 0;
}

.navbar-brand-scps:hover .navbar-logo-container {
    transform: scale(1.03);
    box-shadow: 0 2px 10px rgba(244, 185, 66, 0.45);
}

/* Logo pill — white background so any logo style shows clearly */
.navbar-logo-container {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 8px;
    padding: 4px 8px;
    transition: transform var(--t-fast), box-shadow var(--t-fast);
}

.navbar-logo {
    height: 44px;
    width: auto;
}

/* Brand text next to logo */
.navbar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.navbar-brand-title {
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.navbar-brand-subtitle {
    color: var(--scps-gold-bright);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

/* Nav links */
.navbar-nav-scps .nav-link {
    color: rgba(255, 255, 255, 0.85) !important;
    font-weight: 600;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: color var(--t-fast), background-color var(--t-fast);
    position: relative;
}

.navbar-nav-scps .nav-link::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 1rem;
    right: 1rem;
    height: 2px;
    background-color: var(--scps-gold-bright);
    transform: scaleX(0);
    transition: transform var(--t-fast);
    border-radius: 2px;
}

.navbar-nav-scps .nav-link:hover,
.navbar-nav-scps .nav-link:focus {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.12);
}

.navbar-nav-scps .nav-link:hover::after,
.navbar-nav-scps .nav-link:focus::after {
    transform: scaleX(1);
}

/* Toggler (hamburger) */
.navbar-toggler {
    border-color: rgba(255, 255, 255, 0.35) !important;
    padding: 0.375rem 0.5rem;
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Theme toggle */
.theme-toggle {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--t-fast);
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.45);
    transform: rotate(22deg);
}

.theme-toggle i {
    color: var(--scps-gold-bright);
    font-size: 16px;
}

/* User info */
.navbar-user-info {
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 190px;
}

.navbar-sign-link {
    color: var(--scps-gold-bright) !important;
    font-weight: 600;
    text-decoration: none;
    transition: color var(--t-fast);
    font-size: 0.9rem;
}

.navbar-sign-link:hover,
.navbar-sign-link:focus {
    color: #ffffff !important;
}


/* ---- Scholarship Announcement Strip ---- */

.scholarship-strip {
    background: linear-gradient(135deg, var(--scps-navy-dark) 0%, var(--scps-navy) 50%, var(--scps-navy-dark) 100%);
    color: white;
    padding: 0.55rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
}

/* Animated shimmer sweep */
.scholarship-strip::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -100%;
    width: 55%;
    height: 200%;
    background: linear-gradient(90deg, transparent, rgba(244, 185, 66, 0.12), transparent);
    animation: strip-shimmer 5s ease-in-out infinite;
    pointer-events: none;
}

.strip-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.strip-icon {
    font-size: 1.15rem;
    animation: bounce-soft 2.5s ease-in-out infinite;
    display: inline-block;
}

/* Gold CTA button — dark navy text on gold (#d4a017) = 4.4:1, on gold-bright (#f4b942) = 9.9:1 */
.strip-cta {
    background: var(--scps-gold-bright);
    color: var(--scps-navy-dark) !important;
    border: none;
    padding: 0.35rem 1rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.82rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all var(--t-fast);
    white-space: nowrap;
}

.strip-cta:hover,
.strip-cta:focus {
    background: #ffffff;
    color: var(--scps-navy) !important;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(244, 185, 66, 0.45);
}

.strip-dismiss {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    padding: 0.3rem;
    line-height: 1;
    transition: color var(--t-fast);
    font-size: 0.95rem;
    border-radius: 50%;
}

.strip-dismiss:hover,
.strip-dismiss:focus {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.12);
}


/* ---- Page Container ---- */

/* NOTE: No animation on .page-container — any opacity/transform animation creates
   a CSS stacking context that traps Bootstrap modals below the backdrop overlay.
   The fade-in is applied to <main> instead, which is safe because by the time a
   user can interact with the page the animation has already finished. */
.page-container {
    padding: 1.5rem;
}

@media (min-width: 768px) {
    .page-container { padding: 2rem; }
}

main#main-content {
    animation: page-fade-in 0.35s ease-out both;
}


/* ---- Cards ---- */

.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--card-shadow);
    transition: box-shadow var(--t-med), background-color var(--t-med);
    border-radius: 0.65rem !important;
    color: var(--text-primary);
}

.card-header-primary {
    background: linear-gradient(135deg, var(--scps-navy) 0%, var(--scps-navy-light) 100%);
    color: white;
    border-radius: 0.55rem 0.55rem 0 0 !important;
    border-bottom: 3px solid var(--scps-gold) !important;
    padding: 1rem 1.25rem;
}

.card-header-primary h1,
.card-header-primary h2,
.card-header-primary h3 {
    color: white;
    font-weight: 700;
    margin-bottom: 0;
}


/* ---- Tables ---- */

.table {
    color: var(--text-primary);
    background-color: var(--table-bg);
    margin-bottom: 0;
}

.table thead th {
    background-color: rgba(27, 58, 107, 0.07);
    color: var(--scps-navy);
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-color);
    padding: 0.75rem 0.875rem;
    white-space: nowrap;
}

[data-theme="dark"] .table thead th {
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--scps-gold-bright);
    border-bottom-color: var(--border-color);
}

.table tbody tr {
    transition: background-color var(--t-fast);
}

.table tbody tr:hover {
    background-color: var(--table-hover);
}

.table tbody td {
    padding: 0.75rem 0.875rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .table tbody td {
    border-bottom-color: var(--border-color);
}

.expired-row {
    opacity: 0.62;
}

.expired-row:hover {
    opacity: 0.82;
}


/* ---- Filter Bar ---- */

.filter-bar {
    background-color: var(--bg-surface);
    padding: 0.875rem 1rem;
    border-radius: 0.65rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 4px rgba(27, 58, 107, 0.05);
    margin-bottom: 1rem;
    transition: background-color var(--t-med), border-color var(--t-med);
}

.filter-bar .dropdown-menu {
    max-height: 300px;
    overflow-y: auto;
}


/* ---- Form Controls ---- */

.form-control,
.form-select {
    background-color: var(--input-bg);
    border-color: var(--input-border);
    color: var(--text-primary);
    transition: border-color var(--t-fast), box-shadow var(--t-fast), background-color var(--t-med);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--input-bg);
    border-color: var(--scps-navy);
    color: var(--text-primary);
}

.form-label {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.35rem;
}

/* Required field indicator (ADA: also communicated via aria-required) */
.required::after {
    content: " *";
    color: #dc3545;
    font-weight: 700;
    aria-hidden: true;
}

/* Dark mode inputs */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="url"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="datetime-local"],
[data-theme="dark"] input.form-control,
[data-theme="dark"] textarea.form-control {
    color: var(--text-primary) !important;
    background-color: var(--input-bg);
    border-color: var(--input-border);
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--text-muted);
    opacity: 1;
}


/* ---- Buttons ---- */

.btn {
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all var(--t-fast);
}

.btn:active {
    transform: translateY(0) !important;
}

/* Gold button — high contrast: #0d1f3c on #f4b942 = 9.9:1 */
.btn-gold {
    background-color: var(--scps-gold-bright);
    border-color: var(--scps-gold);
    color: var(--scps-navy-dark) !important;
    font-weight: 700;
}

.btn-gold:hover,
.btn-gold:focus {
    background-color: #ffc84a;
    border-color: var(--scps-gold-bright);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(212, 160, 23, 0.4);
    color: var(--scps-navy-dark) !important;
}

/* Light button used in dark headers */
.btn-light {
    background-color: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.8);
    color: var(--scps-navy);
    font-weight: 700;
}

.btn-light:hover,
.btn-light:focus {
    background-color: #ffffff;
    color: var(--scps-navy-dark);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}


/* ---- Modals ---- */

.modal-content {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
}

.modal-header-primary {
    background: linear-gradient(135deg, var(--scps-navy) 0%, var(--scps-navy-light) 100%);
    color: white;
    border-radius: 0.75rem 0.75rem 0 0;
    border-bottom: 3px solid var(--scps-gold) !important;
    padding: 1rem 1.25rem;
}

.modal-header-success {
    background: linear-gradient(135deg, #155d3c 0%, #1e8a57 100%);
    color: white;
    border-radius: 0.75rem 0.75rem 0 0;
    border-bottom: 3px solid #4dd08a !important;
    padding: 1rem 1.25rem;
}

.modal-header-primary h2,
.modal-header-primary h5,
.modal-header-success h2,
.modal-header-success h5 {
    color: white;
    font-weight: 700;
    margin-bottom: 0;
}

.modal-header-primary .btn-close,
.modal-header-success .btn-close {
    filter: invert(1) brightness(2);
    opacity: 0.85;
}

.modal-header-primary .btn-close:hover,
.modal-header-success .btn-close:hover {
    opacity: 1;
}

.modal-body {
    background-color: var(--bg-surface);
    color: var(--text-primary);
}

.modal-footer {
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-color);
}

/* Dark mode modals */
[data-theme="dark"] .modal-content,
[data-theme="dark"] .modal-body,
[data-theme="dark"] .modal-footer {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-color);
}


/* ---- Dropdowns ---- */

.dropdown-menu {
    background-color: var(--bg-surface);
    border-color: var(--border-color);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border-radius: 0.5rem;
    color: var(--text-primary);
}

.dropdown-item {
    color: var(--text-primary);
    transition: background-color var(--t-fast);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: rgba(27, 58, 107, 0.08);
    color: var(--scps-navy);
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--scps-gold-bright);
}


/* ---- Pagination ---- */

.page-link {
    background-color: var(--bg-surface);
    color: var(--scps-navy);
    border-color: var(--border-color);
    transition: all var(--t-fast);
}

.page-link:hover {
    background-color: var(--scps-navy);
    color: white;
    border-color: var(--scps-navy);
}

.page-item.active .page-link {
    background-color: var(--scps-navy);
    border-color: var(--scps-navy);
}

[data-theme="dark"] .page-link {
    background-color: var(--bg-surface);
    color: var(--scps-gold-bright);
    border-color: var(--border-color);
}


/* ---- DataTables Dark Mode ---- */

[data-theme="dark"] .dataTables_wrapper .dataTables_length select,
[data-theme="dark"] .dataTables_wrapper .dataTables_filter input {
    background-color: var(--input-bg);
    color: var(--text-primary);
    border-color: var(--input-border);
}

[data-theme="dark"] .dataTables_wrapper .dataTables_info,
[data-theme="dark"] .dataTables_wrapper .dataTables_length,
[data-theme="dark"] .dataTables_wrapper .dataTables_filter,
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate {
    color: var(--text-secondary);
}


/* ---- Notification / Toast Container (WCAG 4.1.3) ---- */

#notification-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    max-width: 360px;
    width: calc(100vw - 2rem);
}

/* Scholarship description cell hover-expand */
.scholarship-description {
    max-width: 450px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
    cursor: default;
}

.scholarship-description:hover {
    overflow: visible;
    white-space: normal;
    background-color: var(--bg-surface);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    border-radius: 0.375rem;
    padding: 0.5rem;
    position: relative;
    z-index: 100;
}

.scholarship-title {
    line-height: 1.3;
    margin-bottom: 0.25rem;
}

/* Table column constraints */
#scholarshipstable td:nth-child(1) {
    max-width: 250px;
    word-wrap: break-word;
    white-space: normal;
}

#scholarshipstable td:nth-child(4) {
    min-width: 300px;
}

/* File lists in modals */
#currentFiles ul,
#selectedFiles ul {
    padding-left: 1.25rem;
}

#currentFiles .btn-outline-danger {
    padding: 0.125rem 0.375rem;
    font-size: 0.75rem;
}


/* ---- Keyframe Animations ---- */

@keyframes page-fade-in {
    /* NOTE: No transform used here — transform creates a CSS stacking context on
       .page-container, which traps Bootstrap modals behind the backdrop overlay.
       Opacity-only fade avoids that problem while still giving a smooth entrance. */
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes strip-shimmer {
    0%   { left: -100%; }
    45%  { left: 120%;  }
    100% { left: 120%;  }
}

@keyframes bounce-soft {
    0%, 100% { transform: translateY(0);    }
    50%       { transform: translateY(-4px); }
}

@keyframes spin-once {
    from { transform: rotate(0deg);   }
    to   { transform: rotate(360deg); }
}


/* ---- Responsive ---- */

@media (max-width: 767px) {
    .page-container {
        padding: 1rem 0.75rem;
    }

    .navbar-brand-text {
        display: none !important;
    }

    .navbar-logo {
        height: 36px;
    }

    .filter-bar {
        padding: 0.5rem 0.625rem;
    }

    .table {
        font-size: 0.78rem;
    }

    #scholarshipstable td:nth-child(1) {
        max-width: 150px;
    }

    .scholarship-description {
        max-width: 200px;
    }

    .modal-body {
        padding-bottom: 80px;
    }

    .modal-footer {
        position: sticky;
        bottom: 0;
        z-index: 10;
    }
}

@media (min-width: 1200px) {
    .scholarship-description {
        max-width: 550px;
    }
}
