/* Clean up z-index hierarchy */
:root {
    --z-base: 1000;
    --z-overlay: 1100;
    --z-popup: 1200;
    --z-popup-content: 1300;
    --z-popup-close: 1400;
    --z-share-menu: 1004;
}

/* Base elements */
.sticky-button {
    z-index: var(--z-base);
}

/* Overlays */
#filter-overlay,
#saved-items-overlay {
    z-index: var(--z-overlay);
    pointer-events: none; /* Only active when visible */
}

#filter-overlay.open,
#saved-items-overlay.open {
    pointer-events: auto;
}

/* Popups */
#filter-popup,
#saved-items-popup {
    z-index: var(--z-popup);
}

/* Popup content */
.popup-close,
#saved-items-close {
    z-index: var(--z-popup-close);
}

/* Share menus */
.share-menu,
.share-menu.active {
    z-index: var(--z-share-menu);
}

/* Overlay styling */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: var(--z-overlay);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.overlay.open {
    pointer-events: auto;
    opacity: 1;
}

/* Popup styling */
.popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 500px;
    background: #fff;
    padding: 0;
    border-radius: 15px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    z-index: var(--z-popup);
}

/* Header section */
.popup-header {
    position: relative;
    padding: 20px;
    text-align: center;
    background: white;
}

.popup-title {
    font-family: 'Anton', sans-serif;
    font-size: 1.8em;
    color: var(--primary-color);
    margin: 0;
    letter-spacing: 0.5px;
}

.popup-price {
    font-family: 'Lato', sans-serif;
    font-size: 1.6em;
    color: var(--secondary-color);
    font-weight: 400; /* Reduced weight */
    margin: 8px 0;
}

.popup-price.crossed {
    font-size: 1.2em;
    text-decoration: line-through;
    color: #999;
    font-weight: 300;
}

.popup-description {
    font-size: 1.1em;
    color: var(--dark-color);
    margin: 5px 0 0;
    font-family: 'Lato', sans-serif;
}

/* Close button */
.popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.8em;
    cursor: pointer;
    color: var(--primary-color);
    opacity: 0.8;
    transition: opacity 0.2s ease;
    z-index: var(--z-popup-close);
}

.popup-close:hover {
    opacity: 1;
}

/* Image styling */
.popup-image-placeholder {
    width: 100%;
    height: 280px;
    margin: 0;
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
    display: none; /* Hide by default */
}

.popup-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

/* Details section */
.popup-details {
    padding: 20px;
    background: white;
}

/* Category styling */
.popup-details .category {
    font-family: 'Anton', sans-serif;
    color: var(--primary-color);
    font-size: 1.1em;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-weight: 300;  /* Lighter weight */
    text-align: center; /* Center the text */
}

/* Tags styling */
.popup-details .tags {
    margin: 12px 0;
    text-align: center;
    color: var(--dark-color);
    font-family: 'Lato', sans-serif;
    font-size: 1.1em;
    font-weight: 400 !important;
    padding-right: 10px !important;
    display: flex;
    justify-content: center;
    gap: 25px !important; /* Space between tags */
}

/* Color the hashtag symbol */
.popup-details .tags {
    color: var(--dark-color);
}

.popup-details .tags::first-letter,
.popup-details .tags > span::first-letter {
    color: var(--secondary-color);
}

/* Remove any background or border */
.popup-details .tags span {
    background: transparent;
    border: none;
}

/* Optional hover effect */
.popup-details .tag:hover {
    background-color: #e8e8e8;
}

/* Contains styling */
.contains {
    margin-top: 12px;
    padding: 10px 15px;
    background: #f8f8f8;
    border-radius: 8px;
    font-size: 0.95em;
    color: var(--dark-color);
}

