/**
 * CBT City Pages Stylesheet
 *
 * Styles for the city discovery pages: /c/{state}--{city}/events
 * Scoped to .cbt-city-discovery body class where possible.
 *
 * Components:
 *  1. Hero image support
 *  2. Location pill ("Browsing events in › City, ST")
 *  3. Location dropdown menu
 *  4. Category tabs
 *  5. Event grid
 *  6. Event cards
 *  7. Loading & empty states
 *  8. Google Places autocomplete
 *  9. Responsive breakpoints
 *
 * @package CBT_Events_Marketplace
 * @version 5.1.0
 */

/* ==========================================================================
   1. HERO BANNER
   The hero is rendered as a standalone div in the shortcode output.
   Background image is set inline via PHP (waterfall lookup).
   Matches the live site's full-width, left-aligned style.
   ========================================================================== */

.cbt-city-hero {
    position: relative;
    padding: 100px 40px;
    margin: 20px 0 30px 0;
    border-radius: 8px;
    min-height: 200px;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    text-align: left;
    overflow: hidden;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.cbt-city-hero-title {
    font-size: 28px;
    font-weight: 600;
    color: #ffffff !important;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6), 0 0 20px rgba(0,0,0,0.3);
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.3;
    letter-spacing: 0.5px;
    font-family: var(--heading-font-family, 'Playfair Display', Georgia, 'Times New Roman', serif);
    -webkit-text-fill-color: #ffffff !important;
    background-clip: unset !important;
    -webkit-background-clip: unset !important;
}

div.cbt-city-hero h1.cbt-city-hero-title,
.cbt-city-hero h1,
h1.cbt-city-hero-title {
    color: #ffffff !important;
    font-size: 28px !important;
    margin: 0 !important;
    padding: 0 !important;
    -webkit-text-fill-color: #ffffff !important;
    background: none !important;
    background-clip: unset !important;
    -webkit-background-clip: unset !important;
}

/* ==========================================================================
   2. LOCATION PILL  ("Browsing events in › City, ST")
   ========================================================================== */

.cbt-city-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

.cbt-locpill {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 15px;
    color: #6b7280;
    position: relative;
    flex-wrap: wrap;
}

.cbt-loc-label {
    color: #374151;
    white-space: nowrap;
    font-size: 15px;
}

.cbt-locline {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.cbt-loccarat {
    color: #9ca3af;
    font-size: 16px;
    margin: 0 2px;
}

/* City name display */
.cbt-loc-city {
    font-weight: 600;
    color: #1a1a2e;
    cursor: pointer;
    transition: color 0.2s;
}

.cbt-loc-city:hover {
    color: #8B2E2E;
}

/* Change button */
.cbt-locchange {
    background: none;
    border: none;
    color: #8B2E2E;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.cbt-locchange:hover {
    background: rgba(139, 46, 46, 0.08);
    color: #6b1f1f;
}

/* Inline city text input — looks like plain text, becomes editable on focus */
.cbt-loc-input {
    border: none;
    outline: none;
    background: transparent;
    font-weight: 600;
    font-size: 15px;
    color: #1a1a2e;
    font-family: inherit;
    padding: 2px 0;
    cursor: pointer;
    min-width: 80px;
    width: auto;
    display: none; /* hidden until "Change" is clicked */
}

.cbt-loc-input.active {
    display: inline-block;
    cursor: text;
    border-bottom: 2px solid #8B2E2E;
}

.cbt-loc-input:focus {
    cursor: text;
    border-bottom: 2px solid #8B2E2E;
    color: #1a1a2e;
}

.cbt-loc-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

/* Chevron icon next to city name */
.cbt-locpill .cbt-loc-chevron {
    font-size: 12px;
    color: #9ca3af;
    transition: transform 0.2s;
    cursor: pointer;
}

.cbt-locpill.open .cbt-loc-chevron {
    transform: rotate(180deg);
}

/* ==========================================================================
   3. LOCATION DROPDOWN MENU
   ========================================================================== */

#cbt-city-locmenu,
.cbt-city-locmenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    border: 1px solid #e5e7eb;
    width: 320px;
    z-index: 1000;
    overflow: hidden;
    max-height: 400px;
    overflow-y: auto;
}

#cbt-city-locmenu.open,
.cbt-city-locmenu.open {
    display: block;
}

.cbt-cloc-box {
    padding: 0;
}

.cbt-cloc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cbt-cloc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
    color: #374151;
}

.cbt-cloc-item:last-child {
    border-bottom: none;
}

.cbt-cloc-item:hover {
    background: #f9fafb;
}

