/**
 * Meal Planning Styles
 * Location: NGH_Vercel_Deploy/meal-planning/styles/
 * Part of NexGenHealth.io Patient Portal
 *
 * Follows existing patient portal dark theme with green accent (#00875A)
 */

/* ============================================
   Header & Typography
   ============================================ */

.meal-planning-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.meal-planning-subtitle {
    color: #888;
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

/* ============================================
   Profile Selector Section
   ============================================ */

.profile-selector-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
}

.profile-selector-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.profile-selector-header h3 {
    color: #00875A;
    font-size: 1.3rem;
    margin-bottom: 0.25rem;
}

.profile-selector-header p {
    color: #888;
    font-size: 0.85rem;
}

.saved-profiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.profile-loading {
    text-align: center;
    color: #888;
    padding: 2rem;
    grid-column: 1 / -1;
}

/* Profile Card */
.profile-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #333;
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.2s ease;
}

.profile-card:hover {
    border-color: #444;
    background: rgba(255, 255, 255, 0.05);
}

.profile-card.active {
    border-color: #00875A;
    background: rgba(0, 135, 90, 0.1);
}

.profile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

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

.active-badge {
    background: #00875A;
    color: #fff;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-weight: 500;
}

.profile-card-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.profile-detail {
    display: flex;
    flex-direction: column;
}

.profile-detail .detail-label {
    font-size: 0.7rem;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 0.15rem;
}

.profile-detail .detail-value {
    font-size: 0.9rem;
    color: #ccc;
    font-weight: 500;
}

.profile-card-meta {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid #333;
}

.profile-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.profile-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #444;
    background: rgba(255, 255, 255, 0.05);
    color: #ccc;
    min-width: 60px;
}

.profile-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.profile-btn.use {
    background: #00875A;
    border-color: #00875A;
    color: #fff;
}

.profile-btn.use:hover {
    background: #00a06b;
}

.profile-btn.edit {
    border-color: #00875A;
    color: #00875A;
}

.profile-btn.edit:hover {
    background: rgba(0, 135, 90, 0.2);
}

.profile-btn.delete {
    border-color: #dc3545;
    color: #dc3545;
    flex: 0;
    min-width: 60px;
}

.profile-btn.delete:hover {
    background: rgba(220, 53, 69, 0.2);
}

.profile-actions {
    text-align: center;
}

.profile-actions .action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.profile-actions .action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Profile Divider */
.profile-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: #666;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.profile-divider::before,
.profile-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #333;
}

.profile-divider span {
    padding: 0 1rem;
}

/* Inline Success Message */
.onboarding-success-inline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(0, 135, 90, 0.15);
    border: 1px solid #00875A;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    animation: slideDown 0.3s ease;
}

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

.onboarding-success-inline .success-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #00875A;
    color: #fff;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: bold;
}

.onboarding-success-inline .success-text {
    flex: 1;
    color: #00875A;
    font-size: 0.9rem;
    font-weight: 500;
}

.onboarding-success-inline .success-dismiss {
    background: none;
    border: none;
    color: #00875A;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 0.25rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.onboarding-success-inline .success-dismiss:hover {
    opacity: 1;
}

/* Legacy success overlay - now hidden */
.onboarding-success {
    display: none !important;
}

/* ============================================
   Onboarding Wizard
   ============================================ */

.meal-onboarding-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem;
}

.onboarding-header {
    text-align: center;
    margin-bottom: 2rem;
}

.onboarding-header h3 {
    color: #00875A;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.onboarding-header p {
    color: #888;
    font-size: 0.9rem;
}

/* Progress Bar */
.onboarding-progress {
    margin-bottom: 2rem;
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00875A, #00a86b);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
}

.progress-steps .step {
    font-size: 0.75rem;
    color: #666;
    position: relative;
    padding-bottom: 0.5rem;
}

.progress-steps .step.active {
    color: #00875A;
    font-weight: 600;
}

.progress-steps .step.completed {
    color: #00a86b;
}

.progress-steps .step.completed::before {
    content: '✓';
    margin-right: 0.25rem;
}

/* Wizard Steps */
.onboarding-wizard {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #333;
    border-radius: 12px;
    padding: 2rem;
    min-height: 350px;
}

.wizard-step {
    display: none;
}

.wizard-step.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.wizard-step h4 {
    color: #E0E0E0;
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #333;
}

