/**
 * Food Generator - Custom Styling System
 * 
 * This stylesheet provides the complete visual design for the Food Generator application.
 * Built on top of Bootstrap 5 with extensive customizations for a cohesive dark theme.
 * 
 * Architecture:
 * - Mobile-first responsive design principles
 * - Custom color palette with exact precision (#1c2332 family)
 * - Component-based styling with clear organization
 * - Bootstrap 5 integration with careful overrides
 * - Accessibility-focused design with proper contrast ratios
 * 
 * Color System:
 * - Primary Background: #1c2332 (main app background)
 * - Card Background: #1c2333 (content sections)
 * - Upload Areas: #232a39 (photo upload zones)
 * - Interactive Elements: #a694ff (buttons and actions)
 * - Text Colors: #f1f5f9 (primary text), #94a3b8 (placeholders)
 * 
 * Key Features:
 * - Seamless main section design (no borders on primary cards)
 * - Precise spacing system using Bootstrap utilities
 * - Custom component styling (ingredients, meal buttons, upload areas)
 * - Responsive design with mobile optimizations
 * - Smooth animations and hover states
 */

/* ================================
   BASE STYLES & TYPOGRAPHY
   ================================ */

/* RTL Support for Arabic */
.ar {
    direction: rtl;
    text-align: right;
}

.ar .dropdown-menu-end {
    left: 0 !important;
    right: auto !important;
}

.ar .d-flex {
    flex-direction: row-reverse;
}

.ar .feature-group {
    flex-direction: row-reverse;
}

.ar .feature-group-content {
    text-align: right;
}

/* ================================
   BASE STYLES & TYPOGRAPHY
   ================================ */

/* App Logo Styling */
.app-logo {
    height: 6rem;
    width: auto;
    max-width: 6rem;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.app-logo:hover {
    transform: scale(1.05);
}

/* App Header and Title Styling */
.app-header {
    gap: 1rem;
}

.app-title {
    font-size: 3rem;
    font-weight: 300;
    line-height: 1.2;
}

/* Mobile responsiveness for app logo and title */
@media (max-width: 768px) {
    .app-logo {
        height: 5rem;
        max-width: 5rem;
    }
    
    .app-title {
        font-size: 2.5rem;
    }
}

@media (max-width: 576px) {
    .app-logo {
        height: 4rem;
        max-width: 4rem;
    }
    
    .app-title {
        font-size: 1.8rem;
    }
    
    .app-header {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .app-header .app-logo {
        margin-right: 0 !important;
        margin-bottom: 0.5rem;
    }
}

/* Mobile-first responsive design with custom dark theme */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    /* EXACT color from FG1.png reference image */
    background: #1c2332;
    color: #f1f5f9;
}

/* Upload subtitle with icons styling */

/* Upload area styling */
.upload-area {
    position: relative;
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    min-height: 120px; /* Minimum height for empty state */
    height: auto; /* Auto height to expand with content */
    max-height: 280px; /* Increased max height for 2 rows of thumbnails */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible; /* Allow thumbnails to be visible */
}

.upload-area:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background-color: transparent;
}

.upload-area.dragover {
    border-color: #495057;
    background-color: #051b11;
}

.upload-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}