.contains strong {
    color: var(--primary-color);
    margin-right: 5px;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    /* Adjust popup container */
    .popup {
        width: 100%;
        padding: 0;
        border-radius: 12px;
        max-height: 85vh; /* Slightly smaller height */
    }

    /* Reduce header padding */
    .popup-header {
        padding: 12px 10px 8px;
    }

    .popup-title {
        font-size: 1.5em;
        margin: 0;
    }

    .popup-price {
        margin: 4px 0;
    }

    .popup-description {
        margin: 4px 0 0;
        font-size: 1em;
    }

    /* Adjust image height */
    .popup-image-placeholder {
        height: 200px; /* Smaller image */
    }

    /* Reduce details section padding */
    .popup-details {
        padding: 12px 10px;
    }

    /* Adjust category spacing */
    .popup-details .category {
        margin-bottom: 8px;
        font-size: 1em;
    }

    /* Reduce tags spacing */
    .popup-details .tags {
        margin: 8px 0;
        gap: 15px !important;
        font-size: 0.95em;
    }

    /* Adjust contains section */
    .contains {
        margin-top: 8px;
        padding: 8px 10px;
        font-size: 0.9em;
    }

    /* Filter sections spacing */
    #filter-categories,
    #filter-tags,
    #filter-without {
        padding: 0 8px !important;
        margin-bottom: 12px !important;
    }

    /* Reduce buttons container spacing */
    .filter-buttons {
        margin-top: 12px;
        padding: 8px;
    }
}

/*------ SAVED ITEMS POPUP ------*/

#saved-items-button {
    padding: 10px !important;
    margin-bottom: 2px;
}

/* Saved Items Popup Styling */
#saved-items-popup {
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevent double scrollbars */
}

#saved-items-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

/* Make the items section scrollable */
.saved-items-rows {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    margin-bottom: 10px;
    /* Reduce padding-bottom to minimize empty space */
    padding-bottom: 20px;
}

/* Fixed footer with subtotal and actions */
.saved-items-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 15px;
    border-top: 1px solid #eee;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 2; /* Lower than share menu */
}

.saved-items-subtotal {
    text-align: center;
    font-weight: bold;
    font-size: 1.2em;
    margin-bottom: 10px;
}

.saved-items-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

/* Style the scrollbar */
.saved-items-rows::-webkit-scrollbar {
    width: 8px;
}

.saved-items-rows::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.saved-items-rows::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.saved-items-rows::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Footer section */
.saved-items-footer {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.saved-items-subtotal {
    text-align: center;
    font-weight: bold;
    font-size: 1.2em;
    padding: 15px 0;
    margin-top: 10px;
    border-top: 1px solid #eee;
}

.saved-items-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    position: relative;
}

/* Fixed header */
.popup-title {
    text-align: center;
    font-size: 1.5em;
    margin: 0;
    padding: 10px 0;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 2;
}

/* Scrollable items container */
.saved-items-rows {
    max-height: calc(50vh - 150px); /* Adjust height to account for header and footer */
    overflow-y: auto;
    margin: 10px 0;
    padding-right: 10px;
}

/* Scrollbar styling */
.saved-items-rows::-webkit-scrollbar {
    width: 8px;
}

.saved-items-rows::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.saved-items-rows::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.saved-items-rows::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Fixed footer */
.saved-items-subtotal {
    background: #fff;
    padding: 10px 0;
    margin: 0;
    border-top: 1px solid #eee;
    position: sticky;
    bottom: 0;
    z-index: 2;
}

.saved-items-actions {
    background: #fff;
    padding: 10px 0;
    margin: 0;
    position: sticky;
    bottom: 0;
    z-index: 2;
}

/* Add shadow to indicate scrollable content */
.saved-items-rows::after {
    content: '';
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(to top, rgba(255,255,255,1), rgba(255,255,255,0));
    pointer-events: none;
}

/* Style the scrollbar for better appearance */
#saved-items-content::-webkit-scrollbar {
    width: 8px;
}

#saved-items-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#saved-items-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

#saved-items-content::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Ensure the subtotal and buttons stay fixed at the bottom */
.saved-items-subtotal,
.saved-items-actions {
    background-color: #fff;
    position: sticky;
    bottom: 0;
    padding: 10px 0;
    margin-bottom: 0;
}