.step-description {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    color: #E0E0E0;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #444;
    border-radius: 8px;
    color: #E0E0E0;
    font-size: 0.95rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-select option {
    color: #000;
    background: #fff;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #00875A;
    box-shadow: 0 0 0 3px rgba(0, 135, 90, 0.2);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.calorie-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.calorie-input-group .form-input {
    max-width: 150px;
}

.input-suffix {
    color: #888;
    font-size: 0.9rem;
}

/* Goal & Budget Buttons */
.goal-options,
.budget-options {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.goal-btn,
.budget-btn {
    flex: 1;
    min-width: 120px;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #444;
    border-radius: 8px;
    color: #E0E0E0;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
}

.goal-btn:hover,
.budget-btn:hover {
    background: rgba(0, 135, 90, 0.1);
    border-color: #00875A;
}

.goal-btn.active,
.budget-btn.active {
    background: rgba(0, 135, 90, 0.2);
    border-color: #00875A;
    color: #00875A;
}

/* Allergy & Cuisine Grids */
.allergy-grid,
.cuisine-grid,
.preference-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

.allergy-item,
.cuisine-item,
.preference-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #444;
    border-radius: 6px;
    color: #E0E0E0;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.allergy-item:hover,
.cuisine-item:hover,
.preference-item:hover {
    border-color: #00875A;
    background: rgba(0, 135, 90, 0.1);
}

.allergy-item input,
.cuisine-item input,
.preference-item input {
    accent-color: #00875A;
}

/* Nova Classification */
.nova-info {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.nova-level {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    font-size: 0.8rem;
    color: #888;
}

.nova-badge {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.75rem;
}

.nova-1 .nova-badge { background: #22c55e; color: #000; }
.nova-2 .nova-badge { background: #84cc16; color: #000; }
.nova-3 .nova-badge { background: #f59e0b; color: #000; }
.nova-4 .nova-badge { background: #ef4444; color: #fff; }

.nova-slider-container {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.nova-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #22c55e, #84cc16, #f59e0b, #ef4444);
    border-radius: 4px;
    outline: none;
}

.nova-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.nova-value {
    text-align: center;
    margin-top: 1rem;
}

#novaValueDisplay {
    font-size: 2rem;
    font-weight: 700;
    color: #00875A;
}

.nova-label {
    display: block;
    font-size: 0.85rem;
    color: #888;
    margin-top: 0.25rem;
}

/* Consent Box */
.consent-box {
    background: rgba(0, 135, 90, 0.1);
    border: 1px solid rgba(0, 135, 90, 0.3);
    border-radius: 8px;
    padding: 1.25rem;
}

.consent-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    color: #E0E0E0;
    font-weight: 500;
}

.consent-label input {
    margin-top: 0.2rem;
    accent-color: #00875A;
}

.consent-note {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: #888;
    padding-left: 1.5rem;
}

.linked-conditions {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.linked-conditions h5 {
    color: #E0E0E0;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.condition-tag {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background: rgba(0, 135, 90, 0.2);
    border-radius: 4px;
    color: #00a86b;
    font-size: 0.8rem;
    margin: 0.25rem;
}

.no-conditions {
    color: #666;
    font-size: 0.85rem;
    font-style: italic;
}

/* Wizard Navigation */
.wizard-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #333;
}

.wizard-btn {
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.prev-btn {
    background: transparent;
    border: 1px solid #444;
    color: #888;
}

.prev-btn:hover:not(:disabled) {
    border-color: #666;
    color: #E0E0E0;
}

.prev-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.next-btn,
.complete-btn {
    background: linear-gradient(135deg, #00875A, #00a86b);
    border: none;
    color: #fff;
}

.next-btn:hover,
.complete-btn:hover {
    background: linear-gradient(135deg, #00a86b, #00c77b);
    transform: translateY(-1px);
}

/* Wizard Error */
.wizard-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: none;
}

/* Onboarding Success */
.onboarding-success {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #1a1a1a;
    border: 1px solid #00875A;
    border-radius: 16px;
    padding: 2rem 3rem;
    text-align: center;
    z-index: 1000;
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    from { transform: translate(-50%, -50%) scale(0.9); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.success-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.onboarding-success h3 {
    color: #00875A;
    margin-bottom: 0.5rem;
}

.onboarding-success p {
    color: #888;
    font-size: 0.9rem;
}

/* ============================================
   Generate Plan Tab
   ============================================ */

.generate-plan-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem;
}

.generate-header {
    text-align: center;
    margin-bottom: 2rem;
}

.generate-header h3 {
    color: #00875A;
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.generate-form {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #333;
    border-radius: 12px;
    padding: 2rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.profile-summary {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(0, 135, 90, 0.05);
    border: 1px solid rgba(0, 135, 90, 0.2);
    border-radius: 8px;
}

.profile-summary h4 {
    color: #00875A;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.summary-item {
    padding: 0.5rem;
}

.summary-item .label {
    font-size: 0.75rem;
    color: #666;
    display: block;
}

.summary-item .value {
    font-size: 0.9rem;
    color: #E0E0E0;
    font-weight: 500;
}

.loading-text {
    color: #666;
    font-style: italic;
}

.generate-btn {
    width: 100%;
    margin-top: 2rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #00875A, #00a86b);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.generate-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #00a86b, #00c77b);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 135, 90, 0.3);
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-icon {
    font-size: 1.2rem;
}

/* Generation Loading */
.generation-loading {
    text-align: center;
    padding: 3rem;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(0, 135, 90, 0.2);
    border-top-color: #00875A;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-subtext {
    color: #666;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* Plan Preview */
.plan-preview {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #333;
    border-radius: 12px;
}

.plan-preview h4 {
    color: #00875A;
    margin-bottom: 1rem;
}

.preview-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

.action-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.action-btn.primary {
    background: linear-gradient(135deg, #00875A, #00a86b);
    border: none;
    color: #fff;
}

.action-btn.primary:hover {
    background: linear-gradient(135deg, #00a86b, #00c77b);
}

.action-btn.secondary {
    background: transparent;
    border: 1px solid #444;
    color: #E0E0E0;
}

.action-btn.secondary:hover {
    border-color: #666;
}

.placeholder-message {
    text-align: center;
    padding: 2rem;
    color: #888;
}

.placeholder-message strong {
    color: #E0E0E0;
}

/* ============================================
   Review & Edit Tab
   ============================================ */

.review-plan-container,
.grocery-cart-container,
.summary-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1.5rem;
}

.review-header,
.grocery-header,
.summary-header {
    text-align: center;
    margin-bottom: 2rem;
}

.review-header h3,
.grocery-header h3,
.summary-header h3 {
    color: #00875A;
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

/* No Plan Message */
.no-plan-message {
    text-align: center;
    padding: 3rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #333;
    border-radius: 12px;
}

.message-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.no-plan-message p {
    color: #888;
    margin-bottom: 1.5rem;
}

/* Day Selector */
.day-selector {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.day-btn {
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #444;
    border-radius: 6px;
    color: #E0E0E0;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.day-btn:hover {
    border-color: #00875A;
}

.day-btn.active {
    background: rgba(0, 135, 90, 0.2);
    border-color: #00875A;
    color: #00875A;
}

/* Daily Nutrition */
.daily-nutrition {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #333;
    border-radius: 12px;
}

.daily-nutrition h4 {
    color: #00875A;
    margin-bottom: 1rem;
}

.nutrition-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

@media (max-width: 600px) {
    .nutrition-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.nutrition-item {
    text-align: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.nutrition-item .label {
    font-size: 0.75rem;
    color: #666;
    display: block;
    margin-bottom: 0.25rem;
}

.nutrition-item .value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #00875A;
}

/* Plan Actions */
.plan-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #333;
    justify-content: center;
    flex-wrap: wrap;
}

.plan-actions .action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.plan-actions .action-btn .btn-icon {
    font-size: 1.1rem;
}

.plan-actions .action-btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #444;
    color: #ccc;
}

.plan-actions .action-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #00875A;
    color: #00875A;
}

.plan-actions .action-btn.primary {
    background: #00875A;
    border: 1px solid #00875A;
    color: #fff;
}

.plan-actions .action-btn.primary:hover {
    background: #00a06b;
    border-color: #00a06b;
}

/* Instacart Button in Plan Actions */
.plan-actions .instacart-btn {
    flex: none;
    min-width: auto;
    padding: 0.75rem 1.5rem;
}

.plan-actions .instacart-btn.branded {
    background: #FAF9F6; /* Off-white background to show colored carrot */
    border: 2px solid #43B02A;
    border-radius: 24px;
    color: #43B02A;
}

.plan-actions .instacart-btn.branded:hover:not(:disabled) {
    background: #F0EDE8; /* Slightly darker off-white on hover */
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(67, 176, 42, 0.3);
}

/* Instacart Feedback Section (Review & Edit Tab) */
.instacart-feedback-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
}

.instacart-feedback-section .instacart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(0, 135, 90, 0.1);
    border-radius: 8px;
    color: #00875A;
}

.instacart-feedback-section .instacart-result {
    margin-top: 0.5rem;
}

/* ============================================
   Grocery Cart Tab
   ============================================ */

/* Category Filters */
.category-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #444;
    border-radius: 20px;
    color: #888;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: #00875A;
    color: #E0E0E0;
}

.filter-btn.active {
    background: rgba(0, 135, 90, 0.2);
    border-color: #00875A;
    color: #00875A;
}

/* Cart Summary */
.cart-summary {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #333;
    border-radius: 12px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    color: #E0E0E0;
}

.summary-row:last-child {
    border-top: 1px solid #333;
    margin-top: 0.5rem;
    padding-top: 1rem;
    font-weight: 600;
    font-size: 1.1rem;
}

/* Walmart Integration */
.walmart-integration {
    margin-top: 2rem;
    text-align: center;
}

.integration-note {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    font-size: 0.85rem;
    color: #f59e0b;
    text-align: left;
    margin-bottom: 1rem;
}

.note-icon {
    flex-shrink: 0;
}

.walmart-btn {
    padding: 1rem 2rem;
    background: #0071dc;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.walmart-btn:hover:not(:disabled) {
    background: #0058a3;
}

.walmart-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   Summary Tab
   ============================================ */

/* Weekly Totals */
.weekly-totals {
    margin-bottom: 2rem;
}

.weekly-totals h4,
.macro-breakdown h4,
.health-alignment h4,
.export-options h4 {
    color: #00875A;
    margin-bottom: 1rem;
}

.totals-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

@media (max-width: 700px) {
    .totals-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.total-card {
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #333;
    border-radius: 10px;
    text-align: center;
}

.total-label {
    font-size: 0.75rem;
    color: #666;
    display: block;
    margin-bottom: 0.5rem;
}

.total-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #00875A;
}

/* Macro Chart */
.macro-breakdown {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #333;
    border-radius: 12px;
}

.macro-chart {
    display: flex;
    align-items: center;
    gap: 2rem;
    justify-content: center;
}

@media (max-width: 500px) {
    .macro-chart {
        flex-direction: column;
    }
}

.chart-placeholder {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: conic-gradient(
        #00875A 0% 30%,
        #f59e0b 30% 75%,
        #3b82f6 75% 100%
    );
    position: relative;
}

.chart-placeholder::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80px;
    height: 80px;
    background: #1a1a1a;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.chart-legend {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #E0E0E0;
}

.color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.color-dot.protein { background: #00875A; }
.color-dot.carbs { background: #f59e0b; }
.color-dot.fat { background: #3b82f6; }

/* Health Alignment */
.health-alignment {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #333;
    border-radius: 12px;
}

.alignment-score {
    display: flex;
    align-items: center;
    gap: 2rem;
    justify-content: center;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(#00875A 0% 85%, #333 85% 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.score-circle::before {
    content: '';
    position: absolute;
    width: 90px;
    height: 90px;
    background: #1a1a1a;
    border-radius: 50%;
}

.score-value {
    position: relative;
    font-size: 2rem;
    font-weight: 700;
    color: #00875A;
}

.score-label {
    position: relative;
    font-size: 0.75rem;
    color: #666;
}

/* Export Options */
.export-options {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #333;
    border-radius: 12px;
}

.export-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.export-btn {
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #444;
    border-radius: 8px;
    color: #E0E0E0;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.export-btn:hover {
    border-color: #00875A;
    background: rgba(0, 135, 90, 0.1);
}

/* ============================================
   Store Selection Step
   ============================================ */

/* Zip Code Input Group */
.zip-code-input-group {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.zip-code-input-group .form-input {
    flex: 1;
    max-width: 200px;
}

.search-stores-btn {
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, #00875A, #00a86b);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.search-stores-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #00a86b, #00c77b);
    transform: translateY(-1px);
}

.search-stores-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Field Hint */
.field-hint {
    color: #888;
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
}

/* Store Priority Grid */
.store-priority-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

@media (max-width: 600px) {
    .store-priority-grid {
        grid-template-columns: 1fr;
    }
}

.store-priority-item {
    cursor: pointer;
}

.store-priority-item input {
    display: none;
}

.priority-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid #444;
    border-radius: 10px;
    transition: all 0.3s;
    text-align: center;
}

.store-priority-item input:checked + .priority-card {
    border-color: #00875A;
    background: rgba(0, 135, 90, 0.15);
}

.priority-card:hover {
    border-color: #00875A;
    background: rgba(0, 135, 90, 0.1);
}

.priority-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.priority-title {
    font-weight: 600;
    color: #E0E0E0;
    margin-bottom: 0.25rem;
}

.priority-desc {
    font-size: 0.75rem;
    color: #888;
}

/* Store Map Section */
.store-map-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #333;
}

/* Map Container */
.map-container {
    margin-bottom: 1.5rem;
}

.store-map {
    width: 100%;
    height: 300px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #333;
    border-radius: 10px;
    overflow: hidden;
}

.map-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 2rem;
    color: #888;
}

.map-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.map-placeholder p {
    font-size: 0.9rem;
    max-width: 300px;
}

.map-fallback {
    text-align: center;
}

.map-note {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.5rem;
}

/* Stores List */
.stores-list-container {
    margin-bottom: 1.5rem;
}

.stores-list-container h5 {
    color: #E0E0E0;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.stores-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #333;
    border-radius: 10px;
}

.stores-list-placeholder {
    padding: 2rem;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

.store-list-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #333;
    cursor: pointer;
    transition: background 0.2s;
}

.store-list-item:last-child {
    border-bottom: none;
}

.store-list-item:hover {
    background: rgba(0, 135, 90, 0.1);
}

.store-list-item.selected {
    background: rgba(0, 135, 90, 0.2);
    border-left: 3px solid #00875A;
}

.store-number {
    width: 28px;
    height: 28px;
    background: #333;
    border: 2px solid #00875A;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #00875A;
    flex-shrink: 0;
}

.store-list-item.selected .store-number {
    background: #00875A;
    color: #fff;
}

.store-info {
    flex: 1;
}

.store-name {
    font-weight: 600;
    color: #E0E0E0;
    margin-bottom: 0.25rem;
}

.store-address {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.store-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: #888;
}

.store-rating,
.store-distance,
.store-price {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.store-open {
    color: #22c55e;
    font-weight: 500;
}

.store-closed {
    color: #ef4444;
    font-weight: 500;
}

.store-features {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.feature-tag {
    padding: 0.2rem 0.5rem;
    background: rgba(0, 135, 90, 0.2);
    border-radius: 4px;
    font-size: 0.7rem;
    color: #00a86b;
}

.store-select-indicator {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #00875A;
    font-weight: 700;
}

/* Selected Store Display */
.selected-store {
    padding: 1rem;
    background: rgba(0, 135, 90, 0.1);
    border: 1px solid rgba(0, 135, 90, 0.3);
    border-radius: 10px;
    margin-bottom: 1.5rem;
}

.selected-store-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #00875A;
    margin-bottom: 0.75rem;
}

.check-icon {
    font-size: 1.2rem;
}

.selected-store-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #E0E0E0;
    margin-bottom: 0.25rem;
}

.selected-store-address {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.selected-store-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: #888;
}

/* Store Preferences Grid */
.store-preferences-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

@media (max-width: 500px) {
    .store-preferences-grid {
        grid-template-columns: 1fr;
    }
}

.store-pref-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #444;
    border-radius: 6px;
    color: #E0E0E0;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.store-pref-item:hover {
    border-color: #00875A;
    background: rgba(0, 135, 90, 0.1);
}

.store-pref-item input {
    accent-color: #00875A;
}

/* ========================================
   Leaflet Map Styles
   ======================================== */

/* Leaflet container overrides for dark theme */
.leaflet-container {
    background: #1a1a1a !important;
    font-family: 'Merriweather', serif;
}

/* Leaflet controls styling */
.leaflet-control-zoom a {
    background: #2c2c2c !important;
    color: #E0E0E0 !important;
    border-color: #444 !important;
}

.leaflet-control-zoom a:hover {
    background: #3c3c3c !important;
    color: #00875A !important;
}

.leaflet-control-attribution {
    background: rgba(26, 26, 26, 0.8) !important;
    color: #888 !important;
    font-size: 0.7rem !important;
}

.leaflet-control-attribution a {
    color: #00875A !important;
}

/* User location marker */
.user-location-icon {
    background: transparent !important;
    border: none !important;
}

.user-location-marker {
    width: 20px;
    height: 20px;
    background: #00875A;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Store marker icons */
.store-marker-icon {
    background: transparent !important;
    border: none !important;
}

.store-marker {
    width: 28px;
    height: 28px;
    background: #333;
    border: 2px solid #00875A;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: bold;
    font-size: 0.85rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    transition: all 0.2s;
}

.store-marker:hover {
    background: #00875A;
    transform: scale(1.1);
}

.store-marker.selected {
    background: #00875A;
    box-shadow: 0 0 0 4px rgba(0, 135, 90, 0.3), 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Leaflet popup styling */
.leaflet-popup-content-wrapper {
    background: #2c2c2c !important;
    color: #E0E0E0 !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
}

.leaflet-popup-content {
    margin: 12px 16px !important;
    font-size: 0.9rem !important;
}

.leaflet-popup-tip {
    background: #2c2c2c !important;
}

.leaflet-popup-close-button {
    color: #888 !important;
}

.leaflet-popup-close-button:hover {
    color: #00875A !important;
}

.store-popup {
    line-height: 1.4;
}

.store-popup strong {
    color: #00875A;
}

/* Map loading/fallback state */
.map-fallback {
    text-align: center;
    padding: 2rem;
}

.map-fallback .map-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.map-fallback p {
    margin: 0.25rem 0;
    color: #888;
}

.map-fallback .map-note {
    font-size: 0.85rem;
    color: #666;
}

/* ========================================
   Library Tab Styles
   ======================================== */

/* Library Container */
.library-container {
    padding: 1rem;
}

.library-header {
    margin-bottom: 1.5rem;
}

.library-header h3 {
    color: #E0E0E0;
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.library-header p {
    color: #888;
    font-size: 0.9rem;
}

/* Library Sections */
.library-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-header h4 {
    color: #E0E0E0;
    font-size: 1.1rem;
    margin: 0;
}

.section-hint {
    color: #888;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Filter Tabs */
.meal-filter-tabs,
.template-filter-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-tab {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #444;
    border-radius: 20px;
    padding: 0.4rem 0.9rem;
    color: #888;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tab:hover {
    border-color: #00875A;
    color: #E0E0E0;
}

.filter-tab.active {
    background: #00875A;
    border-color: #00875A;
    color: #fff;
}

/* Meals Grid */
.meals-grid,
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

/* Meal Card */
.meal-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #444;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s;
}

.meal-card:hover {
    border-color: #00875A;
    transform: translateY(-2px);
}

.meal-card.selected {
    border-color: #00875A;
    background: rgba(0, 135, 90, 0.1);
}

.meal-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid #333;
}

.meal-type-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    background: #333;
    color: #888;
}

.meal-type-badge.breakfast { background: #4a3728; color: #e8a84c; }
.meal-type-badge.lunch { background: #2a4a2a; color: #7ac47a; }
.meal-type-badge.dinner { background: #3a2a4a; color: #a87ac4; }
.meal-type-badge.snack { background: #2a3a4a; color: #7ab4c4; }

.favorite-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}

.favorite-btn:hover {
    color: #f4c542;
}

.favorite-btn.active {
    color: #f4c542;
}

.meal-card-body {
    padding: 0.75rem;
}

.meal-name {
    color: #E0E0E0;
    font-size: 0.95rem;
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
}

.meal-nutrition {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: #888;
}

/* ================================================
   Plan A: Minimal Floating Action Design
   Meal Card Redesign - Compact & Modern
   ================================================ */

/* Meal Card Content - Relative positioning for swap button */
.meal-card .meal-card-content {
    position: relative;
}

/* Swap Button - Top Right Ghost Style */
.swap-meal-btn {
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #888;
    background: transparent;
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
}

.swap-meal-btn:hover {
    color: #00875A;
    border-color: #00875A;
    background: rgba(0, 135, 90, 0.1);
}

/* Meal Type Label - Left Border Accent Style */
.meal-type-label {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: capitalize;
    padding-left: 0.6rem;
    border-left: 3px solid #00875A;
    margin-bottom: 0.5rem;
}

.meal-type-label.breakfast {
    border-color: #e8a84c;
    color: #e8a84c;
}

.meal-type-label.lunch {
    border-color: #7ac47a;
    color: #7ac47a;
}

.meal-type-label.dinner {
    border-color: #a87ac4;
    color: #a87ac4;
}

.meal-type-label.snack {
    border-color: #7ab4c4;
    color: #7ab4c4;
}

/* Meal Name - Updated for new layout */
.day-meals .meal-card .meal-name {
    margin: 0 0 0.4rem 0;
    padding-right: 4rem; /* Space for swap button */
}

/* Meal Meta Inline - Dot-separated */
.meal-meta-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.75rem;
}

.meal-meta-inline .meta-item {
    display: inline-flex;
    align-items: center;
}

.meal-meta-inline .meta-item:not(:last-child)::after {
    content: "•";
    margin-left: 0.5rem;
    color: #555;
}

/* Nutrition Bar - Horizontal 4-column */
.meal-nutrition-bar {
    display: flex;
    gap: 0.5rem;
    padding: 0.6rem 0;
    margin-bottom: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.meal-nutrition-bar .nutrition-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.meal-nutrition-bar .nutrition-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: #E0E0E0;
    line-height: 1.2;
}

.meal-nutrition-bar .nutrition-label {
    font-size: 0.65rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-top: 0.15rem;
}

/* ================================================
   Ingredients Dropdown - Collapsible Section
   ================================================ */
.ingredients-dropdown {
    margin-top: 0.75rem;
}

.ingredients-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 0.85rem;
    text-align: left;
    transition: color 0.2s ease;
}

.ingredients-toggle:hover {
    color: #00875A;
}

.ingredients-toggle .toggle-icon {
    font-size: 0.6rem;
    color: #00875A;
    transition: transform 0.25s ease;
}

.ingredients-toggle .toggle-text {
    font-weight: 500;
}

.ingredients-toggle .ingredient-count {
    color: #666;
    font-size: 0.8rem;
}

/* Ingredients Content - Expandable */
.ingredients-content {
    max-height: 300px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease;
    opacity: 1;
}

.ingredients-content.collapsed {
    max-height: 0;
    opacity: 0;
}

/* Ingredients Grid - Two columns */
.ingredients-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem 1.5rem;
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
}

.ingredients-grid li {
    font-size: 0.8rem;
    color: #aaa;
    padding: 0.2rem 0;
    padding-left: 1rem;
    position: relative;
    line-height: 1.4;
}

.ingredients-grid li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #00875A;
    font-weight: bold;
}

/* Scrollbar for long ingredient lists */
.ingredients-content::-webkit-scrollbar {
    width: 4px;
}

.ingredients-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

.ingredients-content::-webkit-scrollbar-thumb {
    background: rgba(0, 135, 90, 0.5);
    border-radius: 2px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ingredients-grid {
        grid-template-columns: 1fr;
    }

    .ingredients-grid li {
        font-size: 0.75rem;
    }

    .swap-meal-btn {
        padding: 0.35rem 0.6rem;
        font-size: 0.7rem;
    }

    .meal-nutrition-bar .nutrition-value {
        font-size: 0.85rem;
    }
}

.meal-rating {
    margin-top: 0.5rem;
    color: #f4c542;
    font-size: 0.85rem;
}

.meal-card-footer {
    padding: 0.75rem;
    border-top: 1px solid #333;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.select-btn {
    flex: 1;
    padding: 0.5rem;
    background: rgba(0, 135, 90, 0.2);
    border: 1px solid #00875A;
    border-radius: 6px;
    color: #00875A;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

/* Instacart Recipe Button on Meal Cards */
.instacart-recipe-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 6px;
    background: #FAF9F6; /* Off-white background to show colored carrot */
    border: 2px solid #43B02A; /* Instacart green border */
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.instacart-recipe-btn:hover {
    background: #F0EDE8; /* Slightly darker off-white on hover */
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(67, 176, 42, 0.4);
}

.instacart-recipe-btn .instacart-icon {
    width: 20px;
    height: 20px;
}

.instacart-recipe-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.instacart-recipe-btn.loading {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.select-btn:hover {
    background: #00875A;
    color: #fff;
}

.select-btn.selected {
    background: #00875A;
    color: #fff;
}

/* Meal Card with Image */
.meal-card.with-image {
    display: flex;
    gap: 1.25rem;
    padding: 1.25rem;
    align-items: stretch;
}

.meal-card.with-image .meal-card-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.meal-card-image-container {
    flex-shrink: 0;
    width: 180px;
    height: 180px;
    border-radius: 12px;
    overflow: hidden;
    background: #2a2a2a;
    position: relative;
    align-self: center;
}

.meal-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.meal-card:hover .meal-card-image {
    transform: scale(1.05);
}

/* Image Refresh Button */
.image-refresh-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
    z-index: 10;
}

.meal-card-image-container:hover .image-refresh-btn {
    opacity: 1;
}

.image-refresh-btn:hover {
    background: rgba(0, 135, 90, 0.8);
    transform: scale(1.1);
}

.image-refresh-btn.spinning {
    opacity: 1;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Image loading state - gradient animation */
.meal-card-image-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        #2a2a2a 0%,
        #3a3a3a 50%,
        #2a2a2a 100%
    );
    background-size: 200% 200%;
    animation: shimmer 2s ease-in-out infinite;
    z-index: 0;
}

@keyframes shimmer {
    0% {
        background-position: 100% 100%;
    }
    50% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 100% 100%;
    }
}

/* Hide loading shimmer once image loads */
.meal-card-image-container.loaded::before {
    display: none;
}

.meal-card-image-container img {
    position: relative;
    z-index: 1;
}

/* Review tab meal card adjustments */
.day-meals .meal-card {
    margin-bottom: 1rem;
}

.day-meals .meal-card .meal-header {
    display: block;
    margin-bottom: 0;
    padding: 0;
    border-bottom: none;
}

/* Portion size display */
.meal-portion {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(0, 135, 90, 0.15);
    border: 1px solid rgba(0, 135, 90, 0.3);
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
    margin-bottom: 0.5rem;
    width: fit-content;
}

.meal-portion .portion-icon {
    font-size: 0.85rem;
}

.meal-portion .portion-text {
    color: #00875A;
    font-size: 0.8rem;
    font-weight: 500;
}

.day-meals .meal-card .meal-description {
    color: #aaa;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.day-meals .meal-card .meal-meta {
    display: flex;
    gap: 1rem;
    color: #888;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.day-meals .meal-card .meal-nutrition {
    flex-wrap: wrap;
}

/* Tablet responsive - slightly smaller image */
@media (max-width: 768px) {
    .meal-card-image-container {
        width: 150px;
        height: 150px;
    }
}

/* Mobile responsive - image on top */
@media (max-width: 480px) {
    .meal-card.with-image {
        flex-direction: column;
        padding: 0;
    }

    .meal-card.with-image .meal-card-content {
        padding: 1rem;
    }

    .meal-card-image-container {
        width: 100%;
        height: 200px;
        order: -1;
        border-radius: 12px 12px 0 0;
    }
}

/* Template Card */
.template-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #444;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s;
}

.template-card:hover {
    border-color: #00875A;
    transform: translateY(-2px);
}

.template-card.selected {
    border-color: #00875A;
    background: rgba(0, 135, 90, 0.1);
}

.template-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid #333;
}

.template-type-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    background: #2a3a4a;
    color: #7ab4c4;
}

.template-card-body {
    padding: 0.75rem;
}

.template-name {
    color: #E0E0E0;
    font-size: 0.95rem;
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
}

.template-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: #888;
}

.template-usage {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #666;
}

.template-card-footer {
    padding: 0.75rem;
    border-top: 1px solid #333;
    display: flex;
    gap: 0.5rem;
}

.use-template-btn {
    flex: 1;
    padding: 0.5rem;
    background: #00875A;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.use-template-btn:hover {
    background: #00a86b;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: #888;
}

.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.empty-state p {
    margin: 0.25rem 0;
}

.empty-hint {
    font-size: 0.85rem;
    color: #666;
}

.empty-state .action-btn {
    margin-top: 1rem;
}

/* Selection Summary */
.selection-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    background: rgba(0, 135, 90, 0.1);
    border: 1px solid rgba(0, 135, 90, 0.3);
    border-radius: 8px;
}

.selection-count {
    color: #E0E0E0;
    font-size: 0.95rem;
}

.selection-count span {
    color: #00875A;
    font-weight: bold;
}

.selection-actions {
    display: flex;
    gap: 0.75rem;
}

/* Selection Preview */
.selection-preview {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
}

.selection-preview h5 {
    color: #E0E0E0;
    font-size: 0.9rem;
    margin: 0 0 0.5rem 0;
}

.preview-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.85rem;
    color: #888;
}

/* Shopping History */
.shopping-history {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #444;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.2s;
}

.history-item:hover {
    border-color: #555;
}

.history-item.completed {
    opacity: 0.7;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.history-date {
    font-size: 0.8rem;
    color: #888;
}

.history-status {
    font-size: 0.7rem;
    text-transform: uppercase;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: #333;
    color: #888;
}

.history-item.completed .history-status {
    background: rgba(0, 135, 90, 0.2);
    color: #00875A;
}

.history-item-body h5 {
    color: #E0E0E0;
    font-size: 0.95rem;
    margin: 0 0 0.5rem 0;
}

.history-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.history-sources {
    font-size: 0.8rem;
    color: #666;
}

.history-item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.action-btn.small {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #333;
}

.modal-header h4 {
    color: #E0E0E0;
    margin: 0;
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: #E0E0E0;
}

.modal-body {
    padding: 1.25rem;
}

.modal-hint {
    font-size: 0.85rem;
    color: #888;
    margin-top: 0.75rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid #333;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .meal-filter-tabs,
    .template-filter-tabs {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }

    .meals-grid,
    .templates-grid {
        grid-template-columns: 1fr;
    }

    .selection-summary {
        flex-direction: column;
        align-items: flex-start;
    }

    .selection-actions {
        width: 100%;
    }

    .selection-actions button {
        flex: 1;
    }
}

/* ============================================
   Instacart Integration Styles
   ============================================ */

.instacart-integration {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(0, 135, 90, 0.1), rgba(0, 135, 90, 0.05));
    border: 1px solid rgba(0, 135, 90, 0.3);
    border-radius: 12px;
}

.instacart-integration .integration-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.instacart-integration .integration-header h4 {
    color: #00875A;
    font-size: 1.1rem;
    margin: 0;
}

.instacart-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #888;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
}

.status-indicator.checking {
    background: #f0ad4e;
    animation: pulse 1.5s ease-in-out infinite;
}

.status-indicator.connected {
    background: #00875A;
}

.status-indicator.error {
    background: #d9534f;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.instacart-integration .integration-note {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    color: #aaa;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.instacart-integration .note-icon {
    font-size: 1.2rem;
}

.instacart-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.instacart-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 160px;
}

.instacart-btn.primary:not(.branded) {
    background: linear-gradient(135deg, #00875A, #00a572);
    color: white;
}

.instacart-btn.primary:not(.branded):hover:not(:disabled) {
    background: linear-gradient(135deg, #00a572, #00c584);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 135, 90, 0.3);
}

.instacart-btn.primary:disabled {
    background: #444;
    color: #888;
    cursor: not-allowed;
}

.instacart-btn.secondary {
    background: transparent;
    color: #00875A;
    border: 1px solid #00875A;
}

.instacart-btn.secondary:hover {
    background: rgba(0, 135, 90, 0.1);
}

.instacart-btn .btn-icon {
    font-size: 1.1rem;
}

/* Branded Instacart Button - per Instacart Brand Guidelines
   Specifications:
   - Button Height: 46px
   - Button Width: Dynamic based on text
   - Logo Size: 22px
   - Padding Vertical: 16px
   - Background: Off-white to display colored carrot
   - Text: Instacart Green for brand consistency
*/
.instacart-btn.branded {
    background: #FAF9F6; /* Off-white background to show colored carrot */
    border: 2px solid #43B02A; /* Instacart green border */
    border-radius: 23px; /* Rounded button (half of 46px height) */
    height: 46px; /* Required: 46px button height */
    padding: 0 24px; /* Horizontal padding for dynamic width */
    width: auto; /* Dynamic width based on text */
    flex: none; /* Override flex stretching */
    min-width: auto; /* Remove minimum width constraint */
    color: #43B02A; /* Instacart green text */
}

.instacart-btn.branded:hover:not(:disabled) {
    background: #F0EDE8; /* Slightly darker off-white on hover */
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(67, 176, 42, 0.4);
}

/* Instacart Logo in Button - Required: 22px */
.instacart-btn-logo {
    width: 22px; /* Required: 22px logo size */
    height: 22px;
    object-fit: contain;
    flex-shrink: 0;
}

.note-icon-img {
    width: 24px;
    height: 24px;
    vertical-align: middle;
    margin-right: 0.5rem;
}

/* Instacart Badge for Store Listings */
.instacart-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: linear-gradient(135deg, #43B02A, #4CC435);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* Store List Item with Instacart Support */
.store-list-item.instacart-supported {
    border-left: 3px solid #43B02A;
}

.store-list-item.instacart-supported .store-name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* Instacart Delivery Feature Tag */
.feature-tag.instacart-delivery {
    background: #43B02A;
    color: white;
}

/* Selected Store Instacart Display */
.selected-store-name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.selected-store-instacart {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(67, 176, 42, 0.1);
    border-radius: 8px;
    border-left: 3px solid #43B02A;
    font-size: 0.85rem;
    color: #43B02A;
}

.instacart-icon-small {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.instacart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    color: #888;
    font-size: 0.9rem;
}

.instacart-loading .loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 135, 90, 0.2);
    border-top-color: #00875A;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.instacart-result {
    margin-top: 1rem;
}

.instacart-success,
.instacart-error {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 8px;
    animation: slideIn 0.3s ease;
}

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

.instacart-success {
    background: linear-gradient(135deg, rgba(67, 176, 42, 0.15), rgba(0, 135, 90, 0.1));
    border: 1px solid rgba(67, 176, 42, 0.3);
    flex-direction: column;
    text-align: center;
    padding: 1.5rem;
}

.instacart-success .success-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.instacart-success .success-instacart-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.instacart-success .success-icon {
    font-size: 1.5rem;
    color: #43B02A;
    flex-shrink: 0;
}

.instacart-success .success-content {
    flex: 1;
    width: 100%;
}

.instacart-success .success-content p {
    margin: 0;
    color: #ccc;
    font-size: 0.9rem;
}

.instacart-success .success-content p:first-child {
    color: #43B02A;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.instacart-success .item-count {
    color: #fff !important;
    font-size: 1rem !important;
}

.instacart-success .success-note {
    color: #4CC435 !important;
    font-size: 0.9rem !important;
    margin-top: 0.75rem !important;
}

.instacart-success .popup-blocked-note {
    color: #f5a623 !important;
    font-size: 0.9rem !important;
    margin-top: 0.75rem !important;
    padding: 0.5rem 1rem;
    background: rgba(245, 166, 35, 0.15);
    border-radius: 6px;
}

/* Enhanced URL Section for Demo Verification */
.instacart-url-section {
    margin-top: 1.25rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid #444;
}

.instacart-url-section label {
    display: block;
    font-size: 0.85rem;
    color: #43B02A;
    font-weight: 600;
    margin-bottom: 0.75rem;
    text-align: left;
}

.instacart-url-section .url-container {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.instacart-url-section .url-note {
    margin-top: 0.5rem !important;
    font-size: 0.75rem !important;
    color: #888 !important;
    text-align: left;
}

/* Instacart Link Button (anchor tag styled as button) */
.instacart-link-btn {
    display: inline-flex !important;
    text-decoration: none !important;
}

.instacart-link-btn:hover {
    text-decoration: none !important;
}

/* Instacart URL Display for Ingredient Matching Review */
.instacart-url-display {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 135, 90, 0.2);
    width: 100%;
}

.instacart-url-display label {
    display: block;
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.instacart-url-display .url-container {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.instacart-url-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #444;
    border-radius: 6px;
    color: #00c584;
    font-family: monospace;
    font-size: 0.8rem;
    min-width: 0;
    cursor: text;
}

.instacart-url-input:focus {
    outline: none;
    border-color: #00875A;
}

.copy-url-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 135, 90, 0.2);
    border: 1px solid #00875A;
    border-radius: 6px;
    color: #00875A;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.copy-url-btn:hover {
    background: rgba(0, 135, 90, 0.3);
    color: #00c584;
}

.copy-url-btn.copied {
    background: #00875A;
    color: white;
}

.copy-url-btn .copy-icon {
    font-size: 1rem;
}

.instacart-success-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
    flex-shrink: 0;
    justify-content: center;
    flex-wrap: wrap;
}

.instacart-success-actions .instacart-btn {
    flex: unset;
    min-width: auto;
    padding: 0.75rem 1.5rem;
}

.instacart-success-actions .action-btn.secondary {
    background: transparent;
    border: 1px solid #666;
    color: #ccc;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.instacart-success-actions .action-btn.secondary:hover {
    border-color: #43B02A;
    color: #43B02A;
}

.instacart-error {
    background: rgba(217, 83, 79, 0.15);
    border: 1px solid rgba(217, 83, 79, 0.3);
}

.instacart-error .error-icon {
    font-size: 1.5rem;
    color: #d9534f;
    flex-shrink: 0;
}

.instacart-error .error-content {
    flex: 1;
}

.instacart-error .error-content p {
    margin: 0;
    color: #ccc;
    font-size: 0.9rem;
}

.instacart-error .error-content p:first-child {
    color: #d9534f;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.instacart-error .error-details {
    margin-top: 0.5rem !important;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    font-size: 0.8rem !important;
    color: #aaa !important;
}

.instacart-error .retry-hint {
    margin-top: 0.5rem !important;
    font-size: 0.8rem !important;
    color: #888 !important;
    font-style: italic;
}

/* Responsive adjustments for Instacart section */
@media (max-width: 600px) {
    .instacart-integration .integration-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .instacart-actions {
        flex-direction: column;
    }

    .instacart-btn {
        width: 100%;
    }

    .instacart-success,
    .instacart-error {
        flex-direction: column;
        text-align: center;
    }

    .instacart-url-display .url-container {
        flex-direction: column;
    }

    .instacart-url-input {
        font-size: 0.75rem;
    }

    .copy-url-btn {
        justify-content: center;
    }

    .instacart-success-actions {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   Grocery List Display - Priority 1 Fix
   Added: January 2026
   Styles for the populated grocery list with
   categorized ingredients for Instacart flow
   ============================================ */

/* Grocery Category Section */
.grocery-category {
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #333;
    border-radius: 10px;
    overflow: hidden;
}

.grocery-category .category-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: rgba(0, 135, 90, 0.08);
    border-bottom: 1px solid #333;
}

.grocery-category .category-icon {
    font-size: 1.25rem;
}

.grocery-category .category-name {
    flex: 1;
    font-weight: 600;
    color: #E0E0E0;
    font-size: 0.95rem;
}

.grocery-category .category-count {
    font-size: 0.8rem;
    color: #888;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
}

/* Category Items Container */
.grocery-category .category-items {
    padding: 0.5rem;
}

/* Individual Grocery Item */
.grocery-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.grocery-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.grocery-item.checked {
    opacity: 0.5;
}

.grocery-item.checked .item-name {
    text-decoration: line-through;
    color: #666;
}

/* Grocery Item Checkbox */
.grocery-item-checkbox {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grocery-item-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    width: 20px;
    height: 20px;
}

.grocery-item-checkbox .checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #444;
    border-radius: 4px;
    background: transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grocery-item-checkbox:hover .checkmark {
    border-color: #00875A;
}

.grocery-item-checkbox input:checked ~ .checkmark {
    background: #00875A;
    border-color: #00875A;
}

.grocery-item-checkbox input:checked ~ .checkmark::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Grocery Item Details */
.grocery-item-details {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.grocery-item-details .item-name {
    color: #E0E0E0;
    font-size: 0.9rem;
}

.grocery-item-details .item-quantity {
    color: #888;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* Grocery Item Price */
.grocery-item .item-price {
    color: #00875A;
    font-size: 0.85rem;
    font-weight: 500;
    min-width: 60px;
    text-align: right;
}

/* No Items Message */
.grocery-list .no-items {
    text-align: center;
    color: #666;
    padding: 2rem;
    font-size: 0.9rem;
}

/* Responsive Adjustments for Grocery List */
@media (max-width: 600px) {
    .grocery-category .category-header {
        padding: 0.75rem;
    }

    .grocery-item {
        padding: 0.625rem;
    }

    .grocery-item-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .grocery-item .item-price {
        min-width: auto;
        text-align: left;
    }
}

/* ============================================
   Health Alignment Breakdown - Priority 2 Fix
   Added: January 2026
   Styles for the health alignment score breakdown
   ============================================ */

/* Score Breakdown Container */
#scoreBreakdown {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
}

/* Individual Breakdown Item */
.breakdown-item {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    padding: 0.75rem;
    border-left: 3px solid #333;
    transition: all 0.2s ease;
}

.breakdown-item.excellent {
    border-left-color: #00875A;
}

.breakdown-item.good {
    border-left-color: #4ade80;
}

.breakdown-item.fair {
    border-left-color: #f59e0b;
}

.breakdown-item.needs-improvement {
    border-left-color: #ef4444;
}

/* Breakdown Header */
.breakdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.breakdown-category {
    font-size: 0.85rem;
    font-weight: 500;
    color: #E0E0E0;
}

.breakdown-score {
    font-size: 0.8rem;
    color: #888;
    font-weight: 600;
}

/* Breakdown Progress Bar */
.breakdown-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.breakdown-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.breakdown-item.excellent .breakdown-fill {
    background: linear-gradient(90deg, #00875A, #00a86b);
}

.breakdown-item.good .breakdown-fill {
    background: linear-gradient(90deg, #4ade80, #6ee7b7);
}

.breakdown-item.fair .breakdown-fill {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.breakdown-item.needs-improvement .breakdown-fill {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

/* Breakdown Detail Text */
.breakdown-detail {
    font-size: 0.75rem;
    color: #888;
    display: block;
}

/* Overall Alignment Rating */
.alignment-rating {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    margin-top: 0.5rem;
    background: rgba(0, 135, 90, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(0, 135, 90, 0.2);
}

.rating-label {
    font-size: 0.9rem;
    color: #aaa;
}

.rating-value {
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
}

.rating-value.excellent {
    background: rgba(0, 135, 90, 0.2);
    color: #00875A;
}

.rating-value.good {
    background: rgba(74, 222, 128, 0.2);
    color: #4ade80;
}

.rating-value.fair {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.rating-value.needs\ work,
.rating-value.poor {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Responsive adjustments for alignment breakdown */
@media (max-width: 600px) {
    .alignment-score {
        flex-direction: column;
        gap: 1.5rem;
    }

    #scoreBreakdown {
        max-width: 100%;
    }

    .alignment-rating {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* ================================================
   LEGACY: Old Meal Card Action Buttons (Deprecated)
   Replaced by Plan A: swap-meal-btn in top-right
   Keeping for backwards compatibility with other views
   ================================================ */

.meal-card-actions {
    display: none; /* Hidden - replaced by top-right swap button */
}

/* ================================================
   PRIORITY 3: Swap Meal Modal
   ================================================ */

.swap-meal-modal {
    max-width: 600px;
    max-height: 85vh;
}

.swap-meal-modal .modal-body {
    max-height: calc(85vh - 150px);
    overflow-y: auto;
}

.swap-current-meal {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(0, 135, 90, 0.1);
    border-radius: 8px;
    margin-bottom: 1.25rem;
}

.swap-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
}

.current-meal-name {
    color: #00875A;
    font-weight: 600;
    font-size: 1rem;
}

.swap-options-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.swap-options-header > span {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.swap-source-tabs {
    display: flex;
    gap: 0.5rem;
}

.swap-tab {
    padding: 0.4rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.swap-tab:hover {
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

.swap-tab.active {
    background: #00875A;
    border-color: #00875A;
    color: #fff;
}

.swap-options-container {
    min-height: 200px;
}

.swap-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: rgba(255, 255, 255, 0.6);
}

.swap-loading .loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #00875A;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.swap-error,
.swap-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: rgba(255, 255, 255, 0.6);
}

.swap-error p,
.swap-empty p {
    margin-bottom: 0.5rem;
}

.swap-hint {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.4);
}

.swap-options-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.swap-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.swap-option:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(0, 135, 90, 0.3);
}

.swap-option-content {
    flex: 1;
    min-width: 0;
}

.swap-meal-name {
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.35rem 0;
}

.swap-meal-desc {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    margin: 0 0 0.5rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.swap-meal-nutrition {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    margin-bottom: 0.35rem;
}

.swap-meal-nutrition .cal {
    color: #ff5722;
    font-weight: 600;
}

.swap-meal-nutrition .protein {
    color: #4caf50;
}

.swap-meal-nutrition .carbs {
    color: #2196f3;
}

.swap-meal-nutrition .fat {
    color: #ff9800;
}

.swap-meal-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.swap-select-btn {
    padding: 0.6rem 1.25rem;
    background: #00875A;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    margin-left: 1rem;
}

.swap-select-btn:hover {
    background: #00a06a;
    transform: translateY(-1px);
}

/* Responsive styles for swap modal */
@media (max-width: 500px) {
    .swap-meal-modal {
        max-width: 95vw;
    }

    .swap-options-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .swap-option {
        flex-direction: column;
        align-items: stretch;
    }

    .swap-select-btn {
        margin-left: 0;
        margin-top: 0.75rem;
        width: 100%;
    }

    .swap-meal-desc {
        white-space: normal;
    }
}

/* ============================================
   HIPAA Compliance Styles
   Added: January 2026
   ============================================ */

/* Secure processing indicator */
.secure-indicator {
    display: inline-block;
    margin-right: 0.5rem;
    font-size: 1.1em;
}

/* HIPAA-specific error styling */
.generation-error.hipaa-error {
    background: linear-gradient(135deg, #1a2a2a 0%, #0d1f1f 100%);
    border: 1px solid #00875A;
    border-left: 4px solid #00875A;
}

.generation-error.hipaa-error .error-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.generation-error.hipaa-error p {
    color: #e0e0e0;
    line-height: 1.6;
}

.hipaa-note {
    background: rgba(0, 135, 90, 0.15);
    border: 1px solid rgba(0, 135, 90, 0.3);
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.hipaa-note strong {
    color: #00875A;
}

/* Generate without health link button */
.action-btn.tertiary {
    background: transparent;
    border: 1px solid #666;
    color: #888;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 0.75rem;
}

.action-btn.tertiary:hover {
    border-color: #888;
    color: #aaa;
}

/* Generation notice (when switching to non-health-linked) */
.generation-notice {
    text-align: center;
    padding: 2rem;
    background: rgba(0, 135, 90, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(0, 135, 90, 0.3);
}

.generation-notice .notice-icon {
    font-size: 2rem;
    color: #00875A;
    margin-bottom: 1rem;
}

.generation-notice p {
    color: #ccc;
    margin: 0.5rem 0;
}

/* Health-linked profile indicator in loading state */
.generation-loading .secure-indicator {
    animation: pulse-secure 1.5s ease-in-out infinite;
}

@keyframes pulse-secure {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Responsive adjustments for HIPAA elements */
@media (max-width: 500px) {
    .generation-error.hipaa-error {
        padding: 1.25rem;
    }

    .action-btn.tertiary {
        margin-left: 0;
        margin-top: 0.75rem;
        width: 100%;
    }

    .hipaa-note {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
}

/* ================================================
   Premium Upgrade Popup Dialog
   One-time per session after meal plan generation
   ================================================ */

.premium-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.premium-popup {
    position: relative;
    width: 90%;
    max-width: 520px;
    background: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%);
    border: 1px solid rgba(0, 135, 90, 0.3);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
                0 0 40px rgba(0, 135, 90, 0.1);
}

/* Entrance animation */
.premium-popup.popup-enter {
    animation: popupEnter 0.3s ease-out forwards;
}

.premium-popup.popup-exit {
    animation: popupExit 0.2s ease-in forwards;
}

@keyframes popupEnter {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes popupExit {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

.premium-popup .modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #888;
    font-size: 1.5rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.premium-popup .modal-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.premium-popup-header {
    margin-bottom: 1rem;
}

.premium-popup-header .premium-bolt-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 0.75rem;
}

.premium-popup-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.premium-popup-subtitle {
    color: #aaa;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* Feature cards grid */
.premium-features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.premium-feature {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 1rem 0.75rem;
    transition: all 0.2s ease;
}

.premium-feature:hover {
    border-color: rgba(0, 135, 90, 0.3);
    background: rgba(0, 135, 90, 0.05);
}

.premium-feature .feature-svg-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 0.5rem;
}

.premium-feature h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    margin: 0 0 0.35rem 0;
}

.premium-feature p {
    font-size: 0.7rem;
    color: #888;
    margin: 0;
    line-height: 1.4;
}

/* Pricing */
.premium-pricing {
    font-size: 1rem;
    color: #888;
    margin-bottom: 1.5rem;
}

.premium-pricing strong {
    color: #00875A;
    font-size: 1.1rem;
}

/* Action buttons */
.premium-popup-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

.premium-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 280px;
    padding: 0.9rem 1.5rem;
    background: linear-gradient(135deg, #00875A 0%, #00a572 100%);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 135, 90, 0.3);
}

.premium-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 135, 90, 0.4);
}

.premium-cta-btn .cta-arrow-icon {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

.premium-cta-btn:hover .cta-arrow-icon {
    transform: translateX(4px);
}

.premium-dismiss-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s ease;
}

.premium-dismiss-btn:hover {
    color: #888;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .premium-popup {
        padding: 1.5rem;
        margin: 1rem;
    }

    .premium-popup-header h3 {
        font-size: 1.25rem;
    }

    .premium-features-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .premium-feature {
        display: flex;
        align-items: center;
        gap: 1rem;
        text-align: left;
        padding: 0.75rem 1rem;
    }

    .premium-feature .feature-svg-icon {
        width: 28px;
        height: 28px;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .premium-feature h4 {
        margin-bottom: 0.15rem;
    }

    .premium-cta-btn {
        max-width: 100%;
    }
}

/* ============================================
   SIDEBAR: Layout & Container
   ============================================ */

.meal-planning-layout {
    display: flex;
    gap: 0;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    /* Ensure proper alignment for sticky sidebar */
    align-items: flex-start;
}

.meal-planning-layout.with-sidebar {
    gap: 1.5rem;
    /* Minimum height to allow sidebar to scroll properly */
    min-height: 100vh;
}

.meal-planning-main-content {
    flex: 1;
    min-width: 0;
}

/* ============================================
   SIDEBAR: Main Styles
   ============================================ */

.meal-planning-sidebar {
    width: 300px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #333;
    border-radius: 12px;
    position: sticky;
    /* Center vertically in viewport while scrolling */
    top: max(20px, calc(50vh - 280px));
    height: auto;
    max-height: min(560px, calc(100vh - 100px));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    /* Ensure it stays centered in flex layout */
    align-self: flex-start;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #333;
    background: rgba(0, 135, 90, 0.1);
    flex-shrink: 0;
}

.sidebar-header h3 {
    color: #00875A;
    font-size: 1rem;
    margin: 0;
    font-weight: 600;
    font-family: 'Merriweather', serif;
}

.sidebar-toggle-btn {
    display: none;
    background: none;
    border: none;
    color: #888;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #00875A;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
}

.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ============================================
   SIDEBAR: Sections
   ============================================ */

.sidebar-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #333;
}

.sidebar-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.sidebar-section h4 {
    color: #E0E0E0;
    font-size: 0.85rem;
    margin: 0 0 0.75rem;
    font-weight: 600;
    font-family: 'Merriweather', serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.sidebar-section .section-header h4 {
    margin: 0;
}

/* ============================================
   SIDEBAR: Add Contact Button
   ============================================ */

.add-contact-btn {
    background: rgba(0, 135, 90, 0.2);
    border: 1px solid #00875A;
    color: #00875A;
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.2s;
    font-family: inherit;
}

.add-contact-btn:hover {
    background: rgba(0, 135, 90, 0.3);
}

/* ============================================
   SIDEBAR: Contacts List
   ============================================ */

.contacts-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 180px;
    overflow-y: auto;
}

.contact-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #444;
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    transition: all 0.2s;
}

.contact-item:hover {
    border-color: #555;
    background: rgba(255, 255, 255, 0.05);
}

.contact-info {
    flex: 1;
    min-width: 0;
}

.contact-name {
    color: #E0E0E0;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-detail {
    color: #666;
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.15rem;
}

.contact-actions {
    display: flex;
    gap: 0.15rem;
    flex-shrink: 0;
}

.contact-action-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    border-radius: 4px;
    transition: all 0.2s;
    line-height: 1;
}

.contact-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #00875A;
}

.contact-action-btn.delete:hover {
    color: #dc3545;
}

.no-contacts-message {
    text-align: center;
    padding: 1rem 0.5rem;
    color: #666;
    font-size: 0.8rem;
}

.no-contacts-message button {
    margin-top: 0.5rem;
}

/* ============================================
   SIDEBAR: Share Buttons
   ============================================ */

.share-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #444;
    color: #E0E0E0;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    font-family: inherit;
}

.share-btn:hover {
    border-color: #00875A;
    background: rgba(0, 135, 90, 0.1);
}

.share-btn .btn-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.share-btn .btn-label {
    flex: 1;
    text-align: left;
}

/* ============================================
   SIDEBAR: Calendar Button
   ============================================ */

.calendar-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #00875A, #00a86b);
    border: none;
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
}

.calendar-btn:hover {
    background: linear-gradient(135deg, #00a86b, #00c77b);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 135, 90, 0.3);
}

.calendar-btn .btn-icon {
    font-size: 1.1rem;
}

.calendar-note {
    color: #666;
    font-size: 0.7rem;
    text-align: center;
    margin-top: 0.5rem;
    line-height: 1.4;
}

/* ============================================
   SIDEBAR: Contact Modal
   ============================================ */

.contact-modal {
    max-width: 400px;
}

.contact-modal .required {
    color: #dc3545;
}

/* ============================================
   SIDEBAR: Share Modal
   ============================================ */

.share-modal {
    max-width: 480px;
}

.share-contact-select {
    margin-bottom: 1rem;
}

.share-contact-select label {
    display: block;
    margin-bottom: 0.5rem;
    color: #E0E0E0;
    font-size: 0.9rem;
    font-weight: 500;
}

.contact-select-list {
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid #333;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
}

.contact-select-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #333;
}

.contact-select-item:last-child {
    border-bottom: none;
}

.contact-select-item:hover {
    background: rgba(0, 135, 90, 0.1);
}

.contact-select-item input[type="checkbox"] {
    accent-color: #00875A;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.contact-select-name {
    flex: 1;
    color: #E0E0E0;
    font-weight: 500;
    font-size: 0.9rem;
}

.contact-select-detail {
    color: #666;
    font-size: 0.8rem;
}

.share-content-preview {
    margin-bottom: 1rem;
}

.share-content-preview label {
    display: block;
    margin-bottom: 0.5rem;
    color: #E0E0E0;
    font-size: 0.9rem;
    font-weight: 500;
}

.content-preview-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 1rem;
    max-height: 150px;
    overflow-y: auto;
}

.content-preview-box pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    font-size: 0.8rem;
    color: #888;
    line-height: 1.5;
}

.share-custom-message {
    margin-bottom: 0.5rem;
}

.share-custom-message label {
    display: block;
    margin-bottom: 0.5rem;
    color: #E0E0E0;
    font-size: 0.9rem;
    font-weight: 500;
}

.share-custom-message .form-textarea {
    min-height: 70px;
    resize: vertical;
}

/* ============================================
   SIDEBAR: Responsive - Tablet (< 900px)
   ============================================ */

@media (max-width: 900px) {
    .meal-planning-sidebar {
        width: 60px;
        overflow: visible;
    }

    .sidebar-header h3,
    .sidebar-section h4,
    .share-btn .btn-label,
    .calendar-btn .btn-label,
    .contacts-list,
    .calendar-note,
    .add-contact-btn .btn-label {
        display: none;
    }

    .sidebar-header {
        justify-content: center;
        padding: 0.75rem;
    }

    .sidebar-toggle-btn {
        display: block;
    }

    .sidebar-content {
        padding: 0.75rem;
    }

    .sidebar-section {
        padding-bottom: 1rem;
        margin-bottom: 1rem;
    }

    .sidebar-section .section-header {
        justify-content: center;
    }

    .add-contact-btn {
        padding: 0.5rem;
        justify-content: center;
        width: 100%;
    }

    .add-contact-btn span:first-child {
        font-size: 1.1rem;
    }

    .share-btn,
    .calendar-btn {
        justify-content: center;
        padding: 0.75rem;
    }

    .share-btn .btn-icon,
    .calendar-btn .btn-icon {
        font-size: 1.3rem;
        margin: 0;
    }

    /* Expanded state on tablet */
    .meal-planning-sidebar.expanded {
        width: 300px;
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        max-height: 100vh;
        z-index: 1000;
        border-radius: 0 12px 12px 0;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
    }

    .meal-planning-sidebar.expanded .sidebar-header {
        justify-content: space-between;
        padding: 1rem 1.25rem;
    }

    .meal-planning-sidebar.expanded .sidebar-header h3,
    .meal-planning-sidebar.expanded .sidebar-section h4,
    .meal-planning-sidebar.expanded .share-btn .btn-label,
    .meal-planning-sidebar.expanded .calendar-btn .btn-label,
    .meal-planning-sidebar.expanded .contacts-list,
    .meal-planning-sidebar.expanded .calendar-note,
    .meal-planning-sidebar.expanded .add-contact-btn .btn-label {
        display: inline;
    }

    .meal-planning-sidebar.expanded .sidebar-section .section-header {
        justify-content: space-between;
    }

    .meal-planning-sidebar.expanded .add-contact-btn {
        width: auto;
    }

    .meal-planning-sidebar.expanded .share-btn,
    .meal-planning-sidebar.expanded .calendar-btn {
        justify-content: flex-start;
        padding: 0.75rem 1rem;
    }

    .meal-planning-sidebar.expanded .share-btn .btn-icon,
    .meal-planning-sidebar.expanded .calendar-btn .btn-icon {
        font-size: 1.1rem;
    }
}

/* ============================================
   SIDEBAR: Responsive - Mobile (< 600px)
   ============================================ */

@media (max-width: 600px) {
    .meal-planning-layout.with-sidebar {
        flex-direction: column;
    }

    .meal-planning-sidebar {
        width: 100%;
        position: fixed;
        bottom: 0;
        left: 0;
        top: auto;
        height: auto;
        max-height: 60vh;
        border-radius: 16px 16px 0 0;
        z-index: 100;
        transform: translateY(calc(100% - 54px));
        transition: transform 0.3s ease;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    }

    .meal-planning-sidebar .sidebar-header {
        cursor: pointer;
        justify-content: space-between;
        padding: 1rem 1.25rem;
    }

    .meal-planning-sidebar .sidebar-header h3,
    .meal-planning-sidebar .sidebar-section h4,
    .meal-planning-sidebar .share-btn .btn-label,
    .meal-planning-sidebar .calendar-btn .btn-label,
    .meal-planning-sidebar .contacts-list,
    .meal-planning-sidebar .calendar-note,
    .meal-planning-sidebar .add-contact-btn .btn-label {
        display: inline;
    }

    .meal-planning-sidebar .sidebar-toggle-btn {
        display: block;
        transform: rotate(180deg);
        transition: transform 0.3s;
    }

    .meal-planning-sidebar.expanded {
        transform: translateY(0);
    }

    .meal-planning-sidebar.expanded .sidebar-toggle-btn {
        transform: rotate(0deg);
    }

    .meal-planning-main-content {
        padding-bottom: 70px;
    }

    .meal-planning-sidebar .sidebar-section .section-header {
        justify-content: space-between;
    }

    .meal-planning-sidebar .add-contact-btn {
        width: auto;
    }

    .meal-planning-sidebar .share-btn,
    .meal-planning-sidebar .calendar-btn {
        justify-content: flex-start;
        padding: 0.75rem 1rem;
    }
}
