/* =========================================
   BASE & VARIABLES
========================================= */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
    --primary-color: #ff6b6b;
    --text-main: #ffffff;
    --text-muted: #e2e8f0;
    --glass-bg: rgba(20, 25, 35, 0.75);
    --glass-border: rgba(255, 255, 255, 0.15);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --radius: 20px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Poppins', sans-serif;
    color: var(--text-main);
    background: url('https://images.unsplash.com/photo-1504674900247-0877df9cc836?auto=format&fit=crop&q=80&w=2070') center center/cover fixed;
    min-height: 100vh;
}

.overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1;
}

.app-wrapper {
    position: relative;
    z-index: 2;
    max-width: 650px;
    margin: 0 auto;
    padding: 12px;
    padding-bottom: 20px;
}

/* =========================================
   GLASS EFFECT
========================================= */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

/* =========================================
   HEADER
========================================= */
.app-header {
    padding: 16px 12px;
    border-radius: var(--radius);
    text-align: center;
    margin-bottom: 16px;
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.app-header p {
    font-size: 0.75rem;
    color: var(--primary-color);
    margin-top: 4px;
}

/* =========================================
   WEEK & DAY NAVIGATION (HORIZONTAL SCROLL)
========================================= */
.week-nav, .day-nav {
    border-radius: 40px;
    padding: 6px 4px;
    margin-bottom: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.week-list, .day-list {
    display: inline-flex;
    gap: 8px;
    padding: 4px 2px;
}

.week-item, .day-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 40px;
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.5);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.day-item {
    flex-direction: column;
    padding: 6px 12px;
    gap: 4px;
}

.week-item.active, .day-item.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(255,107,107,0.4);
}

.feedback-tab {
    background: rgba(255,107,107,0.3);
    border: 1px solid rgba(255,107,107,0.6);
}

.day-name {
    font-size: 0.75rem;
    font-weight: 700;
}

.day-date {
    font-size: 0.6rem;
    opacity: 0.8;
}

/* =========================================
   MENU CARDS (COMPACT)
========================================= */
.menu-view {
    display: none;
    animation: fadeIn 0.3s;
}

.menu-view.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.meal-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.meal-card {
    border-radius: 16px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(20, 25, 35, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1);
    transition: transform 0.2s;
}

.meal-card:hover {
    transform: translateY(-2px);
}

.meal-icon {
    font-size: 1.6rem;
    min-width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.meal-info {
    flex: 1;
}

.meal-name {
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.3;
    margin: 0;
    word-break: break-word;
}

/* Nutrition info */
.nutrition-info {
    font-size: 0.7rem;
    opacity: 0.8;
    margin-top: 4px;
    display: inline-block;
    margin-right: 8px;
    background: rgba(0,0,0,0.3);
    padding: 2px 6px;
    border-radius: 20px;
}

/* =========================================
   FOOTER
========================================= */
.app-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.4);
}

/* =========================================
   FEEDBACK MODAL (RESPONSIVE)
========================================= */
.feedback-modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.feedback-modal-content {
    width: 90%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    background: rgba(20,25,35,0.98);
    border-radius: 28px;
    padding: 20px;
    position: relative;
    border: 1px solid rgba(255,255,255,0.2);
    animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.feedback-close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #aaa;
}

.feedback-modal-content h3 {
    font-size: 1.4rem;
    color: var(--primary-color);
    margin-bottom: 8px;
    padding-right: 30px;
}

.feedback-modal-content p {
    font-size: 0.8rem;
    margin-bottom: 20px;
    opacity: 0.8;
}

#feedbackForm input, #feedbackForm textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(0,0,0,0.5);
    color: white;
    font-size: 0.9rem;
    font-family: inherit;
}

.submit-feedback {
    background: var(--primary-color);
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 40px;
    font-weight: bold;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.submit-feedback:hover {
    background: #ff5252;
}

.feedback-status {
    margin-top: 12px;
    text-align: center;
    font-size: 0.8rem;
}

.feedback-status.success { color: #4ade80; }
.feedback-status.error { color: #f87171; }

/* Audio controls */
.audio-controls {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 4px;
}

.speech-lang {
    background: rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 40px;
    padding: 6px 12px;
    color: white;
    font-size: 0.75rem;
    cursor: pointer;
}

.mic-button {
    background: var(--primary-color);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.mic-button:hover {
    transform: scale(1.05);
}

.mic-button.listening {
    background: #dc2626;
    animation: pulse 1.2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(220,38,38,0.7); }
    70% { box-shadow: 0 0 0 8px rgba(220,38,38,0); }
    100% { box-shadow: 0 0 0 0 rgba(220,38,38,0); }
}

.interim-text {
    font-size: 0.7rem;
    color: #ffaa66;
    margin: 4px 0;
    min-height: 24px;
    font-style: italic;
}

/* =========================================
   EXTRA SMALL DEVICES (<=480px)
========================================= */
@media (max-width: 480px) {
    .app-wrapper {
        padding: 8px;
    }
    .week-item, .day-item {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
    .meal-icon {
        font-size: 1.4rem;
        min-width: 36px;
        height: 36px;
    }
    .meal-name {
        font-size: 0.8rem;
    }
    .nutrition-info {
        font-size: 0.65rem;
        padding: 2px 5px;
    }
    .feedback-modal-content {
        padding: 16px;
    }
    .mic-button {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}

/* =========================================
   SAFE AREA FOR NOTCHED PHONES
========================================= */
@supports (padding: max(0px)) {
    .app-wrapper {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}