/* Category Badge Styling */
.category-badge {
    display: inline-block;
    padding: 0.25em 0.4em;
    font-size: 0.9em;
    font-weight: 600;
    line-height: 1;
    color: #fff; /* Default text color */
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
    /* background-color: #6c757d;  Default background color */
}

.vendor-badge {
    display: inline-block;
    padding: 0.25em 0.4em; /* Reduced padding */
    font-size: 0.9em; /* Reduced font size */
    font-weight: 600;
    line-height: 1;
    color: #fff; /* White text */
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
    background-color: #6c757d;
}

.badges-container {
    display: flex;
    justify-content: space-between;
}
/* ========================================== */

.spinner { /* Loading spinner animation */
    width: 20px; height: 20px; border: 3px solid #f3f3f3; /* Light grey circle */
    border-top: 3px solid #0078d7; /* Blue spinning part */
    border-radius: 50%; animation: spin 1s linear infinite;
}
.spinner.small { width: 16px; height: 16px; border-width: 2px; } /* Smaller version */

@keyframes spin { /* Spinner animation definition */
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse { /* Pulse animation for shopping list button */
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* --- Action Buttons (Bottom Right) Styling --- */
.action-fab {
    position: fixed;
    right: 5px;
    width: 56px;
    height: 56px;
    border-radius: 50%; /* Make them perfectly round */
    border: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2); /* Android-like drop shadow */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
    color: #fff;
    font-size: 1.0em;
    font-weight: 500;
    z-index: 1000; /* Default z-index */
}

.premium-badge {
    position: absolute;
    top: -4px; /* Adjust as needed */
    right: 2px; /* Adjust as needed */
    background-color: #FFD700; /* Gold color for premium */
    color: #333; /* Dark text for contrast */
    border-radius: 25%;
    padding: 0px 6px;
    font-size: 0.7em;
    font-weight: bold;
    text-align: center;
    line-height: 1;
    border: 1px solid #DAA520; /* Darker gold border */
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    z-index: 10; /* Ensure it's above the icon */
}

.action-fab:hover {
    box-shadow: 0 6px 12px rgba(0,0,0,0.25); /* Slightly larger shadow on hover */
}

.action-fab:active {
    transform: scale(0.95); /* Slight press effect */
    box-shadow: 0 2px 4px rgba(0,0,0,0.2); /* Smaller shadow on active */
}

.action-fab img {
    width: 24px;
    height: 24px;
    filter: brightness(0) invert(1); /* Make icons white */
    display: block;
    margin: auto;
}

/* Specific button styles */
#gps-indicator {
    background-color: #4285F4; /* Google blue */
    bottom: 205px; /* 200px (language button) + 56px (button height) + 4px (spacing) */
    z-index: 1000; /* Above language button */
}

#language-button {
    background-color: #34A853; /* Google green */
    bottom: 140px;
}

#cart-toggle-button {
    background-color: #DB4437; /* Google red, for cart */
    bottom: 140px; /* Position below language button */
    border-radius: 16px; /* Squircle shape */
}

#main-action-button {
    background-color: #4285F4; /* Google blue */
}

#rate-action-button {
    background-color: #FBBC05; /* Google yellow */
}

/* --- Language Options Popup --- */
#language-options-popup {
    position: absolute; /* Relative to body/viewport */
    bottom: calc(200px + 55px + 5px); /* Position above language button */
    right: 20px;
    background-color: #fff; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: 1px solid #e0e0e0; z-index: 1010; overflow: hidden; min-width: 150px;
}
#language-options-popup ul { list-style: none; padding: 5px 0; margin: 0; }
#language-options-popup li { padding: 8px 15px; font-size: 14px; color: #333; cursor: pointer; transition: background-color 0.15s ease; white-space: nowrap; }
#language-options-popup li:hover { background-color: #f0f0f0; }
#language-options-popup li.selected-language { font-weight: 600; color: #0078d7; background-color: #e7f3fe; }
#language-options-popup li.selected-language:hover { background-color: #dbeffd; }

