/* Directory-specific styles for Launceston Chamber of Commerce */
/* Fixed layout, sizing, and refinement issues */
/* Updated with right-aligned view selector */

/* Reset and ensure full width */
* {
    box-sizing: border-box;
}

/* Hero Section - Full width blue background */
.directory-hero {
    background: linear-gradient(135deg, #28c4f1 0%, #1ea3d4 100%);
    padding: 6rem 0 4rem;
    margin-top: 80px;
    position: relative;
    overflow: hidden;
    color: white;
    text-align: center;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
}

.directory-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 60px 60px;
    background-position: 0 0, 30px 30px;
    opacity: 0.3;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.hero-content h1 {
    font-family: 'Crimson Text', serif;
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 600;
    color: white;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.hero-content p {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    max-width: 700px;
    margin: 0 auto 3rem;
    line-height: 1.6;
    font-weight: 400;
}

/* Stats Grid - Clean layout */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    max-width: 900px;
    margin: 0 auto;
}

.stat-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.stat-number {
    font-family: 'Crimson Text', serif;
    font-size: 2.5rem;
    font-weight: 600;
    color: white;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Controls Section - Better spacing and layout */
.directory-controls-section {
    width: 100%;
    background: var(--white);
    padding: 2rem 0;
    margin-top: -3rem;
    position: relative;
    z-index: 10;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.directory-controls {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(40, 196, 241, 0.1);
}

/* Controls Header - Title on left, view selector on right */
.controls-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    width: 100%;
}

.controls-top-row h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex-shrink: 0;
}

/* View Selector - Positioned to the far right */
.view-selector {
    display: flex;
    background: var(--light-gray);
    border-radius: 12px;
    padding: 4px;
    border: 1px solid var(--border-gray);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-left: auto;
    flex-shrink: 0;
}

.view-btn {
    padding: 0.875rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    min-height: 44px;
    white-space: nowrap;
    min-width: 90px;
    justify-content: center;
}

.view-btn.active {
    background: var(--white);
    color: var(--primary-blue);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

.view-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.7);
    color: var(--primary-blue);
}

/* Search Section - Full width under title row */
.search-section {
    margin-bottom: 1.5rem;
    width: 100%;
}

.search-container {
    position: relative;
    width: 100%;
    max-width: none;
}

.search-input {
    width: 100%;
    padding: 1.25rem 1.25rem 1.25rem 3.5rem;
    border: 2px solid var(--border-gray);
    border-radius: 12px;
    font-size: 1rem;
    background: var(--white);
    transition: all 0.2s ease;
    min-height: 56px;
    font-family: inherit;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 4px rgba(40, 196, 241, 0.1);
}

.search-input::placeholder {
    color: var(--text-muted);
    font-size: 1rem;
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 20px;
    height: 20px;
    pointer-events: none;
}

/* Filters Row - Centered and same width as search */
.filters-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    width: 100%;
    max-width: none;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-select {
    padding: 1rem 1.25rem;
    border: 2px solid var(--border-gray);
    border-radius: 10px;
    background: var(--white);
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
    font-family: inherit;
    min-height: 48px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 3rem;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 4px rgba(40, 196, 241, 0.1);
}

/* Action Buttons - Updated to remove export */
.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.action-buttons .btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    text-transform: none;
    letter-spacing: 0;
    min-height: 48px;
    white-space: nowrap;
}

/* Hide export directory button */
#export-directory {
    display: none;
}

/* Results Container - Better spacing */
.results-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Results Header */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-gray);
    flex-wrap: wrap;
    gap: 1rem;
}

.results-count {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.sort-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sort-container label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.sort-select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-gray);
    border-radius: 8px;
    background: var(--white);
    font-size: 0.9rem;
    min-width: 160px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(40, 196, 241, 0.1);
}

/* Business Grid - Better spacing and refined layout */
.businesses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
    padding: 1rem 0;
}

.business-card {
    background: var(--white);
    border: 2px solid var(--border-gray);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    min-height: 300px;
    display: flex;
    flex-direction: column;
}

.business-card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(-4px);
    border-color: var(--primary-blue);
}

/* Chamber Member Styling */
.business-card.chamber-member {
    border-color: var(--primary-blue);
    background: linear-gradient(135deg, #ffffff 0%, #fafcfe 100%);
    box-shadow: 0 8px 24px rgba(40, 196, 241, 0.15);
}

.chamber-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: var(--primary-blue);
    color: var(--white);
    padding: 0.4rem 0.8rem;
    border-radius: 16px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    box-shadow: 0 2px 8px rgba(40, 196, 241, 0.3);
    z-index: 10;
}

/* Business Header */
.business-header {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    margin-top: 2.5rem; /* Space for chamber badge */
    position: relative;
}

.business-logo {
    width: 64px;
    height: 64px;
    background: var(--light-gray);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 1.25rem;
    border: 2px solid var(--border-gray);
    flex-shrink: 0;
    transition: all 0.3s ease;
    overflow: hidden;
}

.business-card.chamber-member .business-logo {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #1ea3d4 100%);
    color: var(--white);
    border-color: var(--primary-blue);
    box-shadow: 0 4px 12px rgba(40, 196, 241, 0.3);
}

.business-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.business-info {
    flex: 1;
    min-width: 0;
}

.business-info h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
    word-break: break-word;
}

