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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Filters */
.filters {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filter-info {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
}

.filter-info p {
    margin: 0;
    font-size: 0.9rem;
    color: #1565c0;
    line-height: 1.4;
}

.filter-info strong {
    color: #0d47a1;
}

/* Search box */
.search-group {
    position: relative;
    margin-bottom: 10px;
}

.search-group label {
    display: block;
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

#searchBox {
    width: 100%;
    padding: 12px 40px 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    transition: all 0.2s ease;
}

#searchBox:focus {
    outline: none;
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

#searchBox:not(:placeholder-shown) {
    border-color: #007bff;
    background: #f8f9ff;
}

#clearSearch {
    position: absolute;
    right: 8px;
    top: 38px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#clearSearch:hover {
    background: #5a6268;
    transform: scale(1.1);
}

#clearSearch.visible {
    display: flex;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.filter-group select,
.filter-group button {
    padding: 10px 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 14px;
    min-width: 150px;
}

.filter-group select:focus {
    outline: none;
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

#clearFilters {
    background: #6c757d;
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 22px;
}

#clearFilters:hover {
    background: #5a6268;
}

/* Collapsible filters for mobile */
.collapsible-filter .filter-header {
    display: none; /* Hidden by default on desktop */
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 12px 16px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.collapsible-filter .filter-header:hover {
    background: #e9ecef;
}

.collapsible-filter .filter-header label {
    margin: 0;
    font-weight: 600;
    color: #495057;
    cursor: pointer;
}

.filter-toggle {
    font-size: 12px;
    transition: transform 0.2s;
    color: #6c757d;
}

.collapsible-filter.expanded .filter-toggle {
    transform: rotate(180deg);
}

.collapsible-filter .filter-content {
    transition: max-height 0.3s ease-out;
    overflow: hidden;
}

/* Mobile-specific styles */
@media (max-width: 768px) {
    .collapsible-filter .filter-header {
        display: flex;
    }
    
    .collapsible-filter .filter-content {
        max-height: 0;
        overflow: hidden;
    }
    
    .collapsible-filter.expanded .filter-content {
        max-height: 2000px; /* Large enough to accommodate content */
        overflow: visible;
    }
    
    /* Hide the regular label on mobile when collapsible is active */
    .collapsible-filter .filter-group label:not(.filter-header label) {
        display: none;
    }
    
    /* Ensure smooth transitions */
    .collapsible-filter .filter-content {
        transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    }
    
    .collapsible-filter:not(.expanded) .filter-content {
        padding-top: 0;
        padding-bottom: 0;
    }
}

/* Desktop: ensure all filters are always expanded */
@media (min-width: 769px) {
    .collapsible-filter .filter-content {
        max-height: none !important;
        overflow: visible !important;
    }
    
    .collapsible-filter.expanded .filter-content {
        max-height: none;
    }
}

/* Sticky loading banner */
.loading-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: #333;
    padding: 16px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
}

.loading-banner.visible {
    transform: translateY(0);
}

.loading-banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 1200px;
    margin: 0 auto;
    gap: 12px;
}

.loading-text {
    font-weight: 600;
    font-size: 1rem;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #333;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive adjustments for loading banner */
@media (max-width: 768px) {
    .loading-banner {
        padding: 12px;
    }
    
    .loading-text {
        font-size: 0.9rem;
    }
    
    .loading-spinner {
        width: 18px;
        height: 18px;
    }
}

/* Itinerary section */
.itinerary-section {
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.itinerary-section h3 {
    margin-bottom: 20px;
    color: #495057;
    font-size: 1.3rem;
}

.itinerary-container {
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    justify-content: flex-start;
    gap: 20px;
}

.empty-itinerary {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-style: italic;
}

.itinerary-date {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 15px;
    transition: all 0.3s ease;
    max-width: 350px;
}

.itinerary-date:hover {
    border-color: #28a745;
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.1);
}

.itinerary-date-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #dee2e6;
}

.itinerary-date-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #28a745;
    display: flex;
    align-items: center;
    gap: 8px;
}

.itinerary-vendor-count {
    background: #28a745;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.itinerary-vendors {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.itinerary-vendor {
    background: #e3f2fd;
    color: #1976d2;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.itinerary-vendor:hover {
    background: #bbdefb;
    transform: translateY(-1px);
}