/* --- Bottom Floating Menu Container --- */
.bottom-floating-menu {
    position: fixed;
    bottom: 20px; /* Position at the bottom */
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000; /* Above map, below modals */
    background-color: rgba(255, 255, 255, 0.97);
    padding: 3px 10px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ========================================== */
/* Bottom Navigation Bar                      */
/* ========================================== */
.bottom-nav {
    position: fixed; /* Ensure it's fixed */
    bottom: 0;
    left: 0;
    width: 100%;
    height: 65px;
    background-color: #f8f9fa; /* Light gray background */
    border-top: 1px solid #e0e0e0; /* Keep border removed */
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1010; /* Increase z-index significantly to ensure it's on top */
    /* box-shadow: 0 -1px 3px rgba(0,0,0,0.04); */ /* Keep shadow removed */
    padding-bottom: env(safe-area-inset-bottom);
    box-sizing: border-box;
}

.nav-button-content {
    position: relative;
    display: inline-block; /* Or 'flex' if you prefer */
}

.badge {
    position: absolute;
    top: -5px;
    left: 10px;
    background-color: red;
    color: white;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    display: flex; /* Use flexbox for centering */
    align-items: center;
    justify-content: center;
    min-width: 18px; /* Ensure circle shape */
    height: 18px;    /* Ensure circle shape */
    padding: 2px; /* Adjust padding for centering */
}

.nav-button {
    background-color: transparent; /* Example color */
    border: none;
    padding: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 12px; /* Example size */
    color: #333; /* Example color */
    flex-grow: 1;
}

.nav-button img {
    width: 24px; /* Example size */
    height: 24px; /* Example size */
    margin-bottom: 4px;
}

.nav-button.active {
    color: #007bff; /* Example active color */
}

/* Premium badge specific styles (if any) */
.nav-button .premium-badge {
    position: absolute;
    top: -5px;
    right: -8px;
    background-color: gold;
    color: black;
    border-radius: 0%;
    width: 19px;
    height: 12px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 1px solid white;
}

/* ========================================== */
/* Bottom Sheet Panel                         */
/* ========================================== */
.bottom-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 65px; /* Position above the nav bar */
    background-color: #ffffff;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: 0 -1px 10px rgba(0, 0, 0, 0.08);
    z-index: 1000; /* Above radius control, below nav bar */
    transition: height 0.25s cubic-bezier(0.4, 0, 0.2, 1); /* Material Design transition */
    max-height: calc(90vh - 65px);
    height: calc(85vh - 65px); /* Default expanded height */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Hide radius control when bottom sheet is not collapsed */
.bottom-sheet:not(.collapsed) ~ #bottom-sheet-radius-control {
    display: none;
}

/* Add background scrim when sheet is expanded */
.bottom-sheet:not(.collapsed)::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 65px;
    background-color: rgba(0, 0, 0, 0.32);
    z-index: -1;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.25s ease;
}

/* Collapsed state - Use height to control visibility */
.bottom-sheet.collapsed {
    height: 60px; /* Adjusted for chevron + header row */
    overflow: hidden;
    box-shadow: 0px -9px 14px 3px rgba(0, 0, 0, 0.05);
}

/* Hide scrim when collapsed */
.bottom-sheet.collapsed::before {
    opacity: 0;
    pointer-events: none;
}

.sheet-header-row {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    background-color: #ffffff;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    position: relative; /* For positioning context */
    padding: 8px;
}

.sheet-grabber-container {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 12px; /* Symmetrical padding for click area */
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 1; /* Above header content */
    background-color: transparent; /* No background */
    border-radius: 50%; /* Make click area circular */
}

.sheet-chevron {
    width: 24px;
    height: 24px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #5f6368;
}

/* Rotate chevron when sheet is expanded (not collapsed) */
.bottom-sheet:not(.collapsed) .sheet-chevron {
    transform: rotate(180deg);
}

.sheet-header {
    display: flex;
    align-items: center;
    padding: 1px 20px; /* Symmetrical padding */
    box-sizing: border-box;
    font-size: 18px;
    font-weight: 500;
    color: #202124;
    background-color: #ffffff;
    letter-spacing: 0.1px;
    justify-content: space-between;
    flex-grow: 1;
    min-height: 48px;
    width: 100%;
}

.sheet-content {
    padding: 0 20px 0px 20px; /* Padding applied to tab content areas */
    overflow: hidden; /* Prevent sheet-content itself from scrolling */
    flex-grow: 1;
    display: flex; /* Use flexbox for tab layout */
    flex-direction: column; /* Stack tabs and content vertically */
    background-color: #ffffff;
}

