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

:root {
    /* Comforting Color Palette */
    --primary-color: #6B9BD1;      /* Soft blue */
    --primary-dark: #5583BD;
    --secondary-color: #7BC8A4;     /* Soft green */
    --accent-color: #F4A261;        /* Warm orange */
    --background: #F8F9FA;
    --surface: #FFFFFF;
    --text-primary: #2C3E50;
    --text-secondary: #5A6C7D;
    --text-light: #8B99A8;
    --border-color: #E1E8ED;
    --success: #7BC8A4;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Header and Navigation */
.navbar {
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    height: 80px;
    display: flex;
    align-items: center;
}

.navbar .container {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    position: relative;
    padding-left: 40px;
    margin: 0;
    margin-left: 0; /* Explicitly align to the left */
    max-width: none;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 1px;
    text-align: left;
    justify-content: flex-start;
}

.nav-brand .logo {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
}

.nav-brand h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
    text-align: left;
    display: inline-block;
}

.nav-brand span {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #6B9BD1 0%, #7BC8A4 100%);
    color: white;
    padding: 4rem 2rem;
    text-align: center;
    margin-bottom: 3rem;
}

.hero-content {
    max-width: 700px;
    margin: 0 auto;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.125rem;
    margin-bottom: 2rem;
    opacity: 0.95;
    font-weight: 400;
}

.search-disclaimer {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 1rem;
    text-align: center;
}

/* Location Search */
.location-search {
    display: flex;
    gap: 0.5rem;
    max-width: 600px;
    margin: 0 auto;
    background: white;
    padding: 0.5rem;
    border-radius: 50px;
    box-shadow: var(--shadow-lg);
}

.location-input {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    font-size: 1rem;
    color: var(--text-primary);
    border-radius: 25px;
    outline: none;
}

.location-input::placeholder {
    color: var(--text-light);
}

.search-btn {
    padding: 0.75rem 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

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

.geolocate-btn {
    width: 45px;
    height: 45px;
    background: var(--surface);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--primary-color);
}

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

