:root {
    /* Color Palette - Child friendly but modern */
    --primary: #FF7E67; /* Warm Orange */
    --primary-dark: #E86A55;
    --logo-green: #2ECC71;  /* Logo Green */
    --logo-green-dark: #27AE60;
    --secondary: #00D2B5; /* Emerald Green */
    --accent: #FFD166; /* Sunny Yellow */
    --background: #F8F9FA;
    --surface: #FFFFFF;
    
    --text-main: #2D3142;
    --text-light: #6C757D;
    
    /* Gradients */
    --grad-rainbow: linear-gradient(135deg, #FF9A9E 0%, #FECFEF 99%, #FECFEF 100%);
    --grad-water: linear-gradient(135deg, #89F7FE 0%, #66A6FF 100%);
    --grad-sun: linear-gradient(135deg, #FDFBFB 0%, #EBEDEE 100%);
    
    /* Layout */
    --sidebar-width: 250px;
    --border-radius-lg: 24px;
    --border-radius-md: 16px;
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 15px 35px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Nunito', sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text-main);
    overflow-x: hidden;
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    padding: 2rem;
    box-shadow: 2px 0 20px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 3rem;
    color: var(--logo-green);
}

.logo i {
    font-size: 2rem;
}

.logo h2 {
    font-size: 1.5rem;
    font-weight: 900;
}

.heart-beat {
    animation: heartbeat 2s infinite;
}

@keyframes heartbeat {
    0% { transform: scale(1); }
    15% { transform: scale(1.15); }
    30% { transform: scale(1); }
    45% { transform: scale(1.15); }
    60% { transform: scale(1); }
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.nav-links li {
    padding: 1rem;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-weight: 600;
    color: var(--text-light);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-links li i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.nav-links li:hover {
    background: rgba(0, 210, 181, 0.1);
    color: var(--secondary);
    transform: translateX(5px);
}

.nav-links li.active {
    background: var(--secondary);
    color: white;
}

.score-card {
    background: linear-gradient(135deg, var(--background), #E9ECEF);
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: auto;
}

.score-icon {
    font-size: 2rem;
}

.score-info {
    display: flex;
    flex-direction: column;
}

.score-label {
    font-size: 0.8rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 800;
}

.score-value {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--text-main);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 3rem 5%;
    max-width: 1200px;
}

.section-header {
    margin-bottom: 3rem;
}

.section-header h1 {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
    background: linear-gradient(45deg, #FF6B35, #2ECC71);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-header p {
    font-size: 1.2rem;
    color: var(--text-light);
}

/* Tabs System */
.tab-content {
    display: none;
}

.active-content {
    display: block;
}

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

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

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s ease;
    border: 1px solid rgba(0,0,0,0.02);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

/* Dashboard Grid */
.grid-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

/* Floating Fruits Background */
.fruits-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.floating-fruit-bg {
    position: absolute;
    font-size: 2.2rem;
    opacity: 0.18;
    animation: floatFruit var(--duration, 8s) ease-in-out infinite;
    user-select: none;
    filter: saturate(1.4);
}

@keyframes floatFruit {
    0%   { transform: translateY(0px) rotate(0deg) scale(1); }
    33%  { transform: translateY(-22px) rotate(8deg) scale(1.07); }
    66%  { transform: translateY(10px) rotate(-6deg) scale(0.95); }
    100% { transform: translateY(0px) rotate(0deg) scale(1); }
}

/* Make sections position relative so fruits-bg is contained */
#dashboard, #tracker {
    position: relative;
}

/* Push content above the floating fruits layer */
#dashboard .section-header,
#dashboard .grid-dashboard,
#dashboard .weight-chart-section,
#tracker .section-header,
#tracker .tracker-container,
#tracker .history-section {
    position: relative;
    z-index: 1;
}

.hero-card {
    grid-column: 1 / -1;
    padding: 3rem;
}

.bg-gradient-rainbow { background: var(--grad-rainbow); }
.bg-gradient-water { background: var(--grad-water); }
.bg-gradient-sun { background: var(--grad-sun); border: 2px solid #EEE; }

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: white;
}
.bg-gradient-sun .card-icon { color: var(--accent); }

.card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 800;
}

/* Tracker Section */
.tracker-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.ai-input-area h3 { margin-bottom: 0.5rem; font-weight: 800; }
.ai-input-area .subtitle { color: var(--text-light); margin-bottom: 1.5rem; font-size: 0.95rem; }

textarea {
    width: 100%;
    height: 120px;
    padding: 1.2rem;
    border-radius: var(--border-radius-md);
    border: 2px solid #E9ECEF;
    font-size: 1rem;
    resize: none;
    margin-bottom: 1.5rem;
    transition: border-color 0.3s;
    background: var(--background);
}

textarea:focus {
    outline: none;
    border-color: var(--secondary);
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 126, 103, 0.4);
    transition: all 0.3s ease;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 126, 103, 0.5);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-primary:disabled {
    background: #CCC;
    box-shadow: none;
    cursor: not-allowed;
}

.api-key-container {
    margin-bottom: 1rem;
}
.api-key-container label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 0.3rem;
    font-weight: 700;
}
.api-key-container input {
    width: 100%;
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid #E9ECEF;
}

/* Glassmorphism for IA response */
.glassmorphism {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    flex-direction: column;
}

.bot-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.bot-avatar {
    width: 50px;
    height: 50px;
    background: var(--secondary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.feedback-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-main);
    flex: 1;
}

.earned-score {
    margin-top: 1.5rem;
    font-weight: 800;
    color: var(--secondary);
    font-size: 1.2rem;
    text-align: center;
    padding: 1rem;
    background: rgba(0, 210, 181, 0.1);
    border-radius: var(--border-radius-md);
}

/* History Grid */
.history-section h3 {
    margin-bottom: 1.5rem;
    font-weight: 800;
}

.history-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.history-item {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--border-radius-md);
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--secondary);
}

