.market-card {
    height: 77px;
    min-width: 180px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 2px solid rgba(148, 163, 184, 0.4);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: grid;
    grid-auto-rows: 1fr;
    row-gap: 6px;
    align-items: center;
}

.market-row {
    display: grid;
    grid-template-columns: 20px 1fr auto;
    align-items: center;
    column-gap: 8px;
}

.market-row-icon { width: 22px; height: 22px; }
.market-row-label { font-size: 12px; font-weight: 700; color: #1e293b; }
.market-row-value { font-size: 13px; font-weight: 800; color: #1e293b; }

/* Trend arrows - stock market style */
.trend-arrow {
    font-size: 16px;
    margin-left: 5px;
    display: inline-block;
    font-weight: bold;
    line-height: 1;
}
.trend-arrow.trend-up {
    color: #22c55e;  /* Bright Green for price increase */
}
.trend-arrow.trend-down {
    color: #ef4444;  /* Red for price decrease */
}
.trend-arrow.trend-flat {
    color: #64748b;  /* Neutral gray for no change */
    font-size: 15px;  /* Slightly larger for visibility */
}

.market-card-title {
    font-size: 0.8rem;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 6px;
    text-align: center;
    padding: 0; /* title has no padding; adjust data body instead */
}

/* Market carousel wrapper */
.market-carousel {
    position: relative;
    overflow: hidden;
    grid-column: 1 / -1;
    display: contents;
}

/* Market card data wrapper: unified with title (no separate padding) */
.market-card-body {
    display: contents;
}

/* Market slides - carousel animation */
.market-slide {
    display: none;
}

.market-slide.active {
    display: contents;
}

/* Align market stat rows into shared columns like a mini table */
.market-stat-card {
    display: grid;
    grid-template-columns: 24px auto 1fr;
    column-gap: 10px;
    row-gap: 8px;
    align-items: center;
    text-align: left; /* override .stat-card center */
    cursor: pointer;
    transition: all 0.3s ease;
}

.market-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.15);
}

