/**
 * PoolPals Styles
 * Mobile-first responsive design
 */

:root {
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --secondary-color: #6c757d;
    --accent-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-gray: #f8f9fa;
    --border-color: #dee2e6;
    --text-color: #333;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --border-radius: 8px;
    
    /* Schedule status colors */
    --available-color: #d4edda;
    --available-border: #28a745;
    --needs-ride-color: #fff3cd;
    --needs-ride-border: #ffc107;
    --not-available-color: #f8f9fa;
    --not-available-border: #6c757d;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #fff;
}

/* Layout containers */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Landing page styles */
.landing-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: white;
}

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

.logo h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.tagline {
    font-size: 1.2rem;
    opacity: 0.9;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 40px;
    align-items: center;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-color);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
}

.login-card h2 {
    margin-bottom: 20px;
    text-align: center;
}

.description {
    text-align: center;
    margin-bottom: 30px;
    color: #666;
}

/* Form styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.help-text {
    display: block;
    margin-top: 5px;
    font-size: 0.875rem;
    color: #666;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.checkbox-label.indent {
    margin-left: 20px;
}

.days-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

/* Button styles */
.btn-primary,
.btn-secondary,
.btn-accent,
.btn-danger {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #545b62;
}

.btn-accent {
    background-color: var(--accent-color);
    color: white;
}

.btn-accent:hover:not(:disabled) {
    background-color: #1e7e34;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: #c82333;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-accent:disabled,
.btn-danger:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.badge {
    background-color: var(--danger-color);
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 5px;
}

/* Error messages */
.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: var(--border-radius);
    border: 1px solid #f5c6cb;
    margin-top: 15px;
}

/* Features section */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    width: 100%;
    max-width: 800px;
}