/* Suggestion cards */
.suggestion-card {
    background: #1c2333;
    border: 1px solid #475569;
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.suggestion-card:hover {
    transform: translateY(-2px);
}

.suggestion-header {
    border-bottom: 2px solid var(--bs-border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.meal-type-label {
    font-weight: 600;
    font-size: 1.5rem; /* Same as h4 */
    color: #aeb4be;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Make meal type icons bigger */
.suggestion-header .me-2 i {
    font-size: 1.5rem; /* Bigger icon to match text size */
}

.suggestion-content {
    line-height: 1.8;
    flex: 1;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .display-4 {
        font-size: 2rem;
    }
    
    .upload-area {
        min-height: 90px;
        max-height: 240px; /* Adjusted for mobile */
        padding: 1rem 0.5rem;
    }
    
    .upload-area i {
        font-size: 2rem !important;
    }
    
    .btn-lg {
        padding: 0.75rem 2rem;
        font-size: 1.1rem;
    }
    
    .suggestion-card {
        padding: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
}

/* Touch-friendly buttons */
@media (max-width: 576px) {
    .upload-area {
        min-height: 72px;
        max-height: 200px; /* Smaller for very small screens */
        margin-bottom: 1rem;
    }
    
    .btn {
        min-height: 48px;
        font-size: 1rem;
    }
    
    .card {
        border-radius: 8px;
    }
    
    .suggestion-card {
        margin-bottom: 1rem;
    }
    
    .meal-type-label {
        font-size: 1.3rem; /* Proportionally larger for mobile */
        letter-spacing: 0.3px;
    }
    
    /* Adjust icon size for mobile too */
    .suggestion-header .me-2 i {
        font-size: 1.3rem;
    }
    
    .suggestion-header {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    /* Keep add ingredient button same size as input on mobile */
    .add-ingredient-btn {
        height: 38px !important;
        width: 38px !important;
        min-height: 38px !important;
        padding: 0 !important;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .add-ingredient-input {
        height: 38px !important;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.btn:disabled {
    opacity: 0.6;
}

/* Badge styling for ingredients */
.badge {
    padding: 0.5rem 0.75rem;
    margin: 0.25rem;
    font-size: 0.875rem;
}

.badge.bg-primary {
    background: linear-gradient(90deg, #4fd1c5 0%, #38b2ac 100%) !important;
    color: #222 !important;
    border-radius: 999px !important;
    font-weight: 600;
    font-size: 1rem;
    padding: 0.5em 1.2em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    margin-bottom: 0.5em;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus states for accessibility */
.upload-area:focus-within {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* Animation for success states */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.upload-overlay i {
    animation: pulse 1s ease-in-out;
}

/* Responsive text */
.lead {
    font-size: 1.1rem;
}

@media (min-width: 768px) {
    .lead {
        font-size: 1.25rem;
    }
}

/* Card shadows */
.card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    /* EXACT color from FG1.png */
    background: #1c2333;
    border: none;
}

.shadow-lg {
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important;
}

/* Ensure proper spacing on mobile */
.container {
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 576px) {
    .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

.flag-icon {
    width: 1.5em;
    height: 1.5em;
    border-radius: 2px;
    box-shadow: 0 0 2px rgba(0,0,0,0.2);
}

.dropdown-item {
    padding: 0.5rem 1rem;
}

.dropdown-item:hover {
    background-color: rgba(255,255,255,0.1);
}

#loadingMessage {
    display: none;
    text-align: center;
    margin: 20px 0;
    font-size: 1.2em;
    color: #666;
}

#generatedImage {
    max-width: 200px;
    height: auto;
    margin: 10px auto;
    display: block;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

#generatedImage:hover {
    transform: scale(1.05);
}

/* Modal styling */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

#imageModal .modal-content {
    max-width: 552px; /* Fixed width: 512px image + 40px padding (20px each side) */
    max-height: 552px; /* Fixed height: 512px image + 40px padding (20px each side) */
    margin: auto;
    padding: 20px;
    background: #2d3748;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Responsive modal for smaller screens */
@media (max-width: 600px) {
    #imageModal .modal-content {
        max-width: 90vw;
        max-height: 90vh;
    }
}

#imageModal .close {
    position: absolute;
    right: 10px;
    top: 10px;
    font-size: 40px;
    font-weight: bold;
    color: #fff;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s, color 0.2s;
}

#imageModal .close:hover {
    background: #fff;
    color: #222;
}

#imageModal img {
    display: block;
    margin: 0 auto;
    border-radius: 8px;
    max-width: 100%;
    max-height: 70vh;
    width: auto;
    height: auto;
}

body.en .en { display: inline; }
body.en .cs { display: none; }
body.cs .cs { display: inline; }
body.cs .en { display: none; }

.generated-image-container {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.generated-image-container img {
    max-width: 400px; /* Desktop default */
    width: 100%;
    height: auto;
    cursor: pointer;
    border-radius: 8px;
    transition: transform 0.2s ease-in-out;
}

/* Tablet (≤768px): 280px */
@media (max-width: 768px) {
    .generated-image-container img {
        max-width: 280px;
    }
}

/* Mobile (≤576px): 250px */
@media (max-width: 576px) {
    .generated-image-container img {
        max-width: 250px;
    }
}

.generated-image-container img:hover {
    transform: scale(1.05);
}


.ingredients-wrap {
    margin-top: 1rem;
}

.nutritional-notes {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Debug information styling */
.debug-info {
    font-size: 0.5rem;
    color: #bbb;
    margin-top: 0.5rem;
}

/* Debug header and button less prominent */
.debug-header, .debug-header * {
    color: #bbb !important;
    font-size: 0.9rem !important;
    font-weight: normal !important;
}

/* Make the entire Debug section less visible */
.debug-frame,
.debug-frame .card-header,
.debug-frame .card-body {
    font-size: 0.5rem !important;
    color: #bbb !important;
    font-weight: normal !important;
    background: #232736 !important;
    border-color: #232736 !important;
}

/* Make only the Debug section header and button less visible and smaller */
.debug-frame .card-header,
.debug-frame .card-title,
.debug-frame .card-title i,
.debug-frame .btn,
.debug-frame .btn * {
    font-size: 0.8rem !important;
    color: #bbb !important;
    font-weight: normal !important;
    border-color: #444 !important;
}

/* Restore normal font size for Debug card body and content */
.debug-frame .card-body,
.debug-frame .card-body * {
    font-size: 1rem !important;
    color: inherit !important;
}

/* Make Debug section header text slightly less visible */
.debug-section .card-header h4,
.debug-section .card-header i,
.debug-section .card-header span {
    color: #ccc !important;
    opacity: 0.85;
}

.card-header {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    box-sizing: border-box;
    margin-left: 0;
    margin-right: 0;
}

.main-section-card {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

/* Add ingredient input fields - EXACT color from FG1.png */
.form-control,
input[type="text"],
input[placeholder*="Add ingredient"] {
    background: #1c2333;
    border: 1px solid #475569;
    color: #f1f5f9;
}

.form-control:focus,
input[type="text"]:focus,
input[placeholder*="Add ingredient"]:focus {
    background: #1c2333;
    border-color: #475569;
    box-shadow: 0 0 0 0.2rem rgba(71, 85, 105, 0.25);
    color: #f1f5f9;
}

.form-control::placeholder,
input[type="text"]::placeholder {
    color: #94a3b8;
}


/* Prep time badge - EXACT original colors */
.prep-time-badge {
    display: inline-block;
    background: #64748b;
    color: #f1f5f9;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.4em 0.8em;
    margin-bottom: 0.5em;
    max-width: fit-content;
    border: none;
    box-shadow: none;
}

/* Base styles for all ingredient tags - EXACT color from FG1.png */
.ingredient-tag,
.ingredient-chip {
    display: inline-block;
    background: #6c757d;
    color: #fff;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.4em 0.8em;
    margin: 0.25rem;
    white-space: nowrap;
    line-height: 1.2;
    border: none;
    box-shadow: none;
}

/* Additional styles for removable ingredient chips */
.ingredient-chip .remove-ingredient-btn {
    background: none;
    border: none;
    color: #fff;
    margin-left: 0.5rem;
    padding: 0;
    font-size: 1.1rem;
    line-height: 1;
    opacity: 0.7;
    cursor: pointer;
}

.ingredient-chip .remove-ingredient-btn:hover {
    opacity: 1;
}

/* Ingredients list container spacing */
.ingredients-list {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    min-height: 2rem;
    padding: 0.25rem;
}


/* Success Check Icon */
.success-check {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background-color: #28a745;
    color: white;
    border-radius: 50%;
    padding: 0.5rem;
    font-size: 1.2rem;
}

/* Photo Section Headers */
.photo-section h5 {
    color: #fff;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    opacity: 0.9;
}

.photo-section i {
    margin-right: 0.5rem;
}

/* Meal Buttons */
.meal-button {
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 1rem;
    margin: 0.5rem;
}

.meal-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.meal-button i {
    margin-right: 0.5rem;
}

/* Detected Ingredients Styling */
.detected-ingredients {
    margin-top: 1rem;
}

.detected-ingredients-label {
    color: #fff;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.detected-ingredients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
}

.detected-ingredient {
    background-color: rgba(108, 117, 125, 0.5);  /* matches the gray in the screenshot */
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.9rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* Meal Button Styling - match meal card colors */
.meal-btn {
    font-weight: 600;
    border: 2px solid transparent;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.meal-btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.meal-btn:hover:before {
    opacity: 1;
}

/* Breakfast Button - EXACT color from FG1.png */
.meal-btn-breakfast {
    background-color: #333948;
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffc107;
}

.meal-btn-breakfast:hover {
    background-color: #363c4b;
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffc107;
}

.meal-btn-breakfast i {
    color: #ffc107;
}

/* Snack Button - EXACT color from FG1.png */
.meal-btn-snack {
    background-color: #333948;
    border-color: rgba(255, 255, 255, 0.2);
    color: #17a2b8;
}

.meal-btn-snack:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: #17a2b8;
}

.meal-btn-snack i {
    color: #17a2b8;
}

/* Lunch Button - EXACT color from FG1.png */
.meal-btn-lunch {
    background-color: #333948;
    border-color: rgba(255, 255, 255, 0.2);
    color: #fd7e14;
}

.meal-btn-lunch:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fd7e14;
}

.meal-btn-lunch i {
    color: #fd7e14;
}

/* Dinner Button - EXACT color from FG1.png */
.meal-btn-dinner {
    background-color: #333948;
    border-color: rgba(255, 255, 255, 0.2);
    color: #dc3545;
}

.meal-btn-dinner:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: #dc3545;
}

.meal-btn-dinner i {
    color: #dc3545;
}

/* Dessert Button - EXACT color from FG1.png */
.meal-btn-dessert {
    background-color: #333948;
    border-color: rgba(255, 255, 255, 0.2);
    color: #e83e8c;
}

.meal-btn-dessert:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: #e83e8c;
}

.meal-btn-dessert i {
    color: #e83e8c;
}

/* Appetizer Button */
.meal-btn-appetizer {
    background-color: #333948;
    border-color: rgba(255, 255, 255, 0.2);
    color: #28a745;
}

.meal-btn-appetizer:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: #28a745;
}

.meal-btn-appetizer i {
    color: #28a745;
}

/* Soup Button */
.meal-btn-soup {
    background-color: #333948;
    border-color: rgba(255, 255, 255, 0.2);
    color: #844bf2;
}

.meal-btn-soup:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: #844bf2;
}

.meal-btn-soup i {
    color: #844bf2;
}

/* Salad Button */
.meal-btn-salad {
    background-color: #333948;
    border-color: rgba(255, 255, 255, 0.2);
    color: #20c997;
}

.meal-btn-salad:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: #20c997;
}

.meal-btn-salad i {
    color: #20c997;
}

/* Fix button group styling to remove curves from all buttons */
.btn-group .btn:first-child,
.btn-group .btn:last-child,
.btn-group .btn {
    border-radius: 8px !important;
}

/* Add ingredient button - Same purple color as New meal button */
.add-ingredient-btn {
    background-color: transparent !important;
    border-color: #a694ff !important;
    color: #a694ff !important;
}

.add-ingredient-btn:hover {
    background-color: #a694ff !important;
    border-color: #a694ff !important;
    color: #fff !important;
}

/* New meal button - Purple color */
button[id^="regenerate-btn-"] {
    background-color: transparent !important;
    border-color: #a694ff !important;
    color: #a694ff !important;
}

button[id^="regenerate-btn-"]:hover {
    background-color: #a694ff !important;
    border-color: #a694ff !important;
    color: #fff !important;
}

/* Recent Suggestions list items - match card background */
.list-group-item {
    background-color: #1c2333 !important;
    border-color: #475569 !important;
    color: #f1f5f9 !important;
}

/* API Call Prices table - match theme colors */
.table {
    --bs-table-bg: #1c2333 !important;
    --bs-table-color: #f1f5f9 !important;
    --bs-table-border-color: #475569 !important;
    background-color: #1c2333 !important;
    color: #f1f5f9 !important;
}

.table th,
.table td {
    background-color: #1c2333 !important;
    border-color: #475569 !important;
    color: #f1f5f9 !important;
}

.table thead th {
    background-color: #1c2333 !important;
    border-color: #475569 !important;
    color: #f1f5f9 !important;
}

/* ================================
   MEAL GENERATION QUEUE SYSTEM
   ================================ */

/* Disabled state for meal buttons during generation queue */
button[id^="btn-"]:disabled,
button[id^="regenerate-btn-"]:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* Disabled state for ingredient removal buttons during generation queue */
.remove-ingredient-btn:disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* Special styling for buttons that are generating */
button.generating {
    opacity: 0.7 !important;
    position: relative;
}

/* Optional: Add a subtle pulsing animation for generating buttons */
button.generating::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(166, 148, 255, 0.1);
    border-radius: inherit;
    animation: pulse-generating 2s infinite;
}

@keyframes pulse-generating {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.1; }
}

/* ================================
   MAIN FEATURES SECTION
   ================================ */

/* Feature Groups Layout */
.feature-groups {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.feature-group {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
}

.feature-group:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Feature Group Icons */
.feature-group-icon {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

/* Icon color variants - slightly larger and different colors than meal buttons */
.feature-group:nth-child(1) .feature-group-icon {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: #fff;
}

.feature-group:nth-child(2) .feature-group-icon {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}

.feature-group:nth-child(3) .feature-group-icon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}

.feature-group:nth-child(4) .feature-group-icon {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}

.feature-group:nth-child(5) .feature-group-icon {
    background: linear-gradient(135deg, #065f46, #064e3b);
    color: #fff;
}

.feature-group:hover .feature-group-icon {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Feature Group Content */
.feature-group-content {
    flex: 1;
}

.feature-group-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.feature-group-text {
    font-size: 1rem;
    line-height: 1.6;
    color: #cbd5e1;
    margin: 0;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .feature-group {
        padding: 1.25rem;
        gap: 1rem;
    }
    
    .feature-group-icon {
        width: 42px;
        height: 42px;
        font-size: 1.3rem;
    }
    
    .feature-group-title {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    .feature-group-text {
        font-size: 0.95rem;
        line-height: 1.5;
    }
}

@media (max-width: 576px) {
    .feature-groups {
        gap: 1rem;
    }
    
    .feature-group {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .feature-group-icon {
        align-self: center;
        width: 48px;
        height: 48px;
        font-size: 1.4rem;
    }
    
    .feature-group-title {
        font-size: 1.15rem;
    }
    
    .feature-group-text {
        font-size: 0.9rem;
    }
}

/* ================================
   MERGED PHOTO UPLOAD & THUMBNAILS
   ================================ */

/* Thumbnail Grid inside Upload Area */
.thumbnail-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    justify-content: center;
    align-content: center; /* Center multiple rows vertically */
    align-items: center; /* Center individual items */
    padding: 0.5rem;
    position: relative;
    width: 100%;
    min-height: 100%;
    max-width: calc(100% - 1rem); /* Account for reduced padding */
}

/* Upload Success Overlay - Centered horizontally, top positioned */
.upload-success-overlay {
    position: absolute;
    top: 0.5rem;
    left: 50%;
    transform: translateX(-50%); /* Center horizontally */
    background: rgba(0, 0, 0, 0.8);
    border-radius: 50%;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-success-overlay:hover {
    transform: translateX(-50%) scale(1.1); /* Maintain centering while scaling */
    background: rgba(0, 0, 0, 0.9);
}

/* Edit Hint Text */
.edit-hint {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.25rem;
    font-size: 0.65rem;
    color: #94a3b8;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.8);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.upload-success-overlay:hover .edit-hint {
    opacity: 1;
}

/* Individual Thumbnail Item - Updated for merged container */
.thumbnail-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.thumbnail-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

/* Thumbnail Image - Increased by 30% from 64px to 83px */
.thumbnail-img {
    width: 83px;
    height: 83px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: border-color 0.2s ease;
}

.thumbnail-item:hover .thumbnail-img {
    border-color: rgba(255, 255, 255, 0.3);
}

/* Thumbnail Filename - Adjusted for 83px thumbnails */
.thumbnail-filename {
    font-size: 0.65rem;
    color: #94a3b8;
    text-align: center;
    max-width: 99px; /* Slightly wider to match 83px thumbnail */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Mobile responsiveness for merged thumbnails */
@media (max-width: 768px) {
    .thumbnail-grid {
        gap: 0.2rem;
        padding: 0.375rem;
    }
    
    .thumbnail-img {
        width: 62px;
        height: 62px;
    }
    
    .thumbnail-item {
        padding: 0.1rem;
    }
    
    .thumbnail-filename {
        font-size: 0.6rem;
        max-width: 78px;
    }
    
    .upload-success-overlay {
        top: 0.25rem;
        left: 50%;
        transform: translateX(-50%);
        padding: 0.375rem;
    }
    
    .edit-hint {
        font-size: 0.6rem;
    }
}

@media (max-width: 576px) {
    .thumbnail-img {
        width: 52px;
        height: 52px;
    }
    
    .thumbnail-filename {
        font-size: 0.55rem;
        max-width: 65px;
    }
    
    .upload-success-overlay {
        left: 50%;
        transform: translateX(-50%);
        padding: 0.25rem;
    }
    
    .upload-success-overlay i {
        font-size: 1.5rem;
    }
    
    .edit-hint {
        font-size: 0.5rem;
    }
}

    }
}

/* ================================
   AUTOMATIC MEAL IMAGES
   ================================ */

/* Generated meal images - responsive sizing */
.meal-image {
    max-width: 100%;
    height: auto;
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    margin: 1rem auto 0 auto;
    display: block;
}

.meal-image:hover {
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Action buttons row styling - longer New Meal button */
.action-buttons-row {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.action-buttons-row .btn {
    min-width: 150px; /* Make button slightly longer horizontally */
    height: 45px; /* Make button lower (less tall) vertically */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile responsiveness for action buttons */
@media (max-width: 576px) {
    .action-buttons-row .btn {
        min-width: 120px;
        height: 40px;
        font-size: 0.9rem;
    }
}

/* ================================
   LEGAL PAGES STYLING
   ================================ */

.legal-content {
    line-height: 1.6;
    color: #f1f5f9;
}

.legal-content h1 {
    color: #a694ff;
    margin-bottom: 1.5rem;
    font-size: 2rem;
}

.legal-content h2 {
    color: #e2e8f0;
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    border-bottom: 1px solid #374151;
    padding-bottom: 0.5rem;
}

.legal-content h3 {
    color: #cbd5e1;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
}

.legal-content p {
    margin-bottom: 1rem;
    text-align: justify;
}

.legal-content ul, .legal-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.legal-content li {
    margin-bottom: 0.5rem;
}

.legal-content strong {
    color: #e2e8f0;
    font-weight: 600;
}

.legal-content em {
    color: #cbd5e1;
    font-style: italic;
}

.legal-content table {
    width: 100%;
    margin: 1.5rem 0;
    border-collapse: collapse;
}

.legal-content table th,
.legal-content table td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid #374151;
}

.legal-content table th {
    background-color: #374151;
    color: #e2e8f0;
    font-weight: 600;
}

.legal-content table td {
    background-color: #1f2937;
}

.legal-content table tr:hover td {
    background-color: #2d3748;
}

/* Mobile responsiveness for legal content */
@media (max-width: 768px) {
    .legal-content h1 {
        font-size: 1.75rem;
    }
    
    .legal-content h2 {
        font-size: 1.25rem;
    }
    
    .legal-content h3 {
        font-size: 1.1rem;
    }
    
    .legal-content table {
        font-size: 0.9rem;
    }
    
    .legal-content table th,
    .legal-content table td {
        padding: 0.5rem;
    }
}