/* Add a subtle shadow to indicate there's more content */
.saved-items-subtotal {
    box-shadow: 0 -4px 6px -6px rgba(0, 0, 0, 0.1);
}

/* Popup title */
.popup-title {
    text-align: center;
    font-size: 1.5em;
    margin-bottom: 10px; /* Reduced margin-bottom */
    margin-top: 0; /* Remove margin-top */
}

.no-items-message {
    text-align: center;
    font-size: 1em;
    color: var(--dark-color);
    margin-top: 20px;
}

.saved-item-row {
    width: calc(100% - 20px); /* Full width minus padding */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    margin-bottom: 5px;
    background-color: #f9f9f9;
    border-radius: 5px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.saved-item-id {
    display: none;
    min-width: 40px; /* Give some minimum width to ID */
    font-style: italic;
    color: var(--primary-color);
}

.saved-item-name {
    flex: 1; /* Allow name to take available space */
    margin: 0 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: bold;
}

.saved-item-price {
    min-width: 60px; /* Give some minimum width to price */
    text-align: right;
    color: var(--dark-color); /* Dark-greish color for price */
    font-weight: bold;
}

.saved-items-subtotal {
    margin-top: var(--spacing-medium);
    font-weight: bold;
    font-size: 1.2em;
    text-align: center; /* Center the subtotal */
    margin-top: 20px; /* Add margin-top */
    z-index: 1101; /* Higher z-index for subtotal */
    position: relative;
}

#delete-all-button {
    padding: 8px 16px;
    background-color: var(--primary-color); /* Red color for delete action */
    color: white;
    border: none;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    font-size: 14px;
    height: 36px; /* Match height with share button */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

#saved-items-close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 2em;
    cursor: pointer;
    color: #000;
    z-index: 1000;
}

#saved-items-close:hover {
    color: var(--primary-color);
}

/* Overlay Styling */
#saved-items-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
}

#saved-items-overlay.open {
    display: block;
}






/*------ FILTER POPUP -------*/

#filter-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%; /* Slightly wider for better usability on mobile */
    max-width: 700px;
    background: #fff;
    padding: 20px 10px !important; /* Increased from 8px */
    box-shadow: var(--box-shadow);
    border-radius: var(--border-radius-large);
    z-index: 1001;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

#filter-popup.open {
    opacity: 1;
}

#filter-content {
    text-align: left;
    position: relative; /* Ensure the close button is positioned relative to the popup */
}

#filter-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
}

#apply-filter-button {
    padding: var(--spacing-medium) var(--spacing-large); /* Increase padding for larger button */
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    font-size: 1.1em; /* Ensure font size is consistent */
}

#reset-filter-button {
    padding: var(--spacing-small) var(--spacing-medium); /* Smaller padding */
    background-color: transparent; /* No background color */
    color: var(--primary-color);
    border: 2px solid var(--primary-color); /* Border with main color */
    border-radius: var(--border-radius-small);
    cursor: pointer;
    font-size: 0.8em; /* Slightly smaller font size */
}

/* Style for filter buttons container */
.filter-buttons {
    display: flex;
    justify-content: center; /* Center the buttons */
    margin-top: 25px !important; /* Increased from 20px */
    gap: 8px; /* Reduced from 10px */
    padding: 0 10px;
}

#apply-filter-button:hover {
    background-color: var(--secondary-color);
}

#reset-filter-button:hover {
    color: var(--secondary-color)
}

.sticky-button {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: var(--spacing-small) var(--spacing-small); /* Reduced padding */
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    z-index: 1000;
}

.search-filter-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-small);
}

#search-input {
    flex-grow: 1;
    margin-right: var(--spacing-small);
    padding: var(--spacing-small);
    border: 1px solid var(--greish-color);
    border-radius: var(--border-radius-small);
}

#filter-button {
    padding: var(--spacing-small);
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: var(--border-radius-small);
    cursor: pointer;
}

#filter-button:hover {
    background-color: var(--secondary-color);
}