.market-stat-card .market-card-title { grid-column: 1 / -1; margin-bottom: 2px; text-align: center; }
.market-stat-card .market-row { display: contents; }
.market-stat-card .market-row-icon { justify-self: start; }
.market-stat-card .market-row-label { justify-self: start; }
.market-stat-card .market-row-value { justify-self: end; text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 768px) {
    .cta-row {
        grid-auto-flow: row;
        justify-items: center;
        gap: 10px;
    }
    .market-card {
        height: auto;
        min-width: 240px;
        width: calc(100% - 30px);
        justify-self: center;
    }
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #6a788d 0%, #455163 100%);
    min-height: 100vh;
    color: #333;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

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

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 5px;
    max-width: 700px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.logo {
    height: auto;
    margin-bottom: 0;
}

.logo-left {
    width: auto;
    max-width: 50%;
}

.logo-right {
    width: auto;
    max-width: 50%;
}

/* Make logo links not interfere with logo sizing */
.logo-container a {
    display: contents; /* This makes the link "transparent" for layout purposes */
}

/* Search Overlay Styles */
.search-box {
    position: relative;
}

/* Header CTA row */
.cta-row {
    width: fit-content;
    margin: 8px auto 16px auto;
    display: grid;
    grid-auto-flow: column;
    gap: 10px;
}
.market-chips--stack {
    display: grid;
    grid-auto-flow: row;
    gap: 8px;
    align-self: center;
}

.market-chips--stack .market-chip {
    height: 77px;
    min-width: 180px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 2px solid rgba(148, 163, 184, 0.4);
    background: rgba(255, 255, 255, 0.9);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.market-chips--stack .chip-label {
    font-size: 11px;
    font-weight: 700;
    color: #1e293b;
}

.market-chips--stack .chip-value {
    font-size: 14px;
    font-weight: 800;
    color: #1e293b;
}

@media (max-width: 768px) {
    .market-chips--stack {
        grid-auto-flow: column;
        grid-auto-columns: max-content;
        overflow-x: auto;
    }
    .market-chips--stack .market-chip { height: auto; min-width: unset; }
}

.cta-btn {
    width: 77px;
    height: 77px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border-radius: 10px;
    border: 2px solid rgba(148, 163, 184, 0.4);
    background: rgba(255, 255, 255, 0.9);
    color: #1e293b;
    text-decoration: none;
    font-weight: 600;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(0,0,0,0.12);
    background: #ffffff;
}

.btn-icon {
    width: 48px;
    height: 48px;
    display: block;
    object-fit: contain;
}


.btn-label {
    font-size: 11px;
    font-weight: 600;
    color: inherit;
    line-height: 1;
    text-align: center;
}

/* PAYWALL CODE - SAVED FOR FUTURE USE display none vs flex */
.search-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none !important; /* TEMPORARILY HIDDEN - REMOVE THIS LINE TO RE-ENABLE PAYWALL */
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    backdrop-filter: blur(2px);
}

.overlay-signin-btn {
    transition: background-color .3s, box-shadow .3s;
    
    padding: 12px 16px 12px 42px;
    border: none;
    border-radius: 3px;
    box-shadow: 0 -1px 0 rgba(0, 0, 0, .04), 0 1px 1px rgba(0, 0, 0, .25);
    
    color: #757575;
    font-size: 14px;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
    
    background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNMTcuNiA5LjJsLS4xLTEuOEg5djMuNGg0LjhDMTMuNiAxMiAxMyAxMyAxMiAxMy42djIuMmgzYTguOCA4LjggMCAwIDAgMi42LTYuNnoiIGZpbGw9IiM0Mjg1RjQiIGZpbGwtcnVsZT0ibm9uemVybyIvPjxwYXRoIGQ9Ik05IDE4YzIuNCAwIDQuNS0uOCA2LTIuMmwtMy0yLjJhNS40IDUuNCAwIDAgMS04LTIuOUgxVjEzYTkgOSAwIDAgMCA4IDV6IiBmaWxsPSIjMzRBODUzIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48cGF0aCBkPSJNNCAxMC43YTUuNCA1LjQgMCAwIDEgMC0zLjRWNUgxYTkgOSAwIDAgMCAwIDhsMy0yLjN6IiBmaWxsPSIjRkJCQzA1IiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48cGF0aCBkPSJNOSAzLjZjMS4zIDAgMi41LjQgMy40IDEuM0wxNSAyLjNBOSA5IDAgMCAwIDEgNWwzIDIuNGE1LjQgNS40IDAgMCAxIDUtMy43eiIgZmlsbD0iI0VBNDMzNSIgZmlsbC1ydWxlPSJub256ZXJvIi8+PHBhdGggZD0iTTAgMGgxOHYxOEgweiIvPjwvZz48L3N2Zz4=);
    background-color: white;
    background-repeat: no-repeat;
    background-position: 12px 11px;
    cursor: pointer;
}

.overlay-signin-btn:hover {
    box-shadow: 0 -1px 0 rgba(0, 0, 0, .04), 0 2px 4px rgba(0, 0, 0, .25);
}

.overlay-signin-btn:active {
    background-color: #eeeeee;
}

.overlay-signin-btn:focus {
    outline: none;
    box-shadow: 
        0 -1px 0 rgba(0, 0, 0, .04),
        0 2px 4px rgba(0, 0, 0, .25),
        0 0 0 3px #c8dafc;
}

.overlay-signin-btn:disabled {
    filter: grayscale(100%);
    background-color: #ebebeb;
    box-shadow: 0 -1px 0 rgba(0, 0, 0, .04), 0 1px 1px rgba(0, 0, 0, .25);
    cursor: not-allowed;
}


/* Auth Section Styles */
.logout-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 5px;
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.logout-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    font-size: 14px;
    padding: 8px 16px;
}

.logout-btn:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.user-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

#userEmail {
    color: white;
    font-weight: 500;
}

.about-link {
    color: #ffffff;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s ease;
}

.about-link:hover {
    color: #cbd5e1;
}

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

.search-section {
    margin-bottom: 10px;
}