/* --- Tab Navigation Styles --- */
.sheet-tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0; /* Separator line */
    margin: 0 -20px 10px -20px; /* Extend border to edges, add bottom margin */
    padding: 0 20px; /* Restore padding for buttons */
    flex-shrink: 0; /* Prevent tabs from shrinking */
}

.tab-button {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #5f6368; /* Google gray */
    background: none;
    border: none;
    border-bottom: 2px solid transparent; /* Placeholder for active indicator */
    cursor: pointer;
    transition: color 0.2s ease, border-bottom-color 0.2s ease;
    margin-bottom: -1px; /* Overlap border */
    text-align: center;
    flex-grow: 1; /* Make tabs share space */
    white-space: nowrap;
}

.tab-button:hover {
    color: #202124; /* Darker gray on hover */
    background-color: #f8f9fa; /* Slight background highlight */
}

.tab-button.active {
    color: #1a73e8; /* Google blue for active tab */
    border-bottom-color: #1a73e8;
    font-weight: 600;
}

/* --- Tab Content Styles --- */
.tab-content {
    display: none; /* Hide inactive tabs */
    flex-grow: 1; /* Allow content to take remaining space */
    overflow-y: auto; /* Allow individual tab content to scroll */
    overscroll-behavior: contain; /* Prevent scrolling bleed */
    /* Add back padding removed from .sheet-content */
    padding: 10px 0 0 0; /* Add some top padding */
}

.tab-content.active {
    display: flex; /* Changed from block to flex for new layout */
    flex-direction: column;
    overflow: hidden; /* Prevent this container from scrolling */
}

/* --- Search Results List Styles (Inside Simple Search Tab) --- */
.search-results-container {
    margin-top: -20px; /* Space above the list */
    padding-top: 0px; /* Space within the container */
    border-top: 0px solid #f1f3f4; /* Separator line */
    /* The container itself doesn't scroll; scrolling is handled by .tab-content */
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 12px 0; /* Vertical padding */
    border-bottom: 1px solid #f1f3f4; /* Separator between items */
    cursor: pointer; /* Indicate items are clickable */
    transition: background-color 0.15s ease;
}

.search-result-item:last-child {
    border-bottom: none; /* No border on the last item */
}

.search-result-item:hover {
    background-color: #f8f9fa; /* Light background on hover */
}
.search-result-image-container {
    width: 60px; /* Fixed width for the container */
    height: 60px; /* Fixed height for the container */
    margin-right: 3px; /* Spacing between image and details as requested */
    flex-shrink: 0; /* Prevent container from shrinking */
    display: flex; /* Use flexbox to center image */
    align-items: center;
    justify-content: center;
    overflow: hidden; /* Hide parts of image if needed with object-fit: cover */
    border-radius: 4px; /* Optional: slightly rounded corners */
    background-color: #f8f9fa; /* Light background for empty space */
}

.search-result-image {
    display: block; /* Remove extra space below image */
    max-width: 100%; /* Max width is container width */
    max-height: 100%; /* Max height is container height */
    object-fit: contain; /* Scale image down to fit, preserving aspect ratio */
    border-radius: 4px; /* Match container rounding if any */
}

.search-result-details {
    flex-grow: 1;
    margin-right: 15px; /* Space between details and distance */
    overflow: hidden; /* Prevent long text overflowing */
}