/* Hide the default radio buttons and checkboxes */
.filter-category-checkbox,
.filter-tag-checkbox,
.filter-without-checkbox { /* Add allergens */
    display: none;
}

/* Style the labels to look like buttons */
.filter-category-checkbox + label, .filter-tag-checkbox + label, .filter-without-checkbox + label {
    display: inline-block;
    padding: 4px 8px; /* Reduced padding */
    margin: 2px; /* Reduced margin */
    font-size: 12px;
    background-color: var(--menu-color);
    border: 1px solid var(--dark-color);
    border-radius: var(--border-radius-small);
    cursor: pointer;
    transition: background-color var(--transition-duration) var(--transition-timing);
}

/* Active state for the category buttons */
.filter-category-checkbox:checked + label {
    background-color: var(--primary-color);
    color: #fff;
}

/* Active state for the tag and allergen buttons */
.filter-tag-checkbox:checked + label,
.filter-without-checkbox:checked + label { /* Add allergens */
    background-color: var(--secondary-color);
    color: #fff;
}

/* Layout for categories, tags, and allergens */
#filter-categories,
#filter-tags,
#filter-without { /* Add allergens */
    margin-bottom: 25px !important; /* Increased from 20px */
    padding: 0 20px !important; /* Increased from 10px */
}

/* Center Categories and Tags, left-align Without */
#filter-categories,
#filter-tags {
    text-align: center;
}

#filter-without {
    text-align: left;
}

/* Container for title and items */
#filter-categories > div:first-child,
#filter-tags > div:first-child {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    text-align: center !important;
}

#filter-without > div:first-child {
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    width: 100% !important;
    text-align: left !important;
}

/* Style for the items container */
#filter-categories > div:not(:first-child),
#filter-tags > div:not(:first-child),
#filter-without > div:not(:first-child) {
    display: inline-block;
    margin: 2px;
}

/* Adjust title styling */
#filter-categories h3, #filter-tags h3, #filter-without h3 {
    font-size: 14px; /* Reduced from 16px */
    margin-bottom: 4px; /* Reduced from 8px */
    padding-bottom: 2px; /* Reduced from 4px */
    display: inline-block; /* Ensure they align correctly with reset button */
    margin-right: 0 !important;
    text-align: center !important;
}

#filter-without h3 {
    margin-right: 0 !important;
    text-align: left !important;
}

/* Style the reset button */
.reset-button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8em; /* Make it smaller */
    color: var(--primary-color); /* Use primary color for visibility */
    margin-left: 8px;
}

/* Media query for mobile devices */
@media (max-width: 600px) {
    .popup, #saved-items-popup, #filter-popup {
        width: 90% !important; /* Slightly wider for better usability on mobile */
    }

    .filter-category-checkbox + label,
    .filter-tag-checkbox + label,
    .filter-without-checkbox + label {
        padding: 3px 6px; /* Further reduced padding for mobile */
        margin: 1px; /* Further reduced margin for mobile */
        font-size: 12px; /* Consistent smaller font size */
    }

    .search-filter-container {
        flex-direction: row;
        align-items: center;
    }

    #filter-button {
        width: auto;
        margin-top: 0;
    }

    #filter-categories h3,
    #filter-tags h3,
    #filter-without h3 {
        font-size: 14px; /* Smaller font size */
        margin-bottom: 4px; /* Reduced margin */
    }

    #filter-popup {
        padding: 6px;
        max-height: 85vh; /* Limit maximum height on mobile */
        overflow-y: auto; /* Make the entire popup scrollable if needed */
    }

    #filter-categories,
    #filter-tags,
    #filter-without {
        margin-bottom: 8px;
    }

    .filter-buttons {
        margin-top: 10px;
        padding-bottom: 5px;
    }
}

.icon-button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 8px;
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.icon-button:hover {
    background-color: var(--secondary-color-dark);
}

.icon-button.success {
    background-color: #4CAF50;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
    align-items: center;
}

/* Style the main action buttons */
#apply-filter-button, #reset-all-filters {
    padding: var(--spacing-medium) var(--spacing-large);
    border-radius: var(--border-radius-small);
    cursor: pointer;
    font-size: 1.1em;
    min-width: 120px;
}

