/* Root Variables - Pewaukee Pirate Theme */
:root {
    --primary-color: #cc0000;
    --primary-hover: #a00000;
    --secondary-color: #1a1a1a;
    --success-color: #cc0000;
    --error-color: #ff3333;
    --bg-light: #f5f5f5;
    --bg-white: #ffffff;
    --text-dark: #1a1a1a;
    --text-muted: #666666;
    --border-color: #cccccc;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.3);
    --border-radius: 8px;
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: radial-gradient(circle at top, #2a2a2a, #0d0d0d 60%);
    min-height: 100vh;
    padding: var(--spacing-sm);
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* Header */
header {
    background: transparent;
    color: white;
    padding: 1.25rem 1rem 0;
    border: none;
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.9rem 1.1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(0,0,0,0.55), rgba(204,0,0,0.25));
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    max-width: 340px;
    margin: 0 auto;
    align-items: center;
    justify-content: center;
}

.header-logo {
    width: 62px;
    height: 62px;
    object-fit: contain;
    background: #fff;
    border-radius: 50%;
    padding: 0.45rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.header-text {
    text-align: center;
}

.eyebrow {
    font-size: 0.85rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.7);
    margin-bottom: 0.35rem;
    text-align: center;
}

header h1 {
    font-size: 1.65rem;
    text-align: center;
    font-weight: 700;
    color: white;
}

.subtitle {
    font-size: 0.95rem;
    font-weight: 400;
    color: rgba(255,255,255,0.85);
}

/* Navigation Bar */
.nav-bar {
    display: flex;
    flex-wrap: wrap;
    background: #2a2a2a;
    border-bottom: 2px solid var(--primary-color);
    overflow-x: auto;
}

.nav-link {
    padding: var(--spacing-sm) var(--spacing-md);
    color: #e0e0e0;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(204, 0, 0, 0.15);
    color: #ffffff;
}

.nav-link.active {
    background: rgba(204, 0, 0, 0.25);
    border-bottom-color: var(--primary-color);
    color: #ffffff;
}

/* Search Section */
.search-section {
    padding: var(--spacing-lg) var(--spacing-md);
    background: var(--bg-light);
    position: relative;
}

.input-wrapper {
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    gap: var(--spacing-sm);
}

#address-input {
    flex: 1;
    min-width: 0;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    border: 3px solid var(--primary-color);
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    outline: none;
    background: white;
}

#address-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(204, 0, 0, 0.15);
}

#address-input::placeholder {
    color: #999;
}

.search-submit-btn {
    background: var(--primary-color);
    border: none;
    border-radius: var(--border-radius);
    padding: 1rem 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    min-width: 60px;
}

.search-submit-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.search-submit-btn:active {
    transform: scale(0.95);
}

.btn-primary {
    padding: 1rem 2rem;
    background: var(--primary-color);
    color: white;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(204, 0, 0, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Autocomplete Suggestions */
.suggestions-dropdown {
    position: absolute;
    top: calc(100% - var(--spacing-md));
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - var(--spacing-md) * 2);
    max-width: 700px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.suggestions-dropdown.active {
    display: block;
}

.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--bg-light);
    transition: background 0.2s ease;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: var(--bg-light);
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr;
    min-height: 500px;
}

/* Map Container */
.map-container {
    position: relative;
    height: 400px;
    width: 100%;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    gap: var(--spacing-sm);
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    border: 4px solid var(--bg-light);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results Section */
.results-section {
    padding: var(--spacing-lg) var(--spacing-md);
}

.results-section.hidden {
    display: none;
}

.result-card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--bg-light);
}

.result-header h2 {
    font-size: 1.5rem;
    color: var(--text-dark);
}

.btn-share {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-share:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(204, 0, 0, 0.3);
}

/* School Results */
#school-results {
    margin-bottom: var(--spacing-lg);
}

.school-item {
    background: var(--bg-light);
    padding: var(--spacing-md);
    border-radius: 10px;
    margin-bottom: var(--spacing-md);
    border-left: 5px solid var(--primary-color);
    border-top: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.school-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(204, 0, 0, 0.2);
    border-left-width: 8px;
}

.school-item:last-child {
    margin-bottom: 0;
}

.school-level {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: var(--spacing-xs);
}

.school-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: var(--spacing-xs);
}

.school-details {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.school-details p {
    margin: 0.25rem 0;
}

.school-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.school-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
}

.btn-secondary {
    flex: 1;
    min-width: 150px;
    padding: 0.75rem 1.5rem;
    background: var(--bg-white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* Enrollment Info */
.enrollment-info {
    background: #fff3cd;
    padding: var(--spacing-md);
    border-radius: 8px;
    border-left: 4px solid #ffc107;
}

.enrollment-info h3 {
    font-size: 1.1rem;
    margin-bottom: var(--spacing-sm);
    color: #856404;
}

.enrollment-info ul {
    list-style-position: inside;
    color: #856404;
}

.enrollment-info li {
    margin: 0.5rem 0;
}

/* Error Message */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: var(--spacing-md);
    border-radius: 8px;
    border-left: 4px solid var(--error-color);
    margin-top: var(--spacing-md);
}

.error-message.hidden {
    display: none;
}

/* Footer */
footer {
    padding: var(--spacing-lg) var(--spacing-md);
    background: var(--bg-light);
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.link-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    margin-bottom: var(--spacing-sm);
    transition: color 0.2s ease;
}

.link-btn:hover {
    color: var(--primary-hover);
}

.disclaimer {
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 800px;
    margin: 0 auto;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: var(--spacing-md);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: var(--spacing-xl);
    border-radius: var(--border-radius);
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-lg);
}

.close-modal {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    font-size: 2rem;
    font-weight: 300;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.close-modal:hover {
    color: var(--text-dark);
}

.modal-content h2 {
    margin-bottom: var(--spacing-md);
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: var(--spacing-sm);
}

.modal-content h3 {
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    color: var(--text-dark);
}

.modal-content ul,
.modal-content ol {
    margin-left: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.modal-content li {
    margin: var(--spacing-xs) 0;
}

.modal-content a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.modal-content a:hover {
    text-decoration: underline;
}

/* Desktop Layout (Media Query) */
@media (min-width: 768px) {
    .header-content {
        flex-direction: row;
        max-width: 420px;
        padding: 1.1rem 1.5rem;
    }

    .header-text {
        text-align: left;
    }

    header h1 {
        font-size: 1.85rem;
    }

    .main-content {
        grid-template-columns: 2fr 3fr;
        min-height: 600px;
    }

    .map-container {
        height: 100%;
        order: 2;
    }

    .results-section {
        order: 1;
        overflow-y: auto;
        max-height: 600px;
    }

    .input-wrapper {
        max-width: 100%;
    }

    .suggestions-dropdown {
        max-width: calc(100% - var(--spacing-md) * 2);
    }
}

@media (min-width: 1024px) {
    body {
        padding: var(--spacing-lg);
    }

    .search-section {
        padding: var(--spacing-xl) var(--spacing-lg);
    }

    .results-section {
        padding: var(--spacing-xl) var(--spacing-lg);
    }

    footer {
        padding: var(--spacing-xl) var(--spacing-lg);
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

.leaflet-popup-content {
    margin: var(--spacing-md);
    font-family: inherit;
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    .search-section,
    footer,
    .btn-share,
    .action-buttons {
        display: none;
    }

    .container {
        box-shadow: none;
    }

    .main-content {
        display: block;
    }

    .map-container {
        height: 400px;
        page-break-before: always;
    }
}
