/* --- Shopping List Modal Specific Styles --- */
/* Input group at the top */
.shopping-list-input-group {
    display: flex;
    flex-wrap: nowrap; /* Keep inputs in a row on mobile */
    gap: 8px;
    padding: 12px 0 16px 0;
    border-bottom: 1px solid #f1f3f4; /* Lighter border color */
    flex-shrink: 0;
    justify-content: space-between;
    align-items: center;
}

.shopping-list-input { /* Item name input */
    flex-grow: 1;
    padding: 12px 16px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 14px;
    height: 48px; /* Increased height for touch targets */
    box-sizing: border-box;
    box-shadow: none;
    background-color: #f1f3f4; /* Light gray background */
    color: #202124;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.shopping-list-input:focus {
    background-color: #fff;
    border-color: #1a73e8; /* Google blue */
    outline: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.shopping-list-quantity { /* Quantity input */
    width: 60px;
    padding: 12px 8px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    height: 48px; /* Increased height for touch targets */
    box-sizing: border-box;
    box-shadow: none;
    background-color: #f1f3f4; /* Light gray background */
    color: #202124;
    -moz-appearance: textfield; /* Remove spinner arrows Firefox */
}

.shopping-list-quantity:focus {
    background-color: #fff;
    border-color: #1a73e8; /* Google blue */
    outline: none;
}

.shopping-list-quantity::-webkit-outer-spin-button,
.shopping-list-quantity::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0; /* Remove spinner arrows Chrome/Safari */
}

#shopping-list-add-button { /* Add (+) button */
    width: 48px;
    height: 48px;
    border: none;
    background-color: #1a73e8; /* Google blue */
    color: white;
    border-radius: 24px; /* Circular button */
    cursor: pointer;
    font-size: 24px;
    font-weight: normal;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.1s ease;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    -webkit-tap-highlight-color: transparent;
}

#shopping-list-add-button:hover {
    background-color: #1765cc;
}

#shopping-list-add-button:active {
    transform: scale(0.95);
    background-color: #1765cc;
}

/* Container for the scrollable list items */
.shopping-list-scroll-container {
    flex-grow: 1; /* Take available space */
    overflow-y: auto;
    position: relative;
    padding: 8px 0;
    scrollbar-width: thin;
    scrollbar-color: #dadce0 #f8f9fa; /* Firefox scrollbar */
    min-height: 120px; /* Ensure minimum height for empty list */
}

/* Webkit scrollbar */
.shopping-list-scroll-container::-webkit-scrollbar {
    width: 4px;
}
.shopping-list-scroll-container::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 4px;
}
.shopping-list-scroll-container::-webkit-scrollbar-thumb {
    background-color: #dadce0;
    border-radius: 4px;
}

/* Optional: Add fade effect at top/bottom when scrollable */
.shopping-list-scroll-container::before,
.shopping-list-scroll-container::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 24px;
    z-index: 10;
    pointer-events: none;
    display: none; /* Hidden by default */
}

.shopping-list-scroll-container::before {
    top: 0;
    background: linear-gradient(to bottom, white 60%, rgba(255, 255, 255, 0));
}

.shopping-list-scroll-container::after {
    bottom: 0;
    background: linear-gradient(to top, white 60%, rgba(255, 255, 255, 0));
}

/* Show fade only when scrollable (class added by JS) */
.shopping-list-scroll-container.is-scrollable::before,
.shopping-list-scroll-container.is-scrollable::after {
    display: block;
}

/* Shopping list items */
#shopping-list-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

#shopping-list-items li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    font-size: 14px;
    border-bottom: 1px solid #f1f3f4;
    min-height: 48px; /* Minimum height for touch targets */
}

#shopping-list-items li:last-child {
    border-bottom: none;
}

.shopping-list-item-name {
    flex-grow: 1;
    margin-right: 12px;
    color: #202124;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shopping-list-item-qty-display {
    color: #5f6368;
    font-size: 14px;
    margin-right: 16px;
    min-width: 32px;
    text-align: right;
}