/* Apply filter button specific styles */
#apply-filter-button {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
}

#apply-filter-button:hover {
    background-color: var(--secondary-color);
}

/* Reset filter button specific styles */
#reset-all-filters {
    background-color: rgb(185, 185, 185);
    color: rgb(45, 45, 45);
    border: none;
}

#reset-all-filters:hover {
    background-color: #e5e5e5;
    color: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* Share button styles */
.icon-button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 8px;
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-button:hover {
    background-color: var(--secondary-color);
}

.icon-button i {
    color: #f0f0f0; /* Light grey instead of white */
}

.icon-button.success {
    background-color: #4CAF50;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
    align-items: center;
}

/* Base share menu styles */
.share-menu {
    position: absolute;
    background: white;
    border-radius: var(--border-radius-small);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    padding: 8px 0;
    min-width: 200px;
    display: none;
    z-index: var(--z-share-menu);
}

/* Share menu when active */
.share-menu.active {
    display: block !important;
    animation: fadeIn 0.2s ease-in-out;
}

/* Share menu options styling */
.share-option {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--dark-color);
    transition: background-color 0.2s;
}

.share-option:hover {
    background-color: #f5f5f5;
}

.share-option i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Icons colors */
.share-option[data-action="copy"] i {
    color: var(--primary-color);
}

.share-option[data-action="email"] i {
    color: #EA4335;
}

.share-option[data-action="whatsapp"] i {
    color: #25D366;
}

.share-option[data-action="telegram"] i {
    color: #0088cc;
}

/* Share menu positioning */
#filter-popup .share-menu {
    bottom: 100%;
    right: 0;
    margin-bottom: 5px;
}

#saved-items-share-menu {
    position: absolute !important;
    bottom: calc(100% + 5px) !important;
    right: 0 !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    z-index: 9999 !important;
    min-width: 160px !important;
    max-width: 160px !important;
    margin: 0 !important;
    z-index: 999999 !important;
}

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Share button container */
.filter-buttons {
    position: relative;
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
    align-items: center;
}

/* Popup transitions */
.popup {
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.popup.open {
    opacity: 1;
}

/* Ensure all elements in popup transition together */
.popup *,
.popup .filter-buttons,
.popup .share-menu,
.popup button {
    transition: opacity 0.3s ease-out;
}

/* Remove duplicate styles */
.share-menu:not(.active) {
    pointer-events: none;
    opacity: 0;
}

/* Clean up z-index */
:root {
    --z-base: 1000;
    --z-overlay: 1100;
    --z-popup: 1200;
    --z-popup-content: 1300;
    --z-popup-close: 1400;
    --z-share-menu: 1004;
}

/* Style the popup titles with Anton font */
#filter-categories h3, 
#filter-tags h3, 
#filter-without h3,
#saved-items-content .popup-title {
    font-family: 'Anton', sans-serif;
    font-size: 16px;
    letter-spacing: 1px;
    color: var(--primary-color);
    text-transform: uppercase;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
    margin: 0 auto;
    padding-bottom: 2px;
}

/* Specific adjustments for My Selection title */
#saved-items-content .popup-title {
    font-family: 'Anton', sans-serif !important;
    font-size: 16px !important;
    letter-spacing: 1px !important;
    color: var(--primary-color) !important;
    text-transform: uppercase !important;
    border-bottom: 2px solid var(--primary-color) !important;
    display: inline-block !important;
    margin: 0 auto !important;
    padding: 15px 0 2px 0 !important; /* Added top padding */
    text-align: center !important;
    margin-bottom: 10px !important;
}

/* Filter section headers alignment - with higher specificity */
#filter-popup #filter-categories .filter-header,
#filter-popup #filter-tags .filter-header {
    display: flex !important;
    justify-content: center !important;
    width: 100% !important;
}

#filter-popup #filter-without .filter-header {
    display: flex !important;
    justify-content: flex-start !important;
    width: 100% !important;
}