.business-category {
    font-size: 0.75rem;
    color: var(--primary-blue);
    font-weight: 600;
    background: rgba(40, 196, 241, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 16px;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.business-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

/* Business Contacts */
.business-contacts {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.75rem;
    background: var(--off-white);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.contact-item:hover {
    background: var(--light-gray);
    color: var(--primary-blue);
}

.contact-item.incomplete-address {
    border-left: 3px solid var(--warning-orange);
    background: rgba(245, 158, 11, 0.05);
}

.contact-icon {
    width: 16px;
    height: 16px;
    color: var(--primary-blue);
    flex-shrink: 0;
}

.contact-item a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
    word-break: break-all;
}

.contact-item:hover a {
    color: var(--primary-blue);
}

.address-note {
    display: block;
    font-size: 0.75em;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.incomplete-address {
    opacity: 0.7;
    font-style: italic;
}

/* Business Actions */
.business-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: auto;
}

.business-actions .btn {
    flex: 1;
    min-width: 120px;
    text-align: center;
    padding: 0.875rem;
    font-size: 0.85rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* List View */
.businesses-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.business-list-item {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    background: var(--white);
    border: 2px solid var(--border-gray);
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.business-list-item:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-blue);
    transform: translateY(-2px);
}

.business-list-item.chamber-member {
    border-color: var(--primary-blue);
    background: linear-gradient(135deg, #ffffff 0%, #fafcfe 100%);
}

.business-list-logo {
    width: 56px;
    height: 56px;
    background: var(--light-gray);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 1.1rem;
    border: 2px solid var(--border-gray);
    flex-shrink: 0;
    overflow: hidden;
}

.business-list-item.chamber-member .business-list-logo {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #1ea3d4 100%);
    color: var(--white);
    border-color: var(--primary-blue);
}

.business-list-info {
    flex: 1;
    min-width: 0;
}

.business-list-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.business-list-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.business-list-details {
    display: flex;
    gap: 2rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
    align-items: center;
}

.business-list-actions {
    display: flex;
    gap: 1rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.business-list-actions .btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.85rem;
    white-space: nowrap;
    border-radius: 8px;
    font-weight: 600;
}

/* Map View */
.map-view {
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.map-container {
    height: 500px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    position: relative;
    border: 2px solid var(--border-gray);
}

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

.map-controls {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.map-control-btn {
    background: var(--white);
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    padding: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: var(--text-secondary);
}

.map-control-btn:hover {
    background: var(--light-gray);
    border-color: var(--primary-blue);
    color: var(--primary-blue);
    transform: translateY(-2px);
}

.map-legend {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    z-index: 1000;
    background: var(--white);
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-gray);
    max-width: 200px;
}

.legend-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

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

.legend-marker {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--white);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.legend-marker.chamber {
    background: var(--primary-blue);
}

.legend-marker.business {
    background: var(--text-muted);
}

/* Map Notice */
.map-notice {
    background: var(--light-gray);
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Loading and Empty States */
.loading-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-gray);
    border-top: 3px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

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

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--light-gray);
    border-radius: 12px;
    border: 2px solid var(--border-gray);
    margin: 2rem 0;
}

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

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    font-size: 1rem;
    line-height: 1.6;
}

/* Custom Map Markers */
.custom-marker {
    background: white;
    border: 2px solid #64748b;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    color: #64748b;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.custom-marker.chamber {
    border-color: #28c4f1;
    color: #28c4f1;
    background: linear-gradient(135deg, #ffffff 0%, #fafcfe 100%);
}

.marker-content {
    font-size: 10px;
    font-weight: 600;
}

.map-popup h4 {
    margin: 0 0 0.5rem 0;
    color: #0f172a;
    font-size: 1rem;
}

.map-popup p {
    margin: 0.25rem 0;
    color: #64748b;
    font-size: 0.875rem;
}

.map-popup a {
    color: #28c4f1;
    text-decoration: none;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .hero-content,
    .directory-controls,
    .results-container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    .businesses-grid {
        grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
        gap: 1.5rem;
    }

    .filters-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .directory-hero {
        padding: 4rem 0 3rem;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .hero-content p {
        font-size: 1.1rem;
        margin-bottom: 2rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .directory-controls {
        padding: 1.5rem;
    }

    .controls-top-row {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .controls-top-row h2 {
        text-align: center;
        margin-bottom: 0;
    }

    .view-selector {
        margin-left: 0;
        align-self: center;
        justify-content: center;
    }

    .filters-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .action-buttons {
        justify-content: stretch;
    }

    .action-buttons .btn {
        flex: 1;
        justify-content: center;
    }

    .results-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        text-align: center;
    }

    .businesses-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .business-list-item {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        gap: 1rem;
    }

    .business-list-header {
        align-self: stretch;
        justify-content: center;
        text-align: center;
    }

    .business-list-actions {
        align-self: stretch;
        justify-content: center;
    }

    .map-container {
        height: 400px;
    }

    .map-legend {
        position: relative;
        bottom: auto;
        right: auto;
        margin-top: 1rem;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .directory-hero {
        padding: 3rem 0 2rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-card {
        padding: 1.25rem;
    }

    .directory-controls {
        padding: 1rem;
    }

    .business-card {
        padding: 1.5rem;
    }

    .chamber-badge {
        position: static;
        margin-bottom: 1rem;
        align-self: flex-start;
    }

    .business-header {
        margin-top: 0;
    }

    .business-actions {
        flex-direction: column;
    }

    .business-actions .btn {
        min-width: auto;
    }

    .search-input {
        padding: 1rem 1rem 1rem 3rem;
    }

    .search-icon {
        left: 1rem;
    }

    .view-btn {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
        min-width: 80px;
    }
}