/* Mobile First & Minimalist */
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background-color: #1a1a1a;
    color: #fff;
    padding: 1rem;
    text-align: center;
}

main {
    flex: 1;
    padding: 1rem;
    padding-bottom: 70px; /* Space for bottom nav */
}

.module {
    display: none;
}
.module.active {
    display: block;
}

.card {
    background: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    margin-bottom: 1rem;
}

button {
    background-color: #007bff;
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 16px;
    width: 100%;
    cursor: pointer;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    width: 100%;
    background: #fff;
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.bottom-nav button {
    background: none;
    color: #555;
    width: auto;
    font-size: 14px;
    padding: 10px;
}

/* Listas y Touch Targets */
.item-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.food-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px; /* Touch target grande */
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

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

.food-item:active {
    background-color: #f0f0f0;
}

.food-info strong {
    display: block;
    font-size: 16px;
    margin-bottom: 4px;
}

.food-info small {
    color: #666;
    font-size: 13px;
}

.food-cals {
    font-weight: bold;
    color: #007bff;
    font-size: 18px;
}

#food-search {
    width: 100%;
    padding: 14px;
    border: 1px solid #ccc;
    border-radius: 8px;
    margin-bottom: 12px;
    box-sizing: border-box;
    font-size: 16px; /* Previene el zoom automático en iOS */
}

/* --- Bottom Sheet Styles --- */
.backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); opacity: 0; pointer-events: none;
    transition: opacity 0.3s; z-index: 998;
}
.backdrop.active { opacity: 1; pointer-events: auto; }

.bottom-sheet {
    position: fixed; bottom: -100%; left: 0; width: 100%;
    background: #fff; border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    padding-bottom: env(safe-area-inset-bottom); /* Soporte nativo iOS */
}
.bottom-sheet.active { bottom: 0; }

.sheet-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid #eee;
}
.sheet-header h3 { margin: 0; font-size: 18px; }
.close-btn { 
    background: none; color: #999; font-size: 28px; 
    width: 40px; padding: 0; cursor: pointer; text-align: right;
}

.sheet-body { padding: 24px 20px; }

.input-group {
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 30px;
}
.input-group input {
    width: 140px; font-size: 42px; text-align: center;
    border: none; border-bottom: 3px solid #007bff; border-radius: 0;
    outline: none; margin-right: 10px; font-weight: bold; color: #1a1a1a;
}
.input-group span { font-size: 24px; font-weight: bold; color: #666; }

.macros-preview { display: flex; justify-content: space-around; margin-bottom: 30px; }
.macro-box { text-align: center; }
.macro-box span { display: block; font-size: 22px; font-weight: bold; }
.cal-color { color: #007bff; }

.btn-primary {
    background-color: #007bff; color: #fff; border: none;
    padding: 18px; border-radius: 14px; font-size: 18px; font-weight: bold;
    width: 100%; cursor: pointer;
}
.btn-primary:active { background-color: #0056b3; }