/* Filter section content alignment - with higher specificity */
#filter-popup #filter-categories,
#filter-popup #filter-tags,
#filter-popup #filter-without {
    text-align: left !important;
    padding: 0 20px !important;
}

/* Title text alignment - with higher specificity */
#filter-popup #filter-categories h3,
#filter-popup #filter-tags h3 {
    text-align: center !important;
    margin: 0 auto !important;
}

#filter-popup #filter-without h3 {
    text-align: left !important;
    margin: 0 !important;
}

/* Add space between filter titles and buttons */
#filter-popup .filter-header {
    margin-bottom: 10px !important; /* Increased space between title and buttons */
}

/* Add space between sections */
#filter-categories,
#filter-tags,
#filter-without {
    margin-bottom: 20px !important; /* Increased space between sections */
}

/* Adjust last section margin */
#filter-without {
    margin-bottom: 20px !important; /* Less space for the last section */
}

/* Share menu positioning for My Selection popup - with highest z-index */
#saved-items-popup #saved-items-share-menu {
    position: absolute !important;
    bottom: calc(100% + 5px) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    right: auto !important;
    top: auto !important;
    z-index: 999999 !important;
    min-width: 160px !important;
    max-width: 160px !important;
    margin: 0 !important;
}

/* Share menu container */
#saved-items-popup .saved-items-actions {
    position: relative !important;
    z-index: 999999 !important;
}

/* Lower the subtotal z-index */
.saved-items-subtotal {
    z-index: 99 !important;
}

/* Ensure proper visibility */
#saved-items-popup #saved-items-share-menu.active {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Popup description styling */
.popup-description {
    font-size: 1.2em; /* Standard font size */
    color: var(--dark-color); /* Dark color for description */
    margin-bottom: 10px; /* Space below description */
    text-align: center; /* Center align description */
}

/* Filter popup section titles */
#filter-popup h3 {
    font-family: 'Anton', sans-serif;
    font-size: 1.2em;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 10px 0 15px; /* Increased bottom margin from 15px to 25px */
    text-align: center;
    border-bottom: none;
}

/* Override any specific title styles */
#filter-categories h3, 
#filter-tags h3, 
#filter-without h3 {
    border-bottom: none !important; /* Ensure no underline */
    padding-bottom: 0;
    display: block;
}

/* Specific adjustments for section headers */
#filter-popup #filter-categories .filter-header,
#filter-popup #filter-tags .filter-header,
#filter-popup #filter-without .filter-header {
    border-bottom: none;
    margin-bottom: 25px;
}

/* Remove any inherited underlines */
.filter-header h3 {
    border: none !important;
    text-decoration: none !important;
    margin-bottom: 15px;
}

/* Categories section */
#filter-categories {
    text-align: center;
    margin-bottom: 35px;
    padding: 0 15px;
}

#filter-categories div {
    display: inline-block;
    margin: 4px;
}

#filter-categories input[type="checkbox"] {
    display: none;
}

#filter-categories label {
    display: inline-block;
    padding: 4px 12px;
    border: 1px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    font-family: 'Lato', sans-serif;
    font-size: 1em;
    font-weight: 400;
    border-radius: 20px;
    cursor: pointer;
    margin: 2px;
    /* Ensure consistent box sizing */
    box-sizing: border-box;
    /* Remove any transitions */
    transition: none;
}

/* Only change colors and font weight for selected state */
#filter-categories input[type="checkbox"]:checked + label {
    background: var(--primary-color);
    color: white;
    font-weight: 500;
    /* Ensure same dimensions */
    padding: 4px 12px;
    border: 1px solid var(--primary-color);
}

/* Remove ALL hover styles and ensure consistent dimensions */
#filter-categories label:hover {
    /* Keep exact same styles as default state */
    background: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 4px 12px;
    font-weight: 400;
}

/* Mobile adjustments - keep consistent sizes */
@media (max-width: 480px) {
    #filter-categories label,
    #filter-categories input[type="checkbox"]:checked + label,
    #filter-categories label:hover {
        padding: 2px 8px;
        font-size: 0.9em;
        margin: 1px;
    }

    
}