.cbt-cloc-item i,
.cbt-cloc-item .cbt-cloc-icon {
    color: #8B2E2E;
    width: 20px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

.cbt-cloc-geo i { color: #3659e3 !important; }
.cbt-cloc-all i { color: #00a32a !important; }

.cbt-cloc-item .cbt-cloc-text {
    flex: 1;
    min-width: 0;
}

.cbt-cloc-item .cbt-cloc-title {
    font-weight: 600;
    color: #1a1a2e;
    font-size: 14px;
    line-height: 1.3;
}

.cbt-cloc-item .cbt-cloc-subtitle {
    font-size: 12px;
    color: #9ca3af;
    line-height: 1.3;
    margin-top: 1px;
}

/* Search results in dropdown */
.cbt-cloc-item.cbt-cloc-search-result {
    border-bottom: 1px solid #f3f4f6;
}

/* Separator between static options and search results */
.cbt-cloc-separator {
    height: 1px;
    background: #e5e7eb;
    margin: 4px 0;
}

/* ==========================================================================
   4. CATEGORY TABS
   ========================================================================== */

.cbt-city-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.cbt-city-tab {
    padding: 8px 18px;
    border-radius: 20px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
}

.cbt-city-tab:hover {
    border-color: #8B2E2E;
    color: #8B2E2E;
}

.cbt-city-tab.active {
    background: #1a1a2e;
    color: #fff;
    border-color: #1a1a2e;
}

/* ==========================================================================
   5. EVENT GRID
   ========================================================================== */

.cbt-city-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    transition: opacity 0.3s ease;
}

/* ==========================================================================
   6. EVENT CARDS
   Shared card styles — also used by the events_listing shortcode.
   Scoped with .cbt-city-grid parent for specificity.
   ========================================================================== */

.cbt-city-grid .cbt-event-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.cbt-city-grid .cbt-event-card:hover {
    border-color: #cfaf86;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    transform: translateY(-4px);
}

.cbt-city-grid .cbt-event-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.cbt-city-grid .cbt-event-image {
    position: relative;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
}

.cbt-city-grid .cbt-event-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.cbt-city-grid .cbt-event-card:hover .cbt-event-image img {
    transform: scale(1.05);
}

.cbt-city-grid .cbt-event-info {
    padding: 16px;
}

.cbt-city-grid .cbt-event-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 10px;
    color: #1a1a2e;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cbt-city-grid .cbt-event-location,
.cbt-city-grid .cbt-event-date {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cbt-city-grid .cbt-event-location i,
.cbt-city-grid .cbt-event-date i {
    color: #9ca3af;
    width: 14px;
    flex-shrink: 0;
}

.cbt-city-grid .cbt-event-price {
    font-size: 15px;
    font-weight: 600;
    color: #8B2E2E;
    margin: 12px 0 0;
}

/* ==========================================================================
   7. LOADING & EMPTY STATES
   ========================================================================== */

.cbt-city-loading {
    text-align: center;
    padding: 40px;
    display: none;
}

.cbt-city-loading .spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: #8B2E2E;
    border-radius: 50%;
    animation: cbt-city-spin 0.8s linear infinite;
}

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

.cbt-city-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    font-size: 15px;
    grid-column: 1 / -1;
}

.cbt-city-empty i {
    display: block;
    font-size: 48px;
    color: #d1d5db;
    margin-bottom: 16px;
}

.cbt-city-empty p {
    margin: 0 0 4px 0;
    line-height: 1.6;
}

.cbt-city-empty p:first-of-type {
    font-weight: 600;
    color: #39364f;
    font-size: 16px;
}

/* Fallback message (e.g., "No events in X. Showing Y state events.") */
.cbt-city-fallback-msg {
    grid-column: 1 / -1;
    text-align: center;
    padding: 14px 20px;
    color: #856404;
    font-size: 14px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 8px;
    margin-bottom: 12px;
}

.cbt-city-fallback-msg i {
    margin-right: 6px;
    color: #f9a825;
}

/* ==========================================================================
   8. GOOGLE PLACES AUTOCOMPLETE
   Override the default pac-container styles to match our design.
   ========================================================================== */

.pac-container {
    z-index: 10000 !important;
    border-radius: 12px !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12) !important;
    font-family: inherit !important;
    min-width: 320px !important;
    margin-top: 4px !important;
    overflow: hidden;
}

.pac-item {
    padding: 10px 16px !important;
    font-size: 14px !important;
    cursor: pointer !important;
    border-top: 1px solid #f3f4f6 !important;
    line-height: 1.4 !important;
}

.pac-item:first-child {
    border-top: none !important;
}

.pac-item:hover {
    background: #f9fafb !important;
}

.pac-icon {
    display: none !important;
}

.pac-item-query {
    font-weight: 600 !important;
    color: #1a1a2e !important;
    font-size: 14px !important;
}

.pac-matched {
    font-weight: 700 !important;
}

/* ==========================================================================
   9. RESPONSIVE BREAKPOINTS
   ========================================================================== */

/* Tablet: 3 columns */
@media (max-width: 1024px) {
    .cbt-city-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

/* Small tablet / large phone: 2 columns */
@media (max-width: 768px) {
    /* Hero */
    .cbt-city-hero {
        padding: 60px 20px;
        min-height: 200px;
        margin-top: 16px;
        margin-bottom: 20px;
        background-position: center 20% !important;
    }

    .cbt-city-hero-title {
        font-size: 22px !important;
    }

    /* Grid */
    .cbt-city-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    /* Location pill */
    .cbt-locpill {
        flex-wrap: wrap;
        gap: 6px;
    }

    /* Dropdown */
    #cbt-city-locmenu,
    .cbt-city-locmenu {
        width: 280px;
    }

    /* Category tabs */
    .cbt-city-tabs {
        gap: 6px;
    }

    .cbt-city-tab {
        padding: 6px 14px;
        font-size: 13px;
    }
}

/* Phone: 1 column */
@media (max-width: 480px) {
    .cbt-city-grid {
        grid-template-columns: 1fr;
    }

    .cbt-city-container {
        padding: 0 12px;
    }

    #cbt-city-locmenu,
    .cbt-city-locmenu {
        width: calc(100vw - 48px);
        left: -8px;
    }

    .cbt-locpill {
        font-size: 14px;
    }

    .cbt-loc-input {
        font-size: 14px;
    }
}