/* Services Section */
.services-section {
    padding: 2rem 0 4rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.tab-btn {
    padding: 1rem 1.5rem;
    background: var(--surface);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.tab-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

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

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

.tab-btn.active .tab-icon {
    stroke: white;
}

/* Tab Content */
.tab-content-wrapper {
    background: var(--surface);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(450px, 1fr) 2fr;
    gap: 2rem;
}

/* Content Info */
.content-info h2 {
    color: var(--text-primary);
    font-size: 1.75rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.content-info p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.info-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-card {
    background: var(--background);
    padding: 1.25rem;
    border-radius: 12px;
    border-left: 4px solid var(--secondary-color);
}

.info-card h3 {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.info-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Map and Results */
.content-results {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.service-map {
    width: 100%;
    height: 300px;
    background: var(--background);
    border-radius: 12px;
    border: 2px solid var(--border-color);
}

.results-list {
    max-height: 800px;
    overflow-y: auto;
}

.results-prompt {
    text-align: center;
    color: var(--text-light);
    padding: 2rem;
    font-style: italic;
}

.result-item {
    background: var(--background);
    padding: 1.25rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.result-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.result-item h3 {
    color: var(--text-primary);
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.result-item p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.result-item .distance {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.875rem;
}

.result-item .directions-btn {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background 0.3s ease;
}

.result-item .directions-btn:hover {
    background: var(--primary-dark);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

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

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-overlay p {
    color: white;
    margin-top: 1rem;
    font-size: 1.125rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Footer */
footer {
    background: var(--surface);
    padding: 2rem 0;
    text-align: center;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
}

footer p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 968px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .tabs {
        flex-wrap: nowrap;
    }
    
    .navbar .container {
        padding-left: 20px;
    }
    
    .nav-brand h1 {
        font-size: 1.4rem;
    }
    
    .nav-brand .logo {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 0 15px;
    }
    
    .navbar .container {
        padding-left: 15px;
    }
    
    .nav-brand h1 {
        font-size: 1.2rem;
    }
    
    .nav-brand .logo {
        width: 50px;
        height: 50px;
    }
    
    .nav-brand {
        gap: 8px;
    }
    
    .hero {
        padding: 2.5rem 1rem; /* Reduced padding */
    }
    
    .hero-title {
        font-size: 1.6rem; /* Slightly smaller font size */
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .location-search {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem;
        border-radius: 16px;
    }
    
    .location-input,
    .search-btn {
        width: 100%;
        border-radius: 12px;
    }
    
    .geolocate-btn {
        align-self: center;
    }
    
    .tab-content-wrapper {
        padding: 1.5rem;
    }
    
    .tabs {
        flex-direction: column; /* Stack tabs vertically */
        gap: 0.5rem;
        overflow-x: visible; /* Remove horizontal scroll */
    }
    
    .tab-btn {
        font-size: 0.875rem;
        padding: 0.75rem 1rem;
        width: 100%; /* Make tabs full width */
    }
}

/* Scrollbar Styling */
.results-list::-webkit-scrollbar {
    width: 8px;
}

.results-list::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: 4px;
}

.results-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.results-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Service Type Selection */
.service-types {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.service-types h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.service-type-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.service-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0.75rem;
    background: var(--background);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.service-type-btn:hover {
    border-color: var(--primary-color);
    background: rgba(107, 155, 209, 0.05);
    transform: translateY(-1px);
}

.service-type-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.service-type-btn .service-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    display: block;
}

.service-type-btn small {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-top: 0.25rem;
    display: block;
    line-height: 1.2;
}

/* Housing-specific styles */
.hud-info-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.hud-info-card {
    background: white;
    padding: 1.25rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.hud-info-card h4 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.fmr-grid, .income-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.fmr-grid div, .income-grid div {
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
    text-align: center;
    font-size: 0.9rem;
}

.organizations-section {
    margin-top: 1.5rem;
}

.organizations-section h3 {
    color: var(--text);
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.organization-category {
    color: var(--text-muted) !important;
    font-style: italic;
    text-transform: capitalize;
    margin: 0.5rem 0;
}

@media (max-width: 768px) {
    .service-type-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .service-type-btn {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .service-type-btn .service-icon {
        font-size: 1.25rem;
    }
    
    .fmr-grid, .income-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hud-info-section {
        padding: 1rem;
    }
}

/* Job Training Search */
.job-training-search {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.job-training-search h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.search-input-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.field-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.field-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-training-btn {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

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

.search-help {
    font-size: 0.8rem;
    color: var(--text-light);
    margin: 0;
    font-style: italic;
}

@media (max-width: 768px) {
    .search-input-group {
        flex-direction: column;
    }
    
    .search-training-btn {
        align-self: flex-start;
    }
}

/* Field Tags for Job Training Results */
.field-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.field-tag.searched-field {
    background-color: #E3F2FD;
    color: #1976D2;
    border: 1px solid #BBDEFB;
}

.field-tag.general {
    background-color: #F5F5F5;
    color: #616161;
    border: 1px solid #E0E0E0;
}

/* News Tab Styling */
.load-news-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    margin: 10px auto;
    display: block;
}

.load-news-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.load-news-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.news-item {
    border-left: 4px solid var(--accent-color);
}

.news-header h3 {
    margin-bottom: 8px;
}

.news-header h3 a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.news-header h3 a:hover {
    color: var(--primary-color);
}

.news-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.news-source {
    font-weight: 500;
    color: var(--accent-color);
}

.news-date {
    color: var(--text-secondary);
}

.news-image {
    width: 100%;
    max-width: 200px;
    height: auto;
    border-radius: 8px;
    margin: 10px 0;
    object-fit: cover;
}

.news-description {
    margin: 10px 0;
    line-height: 1.5;
}

.news-actions {
    margin-top: 15px;
}

.news-actions .directions-btn.primary {
    background: var(--accent-color);
    color: white;
}

.news-actions .directions-btn.primary:hover {
    background: #69B394;
}

/* Volunteer Opportunities Styling */
.distance-buttons {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.distance-btn {
    background: var(--surface);
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

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

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

.volunteer-item {
    border-left: 4px solid var(--secondary-color);
}

.volunteer-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.opportunity-type {
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.opportunity-type.event {
    background: var(--accent-color);
}

.virtual-tag {
    background: var(--secondary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.free-tag {
    background: var(--success);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.categories, .activities {
    margin: 8px 0;
}

.category-tag, .activity-tag {
    display: inline-block;
    background: var(--background);
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.7rem;
    margin: 2px 4px 2px 0;
    border: 1px solid var(--border-color);
}

.security-note {
    color: var(--accent-color);
    font-weight: 500;
    margin: 8px 0;
}

.volunteer-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.volunteer-actions .directions-btn.primary {
    background: var(--secondary-color);
    color: white;
}

.volunteer-actions .directions-btn.primary:hover {
    background: #69B394;
}

.capacity {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Footer Disclaimer Styling */
.site-footer {
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 20px 0;
    margin-top: 40px;
}

.disclaimer {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.disclaimer p {
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
    font-size: 0.9rem;
}
