/* ============================================================
   Destination Deals — styles.css
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: #e8e8e8;
    padding: 20px;
    font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
    color: #333;
}

.container { max-width: 900px; margin: 0 auto; padding: 20px; padding-top: 0; padding-bottom: 100px; }

/* ── Hero ──────────────────────────────────────────────────── */
.hero {
    text-align: center;
    padding: 28px 24px;
    border-radius: 14px;
    background-color: rgba(255,255,255,.94);
    margin-top: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,.08);
}

/* Postcard image logo */
.hero-logo-img {
    width: 420px;
    max-width: 90%;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 0 auto 14px;
}

.tagline {
    font-size: 1.05rem;
    color: #555;
    max-width: 520px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ── Location banner ───────────────────────────────────────── */
.location-banner {
    display: none;
    align-items: center;
    gap: 12px;
    background: #e7f1ff;
    border: 1px solid #b8d4ff;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.location-banner-icon { font-size: 1.4rem; flex-shrink: 0; }

.location-banner-text { flex: 1; min-width: 180px; }
.location-banner-text strong {
    display: block;
    font-size: 0.95rem;
    color: #0056b3;
    margin-bottom: 2px;
}
.location-banner-text span { font-size: 0.85rem; color: #495057; }

.location-allow-btn {
    padding: 8px 18px;
    background: #007BFF;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.location-allow-btn:hover { background: #0056b3; }

.location-dismiss-btn {
    padding: 8px 14px;
    background: transparent;
    color: #6c757d;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    white-space: nowrap;
}
.location-dismiss-btn:hover { background: #f1f3f5; }

/* ── Filters ───────────────────────────────────────────────── */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    background: rgba(255,255,255,.96);
    padding: 18px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.filter-group   { flex: 1; min-width: 150px; position: relative; }
.search-group   { min-width: 280px; flex: 2; }
.sort-group     { min-width: 140px; }

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 13px;
    color: #555;
}

select, input[type="text"] {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    color: #333;
    appearance: none;
    -webkit-appearance: none;
}

select:focus, input[type="text"]:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.18);
}

/* ── Autocomplete ──────────────────────────────────────────── */
.autocomplete-dropdown {
    display: none;
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: white;
    border: 1px solid #ced4da;
    border-top: none;
    border-radius: 0 0 6px 6px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    max-height: 200px;
    overflow-y: auto;
}

.autocomplete-item {
    padding: 9px 14px;
    font-size: 14px;
    cursor: pointer;
    border-bottom: 1px solid #f1f3f5;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: #f1f3f5; }

/* ── Results meta ──────────────────────────────────────────── */
.results-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

#dealCount { font-weight: 700; font-size: 15px; color: #1a1a2e; }

.filter-tags { display: flex; gap: 8px; flex-wrap: wrap; }

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #e7f1ff;
    color: #0056b3;
    border-radius: 20px;
    padding: 3px 10px 3px 12px;
    font-size: 12px;
    font-weight: 600;
}

.filter-tag button {
    background: none;
    border: none;
    color: #0056b3;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: auto;
}

/* ── Deal cards ────────────────────────────────────────────── */
.deal-card {
    background: white;
    padding: 16px 18px;
    margin-bottom: 12px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    transition: box-shadow .18s ease;
}

.deal-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.11); }
.deal-card:last-child { margin-bottom: 120px; }

/* ── Card summary row ──────────────────────────────────────── */
.card-summary {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.card-summary-left {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-summary-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.card-summary-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.business-name-sm {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.3;
}

.deal-count-pill {
    display: inline-block;
    background: #f1f3f5;
    color: #555;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    white-space: nowrap;
}

.card-preview-block {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.deal-preview-row {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.deal-preview-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
}

.deal-preview-desc {
    font-size: 0.78rem;
    color: #888;
    font-style: italic;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Expand button ─────────────────────────────────────────── */
.expand-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #ced4da;
    background: white;
    color: #495057;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
    flex-shrink: 0;
    line-height: 1;
}

.expand-btn:hover,
.deal-card.expanded .expand-btn {
    border-color: #007BFF;
    color: #007BFF;
    background: #e7f1ff;
}

/* Badges */
.discount-badge {
    display: inline-block;
    background: #2c6db2;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 20px;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.distance-badge {
    display: inline-block;
    background: #f1f3f5;
    color: #495057;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

/* End date badge — shown inline in collapsed preview title */
.enddate-badge {
    display: inline-block;
    background: #fff3cd;
    color: #856404;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    white-space: nowrap;
    vertical-align: middle;
    margin-left: 4px;
    letter-spacing: 0.02em;
}

/* End date line in expanded deal row */
.enddate-meta {
    color: #856404;
    font-weight: 600;
    font-size: 0.82rem;
}


/* ── Amenity icons ──────────────────────────────────────────── */
.amenity-icons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 6px 0 2px;
}

.amenity-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: default;
    position: relative;
}

/* CSS-only tooltip using data-tooltip — no browser native title duplication */
.amenity-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    background: #1a1a2e;
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s;
    z-index: 50;
}

/* Desktop hover only — on mobile this never fires so no accidental triggers */
@media (hover: hover) {
    .amenity-icon:hover::after { opacity: 1; }
}

/* ── Amenity badges (expanded card) ────────────────────────── */
.amenity-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.amenity-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f0faf2;
    color: #1e7e34;
    border: 1px solid #c3e6cb;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
}