.search-box {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

/* Market Snapshot Styles */
.market-snapshot {
    margin: 10px auto 5px auto;
    max-width: 1000px;
}

.market-chips {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.market-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(255,255,255,0.92);
    border: 1px solid rgba(148,163,184,0.4);
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.chip-icon {
    width: 18px;
    height: 18px;
    display: inline-block;
}

.chip-label {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 700;
}

.chip-value {
    font-size: 0.95rem;
    color: #1f2937;
    font-weight: 800;
}

@media (max-width: 768px) {
    .market-snapshot { margin: 10px 15px 5px 15px; }
    .chip-value { font-size: 0.9rem; }
}

.category-filters {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin: 30px 0;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
    justify-content: center;
}

/* Desktop: match widths of products to category buttons (1000px) */
@media (min-width: 769px) {
    .products-container,
    .table-container,
    .pagination-container {
        max-width: 1000px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Tablet range: 769px to 1000px - add 15px margins */
@media (min-width: 769px) and (max-width: 1000px) {
    .stats {
        margin-left: 15px !important;
        margin-right: 15px !important;
        margin-bottom: 30px;
    }
    
    .category-filters {
        margin-left: 15px;
        margin-right: 15px;
    }
}

.category-btn {
    background: rgba(255, 255, 255, 0.6);
    border: 2px solid rgba(148, 163, 184, 0.4);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 15px 8px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-height: 100px;
}

.category-icon {
    width: 60px;
    height: 60px;
    transition: all 0.3s ease;
}

.category-label {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
    transition: all 0.3s ease;
}

.category-btn:hover {
    transform: translateY(-6px);
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(102, 126, 234, 0.4);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.category-btn:hover .category-icon {
    transform: scale(1.1);
    filter: brightness(1.1) saturate(1.2);
}

.category-btn:hover .category-label {
    color: #374151;
    font-weight: 600;
}

.category-btn.active {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #f97316;
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.3);
}

.category-btn.active .category-icon {
    transform: scale(1.05);
    filter: brightness(1.2) saturate(1.3);
}

.category-btn.active .category-label {
    color: #1e293b;
    font-weight: 600;
}



select, input {
    width: 100%;
    padding: 12px 45px 12px 16px; /* Add right padding for clear button */
    border: none;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

select:focus, input:focus {
    outline: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transform: translateY(-1px);
}

.clear-search {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    color: #64748b;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-search:hover {
    background-color: #f1f5f9;
    color: #dc2626;
}

.clear-search.show {
    opacity: 1;
    visibility: visible;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    min-width: 0; /* Allow flex shrinking */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #374c73;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.products-container {
    display: block; /* Remove all styling - just a plain container */
}

.loading {
    text-align: center;
    padding: 40px;
    font-size: 1.2rem;
    color: #666;
}

.table-container {
    background: white;
    overflow: hidden;
    overflow-x: auto;
}

.products-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.products-table thead {
    background: #374c73;
    color: white;
}

.products-table th {
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}



.products-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.products-table tbody tr:hover {
    background-color: #f8f9fa;
}

.products-table tbody tr:last-child td {
    border-bottom: none;
}

.product-name-cell {
    font-weight: 600;
    color: #333;
}

.brand-name {
    color: #667eea;
    font-size: 0.8rem;
    margin-top: 2px;
}

.category-badge {
    background: #667eea;
    color: white;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    display: inline-block;
    margin-bottom: 4px;
}

.product-info-container {
    display: flex;
    align-items: center;
}

.product-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.product-text .product-name {
    font-weight: 600;
    color: #333;
    line-height: 1.2;
    font-size: 0.9rem;
    margin-bottom: 0;
    word-break: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
    max-width: 30ch;
}

.product-text .brand-name {
    color: #667eea;
    font-size: 0.75rem;
    line-height: 1.1;
}

.category-icon-inline {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    display: inline-block;
}

.dispensary-cell {
    font-weight: 500;
    color: #495057;
}

/* Hide space on desktop (dash is shown) */
.dispo-space {
    display: none;
}

.potency-cell {
    color: #28a745;
    font-weight: 600;
}

.weight-cell {
    background: #fff3cd;
    color: #856404;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-block;
}

.price-cell {
    font-size: 1.1rem;
    font-weight: 700;
    color: #28a745;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.1rem;
}

.product-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    line-height: 1.3;
    word-break: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
    max-width: 30ch;
}

.product-brand {
    color: #667eea;
    font-weight: 500;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.product-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: #28a745;
    margin-bottom: 10px;
}

.product-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 15px;
    font-size: 0.85rem;
}

.product-detail {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.product-detail span:first-child {
    color: #666;
    font-weight: 500;
}

.product-detail span:last-child {
    color: #333;
    font-weight: 600;
}

.product-weight {
    background: #f8f9fa;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
    text-align: center;
    margin-top: 10px;
}



.category-badge {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 10px;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.1rem;
}

/* Mobile Responsive Styles - Consolidated */
@media (max-width: 768px) {
    /* Body and Container */
    body {
        margin: 0;
        padding: 0;
        overflow-x: hidden;
    }
    
    .container {
        padding: 15px 15px 15px 15px;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    /* Header */
    header h1 {
        font-size: 2rem;
    }
    /* Keep Home/About/Map/Data in one row with smaller buttons */
    .cta-row {
        width: 100%;
        grid-template-columns: repeat(4, 69px);
        grid-auto-flow: row;
        justify-content: center;
        justify-items: center;
        column-gap: 8px;
        row-gap: 8px;
    }
    
    .cta-btn {
        width: 69px;
        height: 69px;
        gap: 2px;
    }
    
    .btn-icon {
        width: 43px;
        height: 43px;
    }
    
    .btn-label {
        font-size: 10px;
    }
    
    .market-card { grid-column: 1 / -1; margin-top: 2px; }
    
    /* Category Filters */
    .category-filters {
        grid-template-columns: repeat(6, 1fr);
        gap: 6px;
        margin: 20px 15px;
    }
    
    .category-btn {
        padding: 20px 6px;
        min-height: 90px;
    }
    
    .category-icon {
        width: 45px;
        height: 45px;
    }
    
    .category-label {
        font-size: 0.65rem;
    }
    
    /* Stats Cards */
    .stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        margin: 0 15px 20px 15px;
    }
    .market-stat-card { grid-column: 1 / -1; }
    
    .stat-card {
        padding: 12px 8px;
        min-height: 80px;
    }
    
    .stat-number {
        font-size: 1.3rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    /* Products Container */
    .products-container {
        margin: 0 -15px;
        padding: 0;
        width: 100vw;
        position: relative;
        left: 50%;
        right: 50%;
        margin-left: -50vw;
        margin-right: -50vw;
    }
    
    /* Table Styles */
    .table-container {
        overflow-x: auto;
        width: 100%;
        background: white;
        margin: 0;
        padding: 0;
    }
    
    .products-table {
        font-size: 0.75rem;
        width: 100%;
        background: white;
        margin: 0;
    }
    
    .products-table th,
    .products-table td {
        padding: 6px 4px;
    }
    
    /* Hide TAC and CBD columns on mobile */
    .products-table th:nth-child(4),
    .products-table td:nth-child(4),
    .products-table th:nth-child(5),
    .products-table td:nth-child(5) {
        display: none;
    }
    
    /* Hide cents on mobile prices */
    .price-cents {
        display: none;
    }
    
    /* Hide dash in dispensary name on mobile, show space instead */
    .dispo-dash {
        display: none;
    }
    
    .dispo-space {
        display: inline;
    }
    
    /* Product Text */
    .product-text .product-name {
        font-size: 0.8rem;
    }
    
    .product-text .brand-name {
        font-size: 0.7rem;
    }
    
    /* Modal Styles */
    .modal-content {
        width: 95%;
        margin: 2% auto;
        max-height: 90vh;
    }
    
    .modal-header {
        flex-direction: row;
        gap: 10px;
        align-items: center;
        justify-content: space-between;
    }
    
    .modal-header h2 {
        font-size: 1.2rem;
    }
    
    .header-controls {
        align-self: stretch;
        justify-content: center;
    }
    
    .header-btn {
        flex: 1;
        text-align: center;
    }
    
    .dispensary-item {
        padding: 10px;
    }
    
    .dispensary-name {
        font-size: 0.9rem;
    }
    
    .dispensary-location {
        font-size: 0.8rem;
    }
    
    .product-count {
        font-size: 0.7rem;
        padding: 2px 6px;
    }
    
    /* Pagination */
    .pagination-container {
        gap: 6px;
        padding: 20px 15px;
        margin: 20px auto;
        max-width: 95%;
    }
    
    .pagination-btn {
        padding: 8px 10px;
        font-size: 0.8rem;
        min-width: 36px;
        border-radius: 6px;
    }
    
    .pagination-ellipsis {
        padding: 8px 4px;
        font-size: 0.8rem;
    }
}

/* Extra small screens - scale down category buttons further */
@media (max-width: 600px) {
    .category-filters {
        gap: 6px;
        margin: 20px 15px;
    }
    
    .category-btn {
        padding: 14px 2px;
        min-height: 60px;
    }
    
    .category-icon {
        width: 32px;
        height: 32px;
    }
    
    .category-label {
        display: none;
    }
}

/* Ultra small screens - prevent cutoff */
@media (max-width: 500px) {
    .category-filters {
        gap: 4px;
        margin: 15px 15px;
        overflow-x: visible;
    }
    
    .category-btn {
        padding: 8px 1px;
        min-height: 48px;
        flex-shrink: 1;
        min-width: 0;
    }
    
    .category-icon {
        width: 30px;
        height: 30px;
    }
}


/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
    overflow: hidden;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    flex: 1;
}

.header-controls {
    display: flex;
    gap: 8px;
}

.header-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.2s;
    line-height: 1.5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.close:hover,
.close:focus {
    opacity: 0.7;
}

.modal-body {
    padding: 20px;
    max-height: 50vh;
    overflow-y: auto;
}



.dispensaries-list {
    display: grid;
    gap: 12px;
}

/* Smart Filters - Two column layout on all screens */
#productFiltersList {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.dispensary-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #eff6ff;
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
}

.dispensary-item:hover {
    background: #bfdbfe;
}

.dispensary-item.selected {
    background: #eff6ff;
}

.dispensary-item.selected:hover {
    background: #bfdbfe;
}

.dispensary-checkbox {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #3b82f6;
}

/* Ensure checkboxes in products modal display properly */
#productFiltersList .dispensary-checkbox[type="checkbox"] {
    appearance: auto;
    -webkit-appearance: checkbox;
    -moz-appearance: checkbox;
}

/* All modals now use consistent dispensary-item styling */

/* Override any conflicting filter-item styles */
#productsModal .filter-item {
    display: none !important;
}

.dispensary-info {
    flex: 1;
}

.dispensary-name {
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 4px 0;
}

.dispensary-location {
    font-size: 0.9rem;
    color: #64748b;
}

.product-count {
    background: #e2e8f0;
    color: #475569;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-left: 8px;
}

.modal-footer {
    background: #f8fafc;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.modal-footer .apply-btn {
    flex: 1;
    max-width: 120px;
    text-align: center;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
}

.apply-btn {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
}

.apply-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.clear-btn {
    background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    margin-right: 12px;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.4);
}