.search-result-name {
    font-size: 15px;
    font-weight: 500;
    color: #202124; /* Dark text */
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-vendor {
    font-size: 13px;
    /* color: #5f6368; Gray text */
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-price {
    font-size: 14px;
    font-weight: 600;
    color: #1a73e8; /* Google blue */
}

.search-result-distance {
    font-size: 12px;            /* Adjusted for badge */
    color: #ffffff;             /* White text for better contrast on varied backgrounds */
    background-color: #f0f0f0;  /* Fallback background, will be overridden by JS */
    padding: 4px 8px;           /* Badge padding */
    border-radius: 10px;        /* Rounded corners for badge */
    text-align: center;         /* Center text in badge */
    white-space: nowrap;
    flex-shrink: 0;             /* Prevent distance from shrinking */
    min-width: 50px;            /* Adjusted min-width, ensures some space */
    margin: 0px 10px;
    /* display: inline-block; /* May not be needed in a flex context */
    /* vertical-align: middle; /* If alignment issues arise with sibling elements */
}

.search-results-empty-message {
    text-align: center;
    color: #5f6368;
    padding: 20px 0;
    font-style: italic;
    font-size: 14px;
}

/* Specific layout for simple-search-content children */
#simple-search-content .controls-container {
  flex-shrink: 0; /* Prevent controls from shrinking */
}

#simple-search-content #search-results-list {
  flex-grow: 1; /* Allow results to take remaining space */
  overflow-y: auto; /* Make only results scrollable */
  overscroll-behavior: contain; /* Recommended for nested scroll areas */
}

/* Styles for the item detail view */
#item-detail-view {
    position: absolute; /* Positioned relative to .sheet-content */
    top: 0;
    left: 100%; /* Start off-screen to the right */
    width: 100%;
    height: 100%; /* Take full height of the scrollable area of .sheet-content */
    background-color: #ffffff; /* Match sheet background */
    z-index: 1050; /* Higher than other tab content, but below modals if any */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* Smooth slide */
    padding: 16px 20px; /* Consistent padding */
    box-sizing: border-box;
    /* overflow-y: auto; /* Allow detail view to scroll if content overflows */
    overscroll-behavior: contain;
}

#item-detail-view.active {
    transform: translateX(-100%); /* Slide in from the right */
}

/* Modify .sheet-content to be the relative parent and clipping container */
.sheet-content {
    position: relative; /* Needed for absolute positioning of item-detail-view */
    /* overflow: hidden; /* This will clip the item-detail-view as it slides. */
    /* The individual tab-content containers will handle their own overflow. */
}


/* Styling for the back button in the sheet header */
#sheet-back-button {
    /* Inline styles are: display: none; background: none; border: none; cursor: pointer; padding: 8px; margin-right: 8px; */
    /* Add any additional base styles if needed, e.g., for alignment if not handled by flex parent */
    z-index: 10; /* Ensure it's clickable over the title if they overlap */
}

#sheet-back-button img {
    /* width: 24px; height: 24px; are inline */
    display: block; /* Prevents extra space below image */
}

/* When detail view is active, hide other tab content and tab bar */
.sheet-content.detail-view-active .sheet-tabs,
.sheet-content.detail-view-active > .tab-content:not(#item-detail-view) {
    display: none !important;
}

/* Ensure the header title is also hidden or adjusted when back button is shown */
/* When detail view is active, original title and balance remain visible and aligned by flexbox */
.sheet-header.detail-view-active > span[data-translate-key="bottom_sheet_header"] {
    /* display: none; */ /* Keep original title visible */
    display: none !important;
    flex-grow: 1; /* Allow title to take available space */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-left: 8px; /* Add some space next to the back button */
    margin-right: 8px; /* Add some space before the balance container */
    text-align: center; /* Center the title text if it has space */
}
.sheet-header.detail-view-active #balance-container {
    /* display: none; */ /* Keep balance visible */
    flex-shrink: 0; /* Prevent balance container from shrinking */
}

.upgrade-to-see-details-button {
    background-color: #4285f4; /* Google Blue */
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    margin-top: 8px; /* Space above the button */
    width: fit-content; /* Adjust width to content */
    display: block; /* Take full width of parent */
    text-align: center;
    transition: background-color 0.2s ease;
}

.upgrade-to-see-details-button:hover {
    background-color: #3367d6; /* Darker blue on hover */
}

.ai-search-button {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-right: 8px;
}

.ai-search-button img {
    width: 24px;
    height: 24px;
}


.transaction-log-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 250px); /* Adjust as needed */
    overflow-y: auto;
}


.transaction-log-container thead {
    position: sticky;
    top: 0;
    background-color: #f8f9fa; /* Ensure header background is visible when sticky */
    z-index: 1; /* Ensure header is above scrolling content */
}

#load-more-transactions {
    position: sticky;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1;
}
#item-detail-image {
  width: 100%;
  max-width: 200px;  /* Adjust as needed */
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 16px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
}