.shopping-list-empty-message {
    text-align: center;
    color: #5f6368;
    padding: 32px 0;
    font-style: normal;
    font-size: 14px;
    border-bottom: none !important;
}

/* Status area below list items */
.shopping-list-status-area {
    min-height: 24px; padding: 5px 20px; text-align: center;
    font-size: 0.9em; color: #6b7280; flex-shrink: 0;
}
.shopping-list-status-area .error { color: #ef4444; }
.shopping-list-status-area .success { color: #10b981; }
.shopping-list-status-area .spinner.small { display: inline-block; vertical-align: middle; margin-right: 5px; }

/* --- Shopping List Modal Actions Area (Bottom) --- */
#shopping-list-actions {
    display: flex;
    flex-direction: column; /* Stack filters and button on small screens */
    gap: 16px;
    padding: 16px 0 0 0;
    border-top: 1px solid #f1f3f4;
    background-color: #ffffff;
    flex-shrink: 0;
}

.shopping-list-filters {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.shopping-list-sort-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
}

/* Generic label style for filters */
.filter-label {
    font-size: 14px;
    color: #5f6368;
    font-weight: 500;
    flex-shrink: 0;
    margin-right: 4px;
}

/* Radio button groups */
.radio-group {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 36px; /* Better touch target */
    padding: 2px 0;
}

.radio-group input[type="radio"] {
    cursor: pointer;
    accent-color: #1a73e8; /* Google blue */
    width: 18px;
    height: 18px;
    margin: 0;
}

.radio-group label {
    font-size: 14px;
    color: #202124;
    cursor: pointer;
    line-height: 1.3;
    padding: 4px 0; /* Increase touch target */
}

/* Search button container */
.shopping-list-search-action {
    align-self: stretch;
    width: 100%;
    margin-top: 4px;
}

#search-shopping-list-button {
    width: 100%;
    padding: 0 24px;
    border: none;
    background-color: #1a73e8; /* Google blue */
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.25px;
    height: 48px; /* Increased height for touch targets */
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 2px rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
}

#search-shopping-list-button:hover {
    background-color: #1765cc;
    box-shadow: 0 1px 3px rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15);
}

#search-shopping-list-button:active {
    background-color: #1765cc;
    box-shadow: 0 1px 2px rgba(60,64,67,0.3);
    transform: translateY(1px);
}

#search-shopping-list-button:disabled {
    background-color: #dadce0;
    color: #5f6368;
    cursor: not-allowed;
    box-shadow: none;
}

/* Responsive layout for actions area */
@media (min-width: 500px) {
    #shopping-list-actions { flex-direction: row; align-items: center; justify-content: space-between; gap: 20px; }
    .shopping-list-filters { flex-direction: row; flex-wrap: wrap; width: auto; gap: 20px; }
    .shopping-list-sort-options { gap: 16px; }
    .shopping-list-search-action { align-self: center; width: auto; flex-shrink: 0; margin-top: 0; }
    #search-shopping-list-button { width: auto; }
}
/* --- END Shopping List Actions Area --- */

/* --- Inline Shopping List Container Styles --- */
#shopping-list-inline-content {
    display: flex; /* Use flexbox for layout */
    flex-direction: column; /* Stack children vertically */
    max-height: 80vh; /* Limit height to allow scrolling within */
    overflow: hidden; /* Hide overflow, rely on inner scroll container */
    width: 90%; /* Use percentage width instead of fixed pixels */
    max-width: 450px; /* Maximum width for larger screens */
    box-sizing: border-box; /* Include padding in width calculation */
    position: fixed !important; /* Override inline style */
    top: 10px !important; /* Override inline style */
    left: 50% !important; /* Override inline style */
    right: auto !important; /* Override inline style */
    transform: translateX(-50%) !important; /* Override inline style */
}

/* Responsive adjustments for shopping list */
@media (max-width: 768px) {
    #shopping-list-inline-content {
        width: 70%; /* Slightly wider on smaller screens */
        max-width: none; /* Remove max-width constraint on mobile */
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    #shopping-list-inline-content {
        width: 70%; /* Almost full width on very small screens */
        top: 5px !important; /* Less top margin on small screens */
    }
}
