/* ========================================
   Dannee School District - Styles
   ======================================== */

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --navy: #1a3a5c;
    --navy-dark: #122a44;
    --gold: #d4a017;
    --gold-light: #f0c940;
    --white: #ffffff;
    --gray-50: #f8f9fa;
    --gray-100: #f0f1f3;
    --gray-200: #e0e2e6;
    --gray-400: #9ea3ab;
    --gray-600: #5a5f68;
    --gray-800: #2d3035;
    --success: #2e7d32;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--gray-800);
    background: var(--gray-100);
    line-height: 1.5;
}

/* Pages */
.page {
    display: none;
    height: 100%;
}

.page.active {
    display: flex;
    flex-direction: column;
}

/* ========================================
   Login Page
   ======================================== */
#login-page {
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
}

.login-container {
    background: var(--white);
    border-radius: 12px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.district-logo {
    width: 72px;
    height: 72px;
    background: var(--navy);
    color: var(--gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    margin: 0 auto 16px;
}

.login-header h1 {
    font-size: 24px;
    color: var(--navy);
    font-weight: 700;
}

.tagline {
    color: var(--gray-600);
    font-size: 14px;
    margin-top: 4px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: inherit;
    color: var(--gray-800);
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--white);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(26, 58, 92, 0.12);
}

.form-group textarea {
    resize: vertical;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

/* Buttons */
.btn {
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-family: inherit;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--navy);
    color: var(--white);
    width: 100%;
}

.btn-primary:hover {
    background: var(--navy-dark);
}

.btn-logout {
    background: transparent;
    color: var(--gold-light);
    padding: 6px 16px;
    font-size: 14px;
}

.btn-logout:hover {
    background: rgba(212, 160, 23, 0.15);
    color: var(--gold);
}

.login-hint {
    text-align: center;
    font-size: 13px;
    color: var(--gray-400);
    margin-top: 16px;
}

/* ========================================
   Dashboard
   ======================================== */
.top-bar {
    background: var(--navy);
    color: var(--white);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 32px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.district-logo-sm {
    width: 36px;
    height: 36px;
    background: var(--gold);
    color: var(--navy);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}

.district-name {
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
}

.tab-nav {
    display: flex;
    gap: 4px;
    flex: 1;
}

.tab-btn {
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border: none;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius) var(--radius) 0 0;
    transition: all 0.2s;
    font-family: inherit;
}

.tab-btn:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.08);
}

.tab-btn.active {
    color: var(--gold-light);
    background: rgba(255, 255, 255, 0.1);
    font-weight: 600;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

#user-display {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

.dashboard-content {
    flex: 1;
    overflow: auto;
    background: var(--gray-50);
}

.tab-content {
    display: none;
    height: 100%;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

/* ========================================
   Routes Tab
   ======================================== */
.routes-layout {
    display: flex;
    height: 100%;
}

.routes-sidebar {
    width: 320px;
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    padding: 24px;
    overflow-y: auto;
    flex-shrink: 0;
}

.routes-sidebar h2 {
    font-size: 20px;
    color: var(--navy);
    margin-bottom: 4px;
}

.sidebar-hint {
    font-size: 13px;
    color: var(--gray-400);
    margin-bottom: 16px;
}

.route-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.route-item {
    padding: 14px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--white);
}

.route-item:hover {
    border-color: var(--navy);
    background: var(--gray-50);
}

.route-item.active {
    border-color: var(--navy);
    background: var(--navy);
    color: var(--white);
}

.route-item h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.route-item .route-meta {
    font-size: 12px;
    color: var(--gray-400);
}

.route-item.active .route-meta {
    color: rgba(255, 255, 255, 0.7);
}

.route-item .route-stops-preview {
    font-size: 12px;
    margin-top: 6px;
    color: var(--gray-600);
}

.route-item.active .route-stops-preview {
    color: rgba(255, 255, 255, 0.8);
}

.map-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

#map {
    flex: 1;
    min-height: 400px;
}

.route-info-panel {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

.route-info-panel.hidden {
    display: none;
}

.route-info-panel h3 {
    font-size: 16px;
    color: var(--navy);
    margin-bottom: 12px;
    border-bottom: 2px solid var(--gold);
    padding-bottom: 8px;
}

.route-stops-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stop-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--gray-50);
    border-radius: 6px;
    font-size: 14px;
}

.stop-item .stop-name {
    font-weight: 500;
    color: var(--gray-800);
}

.stop-item .stop-time {
    font-weight: 600;
    color: var(--navy);
    white-space: nowrap;
}

.stop-item .stop-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    margin-left: 8px;
}

.stop-status.on-time {
    background: #e8f5e9;
    color: var(--success);
}

.stop-status.delayed {
    background: #fff3e0;
    color: #e65100;
}

/* ========================================
   FAQ Tab
   ======================================== */
.faq-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 24px;
    width: 100%;
}

.faq-container h2 {
    font-size: 24px;
    color: var(--navy);
    margin-bottom: 8px;
}

.faq-subtitle {
    color: var(--gray-600);
    font-size: 14px;
    margin-bottom: 32px;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.faq-item {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--white);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.faq-item:hover {
    box-shadow: var(--shadow);
}

.faq-question {
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 15px;
    color: var(--gray-800);
    background: var(--white);
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    transition: background 0.2s;
}

.faq-question:hover {
    background: var(--gray-50);
}

.faq-question .chevron {
    font-size: 18px;
    color: var(--gray-400);
    transition: transform 0.3s;
    flex-shrink: 0;
    margin-left: 16px;
}

.faq-item.open .faq-question .chevron {
    transform: rotate(180deg);
}

.faq-item.open .faq-question {
    background: var(--navy);
    color: var(--white);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-item.open .faq-answer {
    max-height: 300px;
}

.faq-answer-inner {
    padding: 0 20px 16px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--gray-600);
}

/* ========================================
   Contact Tab
   ======================================== */
.contact-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 40px 24px;
    width: 100%;
}

.contact-container h2 {
    font-size: 24px;
    color: var(--navy);
    margin-bottom: 8px;
}

.contact-subtitle {
    color: var(--gray-600);
    font-size: 14px;
    margin-bottom: 32px;
}

.contact-form {
    background: var(--white);
    padding: 32px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.contact-form .btn {
    width: auto;
    margin-top: 8px;
}

/* ========================================
   Toast
   ======================================== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--navy);
    color: var(--white);
    padding: 14px 24px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
}

.toast.hidden {
    display: none;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .top-bar {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 16px;
        gap: 12px;
    }

    .tab-nav {
        order: 3;
        width: 100%;
        overflow-x: auto;
    }

    .routes-sidebar {
        width: 240px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .login-container {
        margin: 16px;
        padding: 32px 24px;
    }
}

/* Override Leaflet tile layer brightness for cleaner look */
.leaflet-tile-pane {
    filter: saturate(0.85) brightness(1.05);
}