.feature {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 30px 20px;
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.feature h3 {
    margin-bottom: 10px;
}

/* Footer */
.footer {
    margin-top: 40px;
    text-align: center;
    opacity: 0.8;
}

.footer a {
    color: white;
    text-decoration: underline;
}

.disclaimer {
    font-size: 0.875rem;
    margin-top: 10px;
}

/* Map page styles */
.map-page {
    overflow: hidden;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: var(--light-gray);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.app-title {
    font-size: 1.5rem;
    margin: 0;
}

.welcome-msg {
    color: var(--secondary-color);
    font-weight: 500;
}

.header-right {
    display: flex;
    gap: 10px;
}

/* Campus selector */
.campus-selector {
    padding: 15px 20px;
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.campus-selector h3 {
    margin-bottom: 10px;
    font-size: 1rem;
}

.campus-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.campus-checkbox .checkbox-label {
    background-color: var(--light-gray);
    padding: 8px 12px;
    border-radius: var(--border-radius);
    border: 2px solid transparent;
    transition: all 0.3s;
}

.campus-checkbox input:checked + .checkbox-label,
.campus-checkbox .checkbox-label:has(input:checked) {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-hover);
}

/* Action buttons */
.action-buttons {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    overflow-x: auto;
}

.btn-icon {
    font-size: 1.2rem;
}

/* Map container */
.map-container {
    flex: 1;
    position: relative;
    min-height: 400px;
}

#map {
    width: 100%;
    height: 100%;
}

/* Legend */
.legend {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    z-index: 1000;
    max-width: 200px;
}

.legend h4 {
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 0.8rem;
}

.pin-sample {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid;
}

.pin-sample.morning-only {
    border-color: #4A90E2;
    background-color: #4A90E2;
}

.pin-sample.afternoon-only {
    border-color: #F5A623;
    background-color: #F5A623;
}

.pin-sample.both-times {
    border-color: #7ED321;
    background-color: #7ED321;
}

.icon {
    font-size: 1rem;
}

/* Instructions panel */
.instructions {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    z-index: 1000;
    max-width: 300px;
}

.instructions-toggle {
    width: 100%;
    padding: 10px 15px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.instructions-content {
    padding: 0 15px 15px;
    border-top: 1px solid var(--border-color);
}

.instructions-content h4 {
    margin-bottom: 10px;
}

.instructions-content ol {
    margin-left: 20px;
    margin-bottom: 10px;
}

.instructions-content li {
    margin-bottom: 5px;
    font-size: 0.9rem;
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content.wide {
    max-width: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--secondary-color);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.pin-form {
    padding: 20px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Pin and match cards */
.pins-list,
.matches-list {
    padding: 20px;
}

.pin-card,
.match-card {
    background: var(--light-gray);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
}

.pin-header,
.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.campus-name {
    background-color: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.distance {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.pin-details,
.match-details {
    margin-bottom: 15px;
}

.availability {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.time-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.time-badge.morning {
    background-color: #4A90E2;
    color: white;
}

.time-badge.afternoon {
    background-color: #F5A623;
    color: white;
}

.compatibility-summary {
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 10px;
}

.contact-info {
    background-color: #e7f3ff;
    padding: 10px;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    margin-top: 10px;
}

.pin-actions,
.match-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.no-pins,
.no-matches {
    text-align: center;
    padding: 40px 20px;
    color: var(--secondary-color);
}

.no-matches h4 {
    margin-bottom: 10px;
    color: var(--text-color);
}

/* Pin marker styles */
.pin-marker {
    background: white;
    border: 4px solid;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
}

.pin-marker.morning-only {
    border-color: #4A90E2;
}

.pin-marker.afternoon-only {
    border-color: #F5A623;
}

.pin-marker.both-times {
    border-color: #7ED321;
}

.pin-content {
    transform: rotate(45deg);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.pin-icon {
    font-size: 1.4rem;
    font-weight: bold;
    margin-bottom: 1px;
}

.pin-indicators {
    display: flex;
    gap: 1px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 50px;
}

.pin-kids, .pin-seats {
    font-size: 0.5rem;
    line-height: 1;
}

/* Campus marker */
.campus-marker {
    font-size: 2.5rem;
    text-align: center;
    background: white;
    border: 3px solid #007bff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Location control */
.leaflet-control-locate {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.locate-btn {
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    font-size: 1.2rem;
}

.locate-btn:hover {
    background-color: var(--light-gray);
}

/* Popup styles */
.pin-popup {
    min-width: 200px;
}

.popup-header {
    margin-bottom: 10px;
}

.popup-content {
    font-size: 0.9rem;
}

.time-slot {
    margin-bottom: 5px;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.loading {
    text-align: center;
    padding: 20px;
    color: var(--secondary-color);
}

.error {
    text-align: center;
    padding: 20px;
    color: var(--danger-color);
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .login-card {
        padding: 30px 20px;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
    
    .header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .app-title {
        font-size: 1.25rem;
    }
    
    .campus-checkboxes {
        flex-direction: column;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .legend {
        position: relative;
        top: auto;
        right: auto;
        margin: 10px;
        max-width: none;
    }
    
    .instructions {
        position: relative;
        bottom: auto;
        left: auto;
        margin: 10px;
        max-width: none;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .days-group {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        max-height: 95vh;
    }
    
    .pin-header,
    .match-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .form-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .campus-checkboxes,
    .days-group {
        grid-template-columns: 1fr;
    }
    
    .availability {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Schedule dropdown color coding */
.form-select[name*="_status"] {
    transition: all 0.2s ease;
}

.form-select[name*="_status"] option[value="available"] {
    background-color: var(--available-color);
    color: var(--accent-color);
    font-weight: 500;
}

.form-select[name*="_status"] option[value="needs_ride"] {
    background-color: var(--needs-ride-color);
    color: #856404;
    font-weight: 500;
}

.form-select[name*="_status"] option[value="not_available"] {
    background-color: var(--not-available-color);
    color: var(--secondary-color);
}

/* Color-code the select elements based on their selected value */
.form-select[name*="_status"][data-status="available"] {
    background-color: var(--available-color);
    border-color: var(--available-border);
    color: var(--accent-color);
    font-weight: 500;
}

.form-select[name*="_status"][data-status="needs_ride"] {
    background-color: var(--needs-ride-color);
    border-color: var(--needs-ride-border);
    color: #856404;
    font-weight: 500;
}

.form-select[name*="_status"][data-status="not_available"] {
    background-color: var(--not-available-color);
    border-color: var(--not-available-border);
    color: var(--secondary-color);
}

/* Schedule grid improvements */
.schedule-grid {
    font-size: 0.9em;
}

.schedule-day {
    margin-bottom: 0.25rem;
    padding: 0.25rem;
    border-radius: 4px;
    background-color: #f8f9fa;
}

/* Disabled care checkboxes styling */
.form-check-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-check-input:disabled + .form-check-label {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Modal z-index fix - ensure edit modal appears on top */
.modal {
    z-index: 1050;
}

.modal.show {
    z-index: 1055;
}

/* Ensure edit modal (addPinModal) has highest z-index when shown */
#addPinModal.show {
    z-index: 1060;
}

/* Print styles */
@media print {
    .action-buttons,
    .legend,
    .instructions,
    .modal {
        display: none;
    }
}