/* ── Amenity legend popup (mobile tap) ────────────────────── */
.amenity-legend {
    position: absolute;
    background: #1a1a2e;
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 6px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 500;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s, transform 0.15s;
}

.amenity-legend.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── Card detail ───────────────────────────────────────────── */
.card-detail {
    display: none;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #f1f3f5;
}

.card-detail.open { display: block; }

.address {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 14px;
    overflow-wrap: break-word;
}

/* ── Deal sub-rows ─────────────────────────────────────────── */
.deal-rows-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 14px;
}

.deal-row {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px 14px;
}

.deal-row-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.deal-row-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1a1a2e;
}

.deal-row-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.82rem;
    color: #555;
    line-height: 1.6;
}

/* ── Card footer ───────────────────────────────────────────── */
.card-footer {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.website-btn, .directions-btn {
    flex: 1;
    min-width: 130px;
    text-align: center;
    padding: 11px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.875rem;
    color: white;
    transition: opacity .15s;
}

.website-btn    { background-color: #2c6db2; }
.directions-btn { background-color: #4a7c59; }
.website-btn:hover, .directions-btn:hover { opacity: .88; }

/* ── Empty / loading ───────────────────────────────────────── */
.welcome-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    text-align: center;
    color: #6c757d;
    font-size: 15px;
    line-height: 1.6;
}

.loading {
    text-align: center;
    font-size: 1rem;
    padding: 30px;
    color: #6c757d;
}



/* ── Alphabet jump bar ─────────────────────────────────────── */
.alphabet-bar {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 8px 2px;
    margin-bottom: 12px;
    scroll-snap-type: x mandatory;
}
.alphabet-bar::-webkit-scrollbar { display: none; }

.alpha-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    scroll-snap-align: start;
    transition: background 0.12s, color 0.12s;
}

.alpha-btn.active {
    background: #2c6db2;
    color: white;
}
.alpha-btn.active:hover {
    background: #0056b3;
}
.alpha-btn.inactive {
    background: #f1f3f5;
    color: #ced4da;
    cursor: default;
}


/* ── Full page background (cross-browser) ─────────────────── */
#bgLayer {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -2;
    background-image: url('images/backgrounds/default_background.png');
    background-size: 450px 450px;
    background-repeat: repeat;
}
#bgOverlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1;
    background-color: rgba(255,255,255,0.78);
}

/* ── Consumer nav bar ──────────────────────────────────────── */
.consumer-nav {
    background: rgba(255,255,255,0.97);
    border-bottom: 1px solid rgba(0,0,0,.08);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    border-radius: 0 0 12px 12px;
}

.nav-logo { display: flex; align-items: center; text-decoration: none; }

.nav-logo-img {
    height: 44px;
    width: auto;
    border-radius: 4px;
    display: block;
}

.nav-links { display: flex; align-items: center; gap: 6px; }

.nav-link {
    padding: 6px 14px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.nav-link:hover { background: #f1f3f5; color: #1a1a2e; }
.nav-link.active { background: #e7f1ff; color: #2c6db2; }

/* ── Back to top button ────────────────────────────────────── */
.back-to-top {
    position: fixed;
    bottom: 80px;
    right: 20px;
    padding: 10px 16px;
    background: #2c6db2;
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(44,109,178,.35);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
    z-index: 300;
    font-family: inherit;
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.back-to-top:hover { background: #0056b3; }

/* ── Desktop ───────────────────────────────────────────────── */
@media (min-width: 769px) {
    .card-summary  { cursor: default; margin-bottom: 10px; }
    .expand-btn    { display: none; }
    .card-detail   {
        display: block !important;
        margin-top: 0;
        padding-top: 0;
        border-top: none;
    }
    .business-name-sm { font-size: 1.35rem; }
    .deal-card        { padding: 20px 22px; margin-bottom: 16px; }
    .deal-card:hover  { transform: translateY(-2px); }
    .deal-preview-desc { -webkit-line-clamp: unset; overflow: visible; }
}

/* ── Mobile ────────────────────────────────────────────────── */
@media (max-width: 768px) {
    body          { padding: 10px; }
    .container    { padding: 10px; }
    .hero         { padding: 20px 14px; }
    .hero-logo-img { width: 85%; }
    .filters      { flex-direction: column; }
    .filter-group { min-width: 100%; }
    .location-banner { gap: 10px; }
    .card-summary-right { flex-wrap: wrap; justify-content: flex-end; }
}

@media (max-width: 400px) {
    .hero-logo-img { width: 95%; }
    .tagline       { font-size: 0.95rem; }
}

/* ── Edge browser fallback ─────────────────────────────────── */
@supports (-ms-ime-align: auto) {
    body { background: #f0ece4 !important; }
    #bgLayer, #bgOverlay { display: none !important; }
}