/* Product Filter Styles */
.filters-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
}

/* OLD FILTER STYLES - DISABLED
.filter-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    transition: all 0.2s ease;
}

.filter-item:hover {
    background: rgba(248, 250, 252, 1);
    border-color: #c3b5f5;
    transform: translateY(-1px);
}
*/

.filter-checkbox {
    position: relative;
    cursor: pointer;
    user-select: none;
    min-width: 20px;
    display: flex;
    align-items: center;
}

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

.filter-checkbox .checkmark {
    position: relative;
    height: 20px;
    width: 20px;
    background-color: #fff;
    border: 2px solid #ddd;
    border-radius: 4px;
    display: inline-block;
    transition: all 0.3s ease;
}

.filter-checkbox:hover .checkmark {
    border-color: #8b5cf6;
}

.filter-checkbox input:checked ~ .checkmark {
    background-color: #8b5cf6;
    border-color: #8b5cf6;
}

.filter-checkbox .checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 4px;
    top: 0px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.filter-checkbox input:checked ~ .checkmark:after {
    display: block;
}

.filter-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-name {
    font-weight: 600;
    color: #374151;
    font-size: 1rem;
    margin: 0;
}

.filter-description {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0;
}

/* Clickable stat card */
.stat-card.clickable {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border: 2px solid transparent;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.9) 100%);
}