.history-date { font-size: 0.8rem; color: var(--text-light); margin-bottom: 0.3rem; }
.history-food { font-weight: 600; font-size: 1.1rem; }
.history-points {
    background: rgba(0, 210, 181, 0.15);
    color: var(--secondary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 900;
}

/* Recipes section */
.grid-recipes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.recipe-card {
    padding: 0;
    overflow: hidden;
}

.recipe-img {
    height: 200px;
    background-size: cover;
    background-position: center;
    background-color: #EEE;
}
.img-oat { background-image: url('https://images.unsplash.com/photo-1517673132405-a56a62b18caf?auto=format&fit=crop&w=600&q=80'); }
.img-chicken { background-image: url('https://images.unsplash.com/photo-1604908176997-125f25cc6f3d?auto=format&fit=crop&w=600&q=80'); }
.img-fruit { background-image: url('https://images.unsplash.com/photo-1519996529931-28324d5a630e?auto=format&fit=crop&w=600&q=80'); }

.recipe-content {
    padding: 2rem;
}

.badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: rgba(255, 126, 103, 0.1);
    color: var(--primary);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

/* Parents Section */
.parents-alerts { margin-bottom: 2rem; }

.alert-box {
    display: flex;
    gap: 20px;
    padding: 1.5rem;
    border-radius: var(--border-radius-md);
    background: rgba(232, 106, 85, 0.1);
    border: 1px solid rgba(232, 106, 85, 0.3);
}

.alert-box i {
    font-size: 2rem;
    color: var(--primary-dark);
}

.alert-box strong {
    font-size: 1.2rem;
    color: var(--primary-dark);
    display: block;
    margin-bottom: 0.5rem;
}

.grid-parents {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.text-green { color: var(--secondary); }
.text-orange { color: var(--primary); }

/* Toast Notification */
#toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.toast {
    background: var(--surface);
    color: var(--text-main);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 300px;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-left: 5px solid var(--secondary);
}

.toast.show {
    transform: translateX(0);
}

.toast i { font-size: 1.5rem; color: var(--secondary); }
.toast.error { border-left-color: var(--primary-dark); }
.toast.error i { color: var(--primary-dark); }

/* Responsive adjustments */
/* Responsive adjustments */
@media (max-width: 992px) {
    .tracker-container { grid-template-columns: 1fr; }
    .grid-parents { grid-template-columns: 1fr; }
}

/* Mini Games Styles */
.grid-games {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.text-blue { color: var(--grad-water); }
.text-red { color: var(--primary); }

.game-status {
    margin-top: 1rem;
    font-weight: 800;
    color: var(--text-light);
    text-align: center;
}

/* Water Game */
.water-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 1.5rem;
}

.glass {
    font-size: 2.5rem;
    color: #E9ECEF;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    justify-content: center;
    align-items: center;
}

.glass:hover { transform: scale(1.2); }
.glass.filled { color: #4facfe; transform: scale(1.1); filter: drop-shadow(0 0 5px rgba(79, 172, 254, 0.5)); }

/* Fruit Game */
.fruit-game-view {
    margin-top: 1.5rem;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    background: #f0f2f5;
    border-radius: var(--border-radius-md);
    padding: 10px;
    height: 180px;
}

.game-spot {
    background: rgba(255,255,255,0.5);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.floating-fruit {
    font-size: 2rem;
    cursor: pointer;
    animation: popIn 0.3s ease-out forwards;
    user-select: none;
}

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    70% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.game-controls {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.api-help-text {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 210, 181, 0.05);
    border-radius: 8px;
    font-size: 0.85rem;
    border: 1px dashed var(--secondary);
}

.api-help-text ol {
    margin: 0.5rem 0 0.5rem 1.2rem;
}

.api-help-text a {
    color: var(--secondary);
    font-weight: 700;
    text-decoration: none;
}

.api-help-text a:hover {
    text-decoration: underline;
}

.warning-text {
    color: var(--primary-dark);
    font-size: 0.75rem;
    margin-top: 0.5rem;
    font-weight: 700;
}

.text-purple { color: #a855f7; }

.img-oat { background-image: url('https://images.unsplash.com/photo-1495214783159-3503fd1b572d?auto=format&fit=crop&w=600&q=80'); } /* Oatmeal bowl with banana */
.img-chicken { background-image: url('https://images.unsplash.com/photo-1562967914-608f82629710?auto=format&fit=crop&w=600&q=80'); } /* Chicken nuggets */
.img-fruit { background-image: url('https://images.unsplash.com/photo-1519996529931-28324d5a630e?auto=format&fit=crop&w=600&q=80'); }
.img-pancakes { background-image: url('pancakes_selva.png'); }
.img-hummus { background-image: url('hummus_poderes.png'); }
.img-yogurt { background-image: url('paletas_frutales.png'); }

/* New Recipes */
.img-sandwich { background-image: url('https://images.unsplash.com/photo-1525351484163-7529414344d8?auto=format&fit=crop&w=600&q=80'); }
.img-muffins { background-image: url('https://images.unsplash.com/photo-1607958996333-41aef7caefaa?auto=format&fit=crop&w=600&q=80'); } /* Green spinach banana muffins */
.img-pizza { background-image: url('https://images.unsplash.com/photo-1513104890138-7c749659a591?auto=format&fit=crop&w=600&q=80'); }

/* Infographic styling */
.infographic-container {
    margin-top: 1.5rem;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(0,0,0,0.05);
}

.infographic-img {
    width: 100%;
    display: block;
    height: auto;
    object-fit: cover;
}

.infographic-credit {
    font-size: 0.7rem;
    color: var(--text-light);
    padding: 0.5rem 1rem;
    text-align: center;
    background: rgba(0,0,0,0.02);
}

.infographic-credit a {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 700;
}

.infographic-credit a:hover {
    text-decoration: underline;
}

/* Video Grid for Parents */
.parents-videos {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.parents-videos h3 {
    margin-bottom: 1.5rem;
    font-weight: 800;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.video-card {
    background: var(--surface);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.video-info {
    padding: 1rem;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.video-info p {
    padding: 0;
    margin: 0;
    font-weight: 700;
    font-size: 0.9rem;
    background: transparent;
}

.video-link {
    color: var(--secondary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.video-link:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; padding: 1rem; flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: center; border-radius: 0 0 20px 20px;}
    .logo { margin-bottom: 0; }
    .nav-links { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 5px;}
    .nav-links li { padding: 0.5rem 1rem; }
    .nav-links li span { display: none; } /* Show icons only on mobile nav */
    .score-card { width: 100%; margin-top: 1rem; justify-content: center;}
    .main-content { margin-left: 0; padding: 2rem 5%; }
}

/* ====== WEIGHT CHART SECTION ====== */
.weight-chart-section {
    margin-top: 3rem;
    background: var(--surface);
    border-radius: var(--border-radius-lg);
    padding: 2rem 2.5rem;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(0,0,0,0.02);
}

.weight-chart-section h3 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(45deg, var(--logo-green), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.weight-chart-section .chart-subtitle {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 1.8rem;
}

.weight-table-wrapper {
    overflow-x: auto;
    border-radius: var(--border-radius-md);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.04);
}

table.weight-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

table.weight-table thead tr {
    background: linear-gradient(135deg, var(--logo-green), var(--secondary));
    color: white;
}

table.weight-table thead th {
    padding: 0.9rem 1.2rem;
    text-align: center;
    font-weight: 800;
    letter-spacing: 0.5px;
}

table.weight-table tbody tr {
    transition: background 0.2s;
}

table.weight-table tbody tr:nth-child(even) {
    background: rgba(0, 210, 181, 0.05);
}

table.weight-table tbody tr:hover {
    background: rgba(46, 204, 113, 0.1);
}

table.weight-table td {
    padding: 0.8rem 1.2rem;
    text-align: center;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    color: var(--text-main);
}

table.weight-table td:first-child {
    font-weight: 700;
    color: var(--logo-green-dark);
}

.weight-range-bar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.weight-note {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--text-light);
    text-align: center;
}

.weight-note i {
    color: var(--logo-green);
}