/* Tags section */
#filter-tags {
    text-align: center;
    margin-bottom: 35px;
    padding: 0 20px;
}

#filter-tags div {
    display: inline-block;
    margin: 1px;
}

#filter-tags input[type="checkbox"] {
    display: none;
}

#filter-tags label {
    display: inline-block;
    padding: 2px 4px;
    color: var(--dark-color);
    font-family: 'Lato', sans-serif;
    font-size: 1.1em;
    font-weight: 400;
    cursor: pointer;
    background: transparent;
    border: none;
}

#filter-tags label::before {
    content: '#';
    color: var(--secondary-color);
    margin-right: 2px;
}

/* Remove hover effect, only keep selected state */
#filter-tags input[type="checkbox"]:checked + label {
    color: var(--primary-color);
    font-weight: 700;
    text-decoration: underline;
}

/* Allergens section */
#filter-without {
    margin: 30px 0;
    padding: 0 20px;
}

#filter-without div {
    display: inline-block;
    margin: 1px;
}

#filter-without input[type="checkbox"] {
    display: none;
}

#filter-without label {
    display: inline-block;
    padding: 2px 4px;
    color: var(--dark-color);
    font-family: 'Lato', sans-serif;
    font-size: 1.1em;
    font-weight: 400;
    cursor: pointer;
    background: transparent;
    border: none;
}

/* Remove hover effect, only keep selected state */
#filter-without input[type="checkbox"]:checked + label {
    color: var(--primary-color);
    font-weight: 700;
    text-decoration: underline;
}

/* Remove ALL hover styles */
#filter-tags label:hover,
#filter-without label:hover {
    color: var(--dark-color);
    text-decoration: none;
}

/* Filter buttons container */
.filter-buttons {
    margin-top: 25px;
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* Mobile optimizations */
@media (max-width: 480px) {
    /* Adjust filter popup container */
    #filter-popup {
        padding: 0px 0 0 0;
    }

    /* Reduce title sizes and spacing */
    #filter-popup h3 {
        font-size: 1em;
        margin: 6px 0 4px;
        padding-bottom: 0;
    }

    /* Condense categories section */
    #filter-categories {
        margin-bottom: 10px;
        padding: 0 4px;
    }

    #filter-categories label {
        padding: 2px 8px;
        font-size: 0.9em;
        margin: 1px;
    }

    /* Condense tags section */
    #filter-tags {
        margin-bottom: 10px;
        padding: 0 4px;
    }

    #filter-tags div {
        margin: 0;
        line-height: 1.4; /* Even more reduced line height */
    }

    #filter-tags label {
        padding: 1px 2px;
        font-size: 0.95em;
        margin: 0;
    }

    /* Condense allergens section */
    #filter-without {
        margin: 10px 0;
        padding: 0 4px;
    }

    #filter-without div {
        margin: 0;
        line-height: 1.4; /* Even more reduced line height */
    }

    #filter-without label {
        padding: 1px 2px;
        font-size: 0.95em;
        margin: 0;
    }

    /* Adjust buttons container */
    .filter-buttons {
        margin-top: 8px;
        padding: 6px;
        border-top: 1px solid #eee;
    }
}

/* My Selection popup title adjustments */
#saved-items-content .popup-title {
    font-family: 'Anton', sans-serif !important;
    font-size: 16px !important;
    letter-spacing: 1px !important;
    color: var(--primary-color) !important;
    text-transform: uppercase !important;
    border-bottom: 2px solid var(--primary-color) !important;
    display: inline-block !important;
    margin: 0 auto !important;
    padding: 15px 0 2px 0 !important; /* Added top padding */
    text-align: center !important;
    margin-bottom: 10px !important;
}

/* Hide item IDs in My Selection */
.saved-items-rows .item-id {
    display: none !important;
}

/* Adjust spacing for items without IDs */
.saved-items-rows .item-details {
    padding-left: 10px;
}