.itinerary-vendor .remove {
    background: #1976d2;
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.itinerary-vendor .remove:hover {
    background: #1565c0;
    transform: scale(1.1);
}

.itinerary-add-to-calendar {
    align-self: flex-start;
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.itinerary-add-to-calendar:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.itinerary-add-to-calendar:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Vendor grid */
.vendor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.vendor-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    border: 2px solid transparent;
}

.vendor-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.vendor-card.selected {
    border-color: #28a745;
    background: #f8fff8;
}

.vendor-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.vendor-logo {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    background: #f8f9fa;
}

.vendor-info h3 {
    color: #2c3e50;
    margin-bottom: 5px;
    font-size: 1.2rem;
}

.vendor-type {
    background: #e9ecef;
    color: #495057;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.vendor-location {
    background: #fff3cd;
    color: #856404;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 4px;
    display: block;
}

.vendor-bio {
    color: #6c757d;
    font-size: 14px;
    margin-bottom: 15px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.vendor-dates {
    margin-bottom: 15px;
}

.vendor-dates h4 {
    color: #495057;
    font-size: 14px;
    margin-bottom: 8px;
}

.dates-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.date-tag {
    background: #fff3cd;
    color: #856404;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.vendor-categories {
    margin-bottom: 10px;
}

.vendor-categories h4 {
    color: #495057;
    font-size: 14px;
    margin-bottom: 8px;
}

.categories-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.category-tag {
    background: #d1ecf1;
    color: #0c5460;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.vendor-links {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.vendor-link {
    color: #007bff;
    text-decoration: none;
    font-size: 12px;
    padding: 4px 8px;
    border: 1px solid #007bff;
    border-radius: 4px;
    transition: all 0.2s;
}

.vendor-link:hover {
    background: #007bff;
    color: white;
}

/* Stats */
.stats {
    text-align: center;
    color: #6c757d;
    font-size: 14px;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .filters {
        gap: 15px;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-group select,
    .filter-group button {
        min-width: auto;
        width: 100%;
    }
    
    #searchBox {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .vendor-grid {
        grid-template-columns: 1fr;
    }
    
    .itinerary-date-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .itinerary-vendors {
        margin-bottom: 8px;
    }
    
    .itinerary-vendor {
        font-size: 0.8rem;
        padding: 5px 10px;
    }
    
    .itinerary-add-to-calendar {
        width: 100%;
        justify-content: center;
        padding: 10px 16px;
    }
}

/* Loading state */
.loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: #495057;
}

/* Modern Multi-Select Filter Styles */
.filter-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: #fafafa;
}

.filter-checkbox {
    position: relative;
    display: inline-block;
}

.filter-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.filter-checkbox-label {
    display: inline-block;
    padding: 6px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #495057;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    white-space: nowrap;
}

.filter-checkbox-label:hover {
    border-color: #28a745;
    color: #28a745;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

.filter-checkbox input[type="checkbox"]:checked + .filter-checkbox-label {
    background: #28a745;
    border-color: #28a745;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.filter-checkbox input[type="checkbox"]:focus + .filter-checkbox-label {
    outline: 2px solid #28a745;
    outline-offset: 2px;
}

/* Disabled checkbox styles */
.filter-checkbox input[type="checkbox"]:disabled + .filter-checkbox-label,
.filter-checkbox-label.disabled {
    background: #f8f9fa;
    border-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.filter-checkbox input[type="checkbox"]:disabled + .filter-checkbox-label:hover,
.filter-checkbox-label.disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Select/Deselect All buttons */
.filter-controls {
    display: flex;
    justify-content: space-evenly;
    gap: 8px;
    margin-bottom: 8px;
    width: 100%;
}

.filter-control-btn {
    padding: 4px 8px;
    font-size: 0.75rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-control-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

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

/* Responsive adjustments */
@media (max-width: 768px) {    
    .filter-checkbox-label {
        font-size: 0.8rem;
        padding: 5px 10px;
    }
}

@media (min-width: 769px) {
    .filters {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .filter-info {
        grid-column: 1 / -1;
    }
    
    .search-group {
        grid-column: 1 / -1;
    }
}