.stat-card.clickable:before {
    content: "\f013";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.99rem;
    transition: all 0.3s ease;
    color: #374c73;
    text-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
}

.stat-card.clickable.filter-active:before {
    content: "\f013";
    color: #f97316;
    opacity: 1;
    transform: scale(1.3);
    text-shadow: 0 0 15px rgba(249, 115, 22, 0.7);
    animation: pulse-filter 1s infinite;
}

.stat-card.clickable:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(79, 70, 229, 0.2);
    border-color: rgba(79, 70, 229, 0.3);
    background: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(239, 246, 255, 0.95) 100%);
}

.stat-card.clickable:hover:before {
    opacity: 1;
    transform: scale(1.15);
    color: #4338ca;
    text-shadow: 0 0 8px rgba(67, 56, 202, 0.4);
}

/* Filter icon pulse animation */
@keyframes pulse-filter {
    0%, 100% {
        text-shadow: 0 0 15px rgba(249, 115, 22, 0.7);
        transform: scale(1.3);
        opacity: 1;
    }
    50% {
        text-shadow: 0 0 25px rgba(249, 115, 22, 1);
        transform: scale(1.6);
        opacity: 0.8;
    }
}

/* About Modal Content */
.about-content h3 {
    color: #1e293b;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 20px 0 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.about-content h3:first-child {
    margin-top: 0;
}

