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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    line-height: 1.6;
    color: #1f2937;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

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

/* Header styles */
.header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 2rem 0;
    text-align: center;
    color: white;
}

.header-content h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.header-content h1 i {
    margin-right: 1rem;
    color: #fbbf24;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 1rem;
    font-weight: 300;
}

.date {
    font-size: 1rem;
    opacity: 0.8;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    display: inline-block;
}

/* Main content */
.main {
    flex: 1;
    padding: 3rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Loading styles */
.loading {
    text-align: center;
    color: white;
    padding: 4rem 0;
}

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

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

/* Error styles */
.error {
    text-align: center;
    color: white;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 3rem 2rem;
    backdrop-filter: blur(10px);
}

.error i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #fbbf24;
}

.error h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.retry-btn {
    background: #10b981;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 1rem;
}

.retry-btn:hover {
    background: #059669;
    transform: translateY(-1px);
}

/* Flavors grid */
.flavors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

/* Flavor card styles */
.flavor-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.flavor-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.flavor-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.shop-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.shop-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.shop-icon i {
    color: white;
    font-size: 1.5rem;
}

.shop-name {
    font-size: 1.3rem;
    font-weight: 600;
    color: #374151;
}

.flavor-name {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.flavor-description {
    color: #6b7280;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.flavor-description.no-description {
    font-style: italic;
    opacity: 0.7;
}

.flavor-date {
    font-size: 0.875rem;
    color: #9ca3af;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.flavor-date i {
    margin-right: 0.5rem;
}

/* Footer */
.footer {
    background: rgba(0, 0, 0, 0.2);
    color: white;
    text-align: center;
    padding: 2rem;
    backdrop-filter: blur(10px);
}

/* Flavor card link styles */
.flavor-card-link {
    cursor: pointer;
    box-shadow: 0 20px 40px rgba(102, 126, 234, 0.08), 0 1.5px 4px rgba(118, 75, 162, 0.08);
    transition: transform 0.12s cubic-bezier(.4,2,.6,1), box-shadow 0.12s cubic-bezier(.4,2,.6,1), filter 0.12s cubic-bezier(.4,2,.6,1), background 0.12s cubic-bezier(.4,2,.6,1);
    will-change: transform, box-shadow, filter, background;
    background: rgba(255, 255, 255, 0.95);
}

.flavor-card-link:hover, .flavor-card-link:focus {
    background: rgb(224, 211, 255); /* subtle light purple */
}

.flavor-card-link:active {
    transform: scale(0.95) rotate(1deg);
    filter: brightness(0.96);
}

/* Responsive design */
@media (max-width: 768px) {
    .header-content h1 {
        font-size: 2.5rem;
    }
    
    .main {
        padding: 2rem 1rem;
    }
    
    .flavors-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .flavor-card {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .flavor-card {
        padding: 1.25rem;
    }
    
    .flavor-name {
        font-size: 1.5rem;
    }
}

/* Animation for cards appearing */
.flavor-card {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.flavor-card:nth-child(1) { animation-delay: 0.1s; }
.flavor-card:nth-child(2) { animation-delay: 0.2s; }
.flavor-card:nth-child(3) { animation-delay: 0.3s; }
.flavor-card:nth-child(4) { animation-delay: 0.4s; }
.flavor-card:nth-child(5) { animation-delay: 0.5s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Legal/content pages */
.legal-content {
    max-width: 800px;
}

.legal-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    color: #1f2937;
}

.legal-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #374151;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
}

.legal-section h2:first-of-type {
    margin-top: 1rem;
}

.legal-section h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #4b5563;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.legal-section p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.legal-section ul {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.legal-section li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.legal-section a {
    color: #667eea;
    text-decoration: none;
}

.legal-section a:hover {
    text-decoration: underline;
}

.footer a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    margin: 0 0.5rem;
}

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

