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

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

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

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

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

.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: 30px;
}

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

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

.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-color: #ffffff;
    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(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.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);
}

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

.stat-label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.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: #667eea;
    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;
}

@media (max-width: 768px) {
    body {
        margin: 0;
        padding: 0;
        overflow-x: hidden;
    }
    
    .category-filters {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        margin: 20px 0;
    }
    
    .category-btn {
        padding: 12px 6px;
        min-height: 90px;
    }
    
    .category-icon {
        width: 45px;
        height: 45px;
    }
    
    .category-label {
        font-size: 0.65rem;
    }
    
    .container {
        padding: 15px 15px 15px 15px;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .products-container {
        margin: 0 -15px; /* Extend products section to full width */
        padding: 0;
        width: 100vw;
        position: relative;
        left: 50%;
        right: 50%;
        margin-left: -50vw;
        margin-right: -50vw;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .category-filters {
        gap: 10px;
    }
    
    .category-btn {
        padding: 10px 16px;
        font-size: 0.8rem;
    }
    
    .table-container {
        overflow-x: auto;
        width: 100%;
        background: white; /* Ensure white background covers full width */
        margin: 0;
        padding: 0;
    }
    
    .products-table {
        font-size: 0.75rem;
        width: 100%;
        background: white; /* White background for table */
        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;
    }
    
    .stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .product-text .product-name {
        font-size: 0.8rem;
    }
    
    .product-text .brand-name {
        font-size: 0.7rem;
    }
}

/* 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;
}

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

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



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

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

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

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

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

.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: flex-end;
}

.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;
}

.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;
}

.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;
}

.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;
}

.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: 6px;
    top: 2px;
    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: "\f0b0";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 1.1rem;
    opacity: 0.8;
    transition: all 0.3s ease;
    color: #6366f1;
    text-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
}

.stat-card.clickable.filter-active:before {
    content: "\f0b0";
    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);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 2% auto;
        max-height: 90vh;
    }
    
    .modal-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .header-controls {
        align-self: stretch;
        justify-content: center;
    }
    
    .header-btn {
        flex: 1;
        text-align: center;
    }
    
    .close {
        position: absolute;
        top: 15px;
        right: 20px;
    }
    
    .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;
    }
}

/* 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;
}

@media (max-width: 768px) {
    .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;
    }
}