.about-content p {
    color: #475569;
    line-height: 1.6;
    margin: 10px 0;
}

.about-content ul {
    color: #475569;
    line-height: 1.6;
    margin: 10px 0;
    padding-left: 20px;
}

.about-content li {
    margin: 5px 0;
}

.about-content strong {
    color: #1e293b;
    font-weight: 600;
}

.stat-card.clickable:after {
    content: "👆 Click to filter";
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.9);
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
    background: rgba(79, 70, 229, 0.8);
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.stat-card.clickable:hover:after {
    opacity: 1;
}

.stat-card.clickable:active {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(79, 70, 229, 0.3);
}


/* Dispensary link styling */
.dispensary-link {
    color: #4a90e2;
    text-decoration: none;
    transition: color 0.2s ease;
}

.dispensary-link:hover {
    color: #357abd;
    text-decoration: underline;
}

.dispensary-link:visited {
    color: #6b46c1;
}

/* Pagination Styles */
.pagination-container {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 30px auto;
    padding: 25px 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    max-width: 800px;
    width: fit-content;
}

.pagination-btn {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    color: #495057;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    min-width: 45px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.pagination-btn:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    border-color: #adb5bd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.pagination-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
    font-weight: 700;
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.3);
}

.pagination-btn.active:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6b4d9e 100%);
    border-color: #5a6fd8;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.4);
}

.pagination-ellipsis {
    color: #6c757d;
    padding: 10px 6px;
    font-size: 0.9rem;
    font-weight: 600;
}



/* Logo styling */
#logoImageRight {
    cursor: pointer;
    transition: transform 0.2s ease;
}

#logoImageRight:hover {
    transform: scale(1.05);
}

#logoImageLeft {
    cursor: default;
    transition: transform 0.2s ease;
}

#logoImageLeft:hover {
    transform: scale(1.05);
}

/* Strong override: align market averages as a 3-column grid inside stat card */
.stats .stat-card.market-stat-card {
    display: grid !important;
    grid-template-columns: 24px auto 1fr;
    column-gap: 12px;
    row-gap: 8px;
    align-items: center;
    text-align: left !important;
}

.stats .stat-card.market-stat-card .market-card-title {
    grid-column: 1 / -1;
    text-align: center !important;
    margin-bottom: 2px;
}

.stats .stat-card.market-stat-card .market-row { display: contents !important; }
.stats .stat-card.market-stat-card .market-row-icon { justify-self: start; }
.stats .stat-card.market-stat-card .market-row-label { justify-self: start; }
.stats .stat-card.market-stat-card .market-row-value { justify-self: end; text-align: right; font-variant-numeric: tabular-nums; }

/* When the market card is moved below filters on mobile, keep the 3-column layout */
@media (max-width: 768px) {
    .market-card-mobile.market-stat-card {
        display: grid !important;
        grid-template-columns: 36px 1fr auto; /* give icons and prices breathing room */
        column-gap: 1px;
        row-gap: 10px;
        align-items: center;
        text-align: left !important;
        width: 100%;
        max-width: 600px; /* match search box */
        margin: 12px auto 20px auto; /* center and match spacing */
        padding-left: 60px; /* global inner spacing for body; heading is separate */
        padding-right: 60px;
    }
    .market-card-mobile.market-stat-card .market-card-title { grid-column: 1 / -1; text-align: center !important; }
    .market-card-mobile.market-stat-card .market-row { display: contents !important; }
    .market-card-mobile.market-stat-card .market-row-icon { justify-self: center; }
    .market-card-mobile.market-stat-card .market-row-label { justify-self: start; padding-left: 2px; }
    .market-card-mobile.market-stat-card .market-row-value { justify-self: end; text-align: right; font-variant-numeric: tabular-nums; padding-right: 2px; transform: translateX(-10px); }
}