/* Filters Panel */
.filters-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.filters-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.location-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.location-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.location-btn i {
    font-size: 1.1rem;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-select {
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 150px;
}

.filter-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.results-count {
    color: white;
    font-size: 0.95rem;
    margin-bottom: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    text-align: center;
}

.no-results {
    text-align: center;
    color: white;
    padding: 3rem;
    font-size: 1.2rem;
}

.no-results i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Distance badge in flavor cards */
.flavor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.flavor-distance {
    color: #667eea;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.flavor-distance i {
    font-size: 0.9rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .filters-row {
        flex-direction: column;
    }
    
    .location-btn,
    .filter-select {
        width: 100%;
    }
}

/* Map Styles */
.map-container {
    height: 400px;
    width: 100%;
    margin-bottom: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    z-index: 10;
}

/* Control Panel Updates */
.filters-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

@media (min-width: 768px) {
    .filters-controls {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.location-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.location-input {
    min-width: 300px;
}

/* State when a location is set: looks like a button/label */
.location-input.has-location {
    background-color: #e0f2fe; /* Light blue background */
    border-color: #3b82f6;     /* Blue border */
    color: #0369a1;            /* Darker blue text */
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="%233b82f6" viewBox="0 0 16 16"><path d="M8 16s6-5.686 6-10A6 6 0 0 0 2 6c0 4.314 6 10 6 10zm0-7a3 3 0 1 1 0-6 3 3 0 0 1 0 6z"/></svg>');
    background-repeat: no-repeat;
    background-position: 10px center;
    background-size: 16px;
    padding-left: 35px; /* Make room for icon */
}

/* Hover state for the "has-location" input to imply clickability */
.location-input.has-location:hover {
    background-color: #bae6fd;
    border-color: #2563eb;
}

.radius-select {
    width: auto;
}

.toggle-btn {
    padding: 0.5rem 1rem;
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    color: #4b5563;
    transition: all 0.2s;
    min-width: 130px;
}

.toggle-btn:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

.toggle-btn.active {
    background-color: #e0f2fe;
    border-color: #3b82f6;
    color: #2563eb;
}

.location-status {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.5rem;
    width: 100%;
    text-align: center;
}

/* Location Card Styles (Grouped Flavors) */
.location-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%; /* Make card take full height of grid cell */
    display: flex;
    flex-direction: column;
}

.location-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.shop-header {
    background: linear-gradient(to right, #f8fafc, #f1f5f9);
    padding: 1.25rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.shop-info {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

/* Container for Icon + Badge */
.shop-info > div:first-child {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 60px;
    flex-shrink: 0;
}

.shop-name {
    font-weight: 700;
    color: #1e293b;
    font-size: 1.2rem;
    line-height: 1.3;
    margin-top: -2px; /* Visual alignment with icon top */
}

.distance-badge {
    background-color: #eff6ff;
    color: #3b82f6;
    border: 1px solid #dbeafe;
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    width: 100%;
}

.shop-address {
    font-size: 0.9rem;
    color: #64748b;
    margin-top: 0.25rem;
    line-height: 1.4;
}

.location-flavors {
    padding: 1rem;
    flex: 1; /* Push footer down */
}

.card-footer {
    height: 50px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.footer-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #64748b;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.footer-link:hover {
    color: #4f46e5;
}

.flavor-item {
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.flavor-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Enhancements to existing classes */
.flavor-name {
    font-size: 1.3rem;
    color: #334155;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.flavor-description {
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.4;
}

.no-description {
    font-style: italic;
    color: #94a3b8;
}

/* ========================================= */
/* NEW FILTER UI STYLES                      */
/* ========================================= */

/* Actions Group in Header */
.actions-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #4b5563;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.filter-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #111827;
}

.filter-btn i {
    color: #667eea;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5); /* Semi-transparent dark background */
    backdrop-filter: blur(4px);
    z-index: 9999; /* Highest priority */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Container */
.modal-container {
    background: white;
    width: 90%;
    max-width: 500px;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.modal-overlay.active .modal-container {
    transform: translateY(0);
}

/* Modal Header */
.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #111827;
    font-size: 1.25rem;
    font-weight: 600;
}

.close-modal-btn {
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.25rem;
    border-radius: 4px;
    transition: color 0.2s;
}

.close-modal-btn:hover {
    color: #4b5563;
    background: #f3f4f6;
}

/* Modal Body */
.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.brand-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

/* Brand Checkbox Cards */
.brand-checkbox-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.brand-checkbox-card:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

/* Checked state styling */
.brand-checkbox-card:has(input:checked) {
    border-color: #667eea;
    background: #eef2ff;
}

.brand-checkbox-card input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: #667eea;
    cursor: pointer;
}

.brand-name {
    font-weight: 500;
    color: #374151;
}

/* Modal Footer */
.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end; /* Align buttons to right */
    gap: 1rem;
    background: #f9fafb;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

.primary-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.primary-btn:hover {
    opacity: 0.9;
}

.secondary-btn {
    background: white;
    color: #4b5563;
    border: 1px solid #d1d5db;
    padding: 0.6rem 1.25rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.secondary-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

/* ========================================
   Ad Containers & Styling
   ======================================== */

/* General ad container styling */
.ad-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    margin: 1.5rem 0;
    min-height: 100px;
}

.header-ad {
    margin-top: 0;
    margin-bottom: 2rem;
}

.content-ad {
    margin: 2rem 0;
}

.footer-ad {
    margin-top: 2rem;
    margin-bottom: 0;
}

/* In-feed ad cards */
.ad-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 2px dashed rgba(102, 126, 234, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 250px;
    position: relative;
}

.ad-label {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    font-size: 0.75rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* Responsive ad sizing */
@media (max-width: 768px) {
    .ad-container {
        padding: 1rem 0;
        margin: 1rem 0;
    }
    
    .header-ad, .content-ad, .footer-ad {
        margin: 1rem 0;
    }
    
    .ad-card {
        padding: 1.5rem;
        min-height: 200px;
    }
}

/* Hide ads on very small screens if needed */
@media (max-width: 480px) {
    .ad-container.desktop-only {
        display: none;
    }
}
