/* ===== AI Kuchnia — Unified with mB2B ===== */

:root {
    --primary: #0d6efd;
    --primary-dark: #0a58ca;
    --success: #198754;
    --danger: #dc3545;
    --warning: #ffc107;
    --orange: #fd7e14;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-500: #adb5bd;
    --gray-700: #495057;
    --gray-900: #212529;
    --tab-height: 56px;
    --navbar-height: 56px;
    --subnav-height: 40px;
    --touch-min: 44px;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0; padding: 0;
    background: var(--gray-100);
    color: var(--gray-900);
    padding-bottom: calc(var(--tab-height) + 8px);
    padding-top: var(--navbar-height);
    -webkit-tap-highlight-color: transparent;
}

/* ===== NAVBAR (same as mB2B) ===== */
.app-navbar {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--navbar-height);
    background: linear-gradient(135deg, var(--primary) 0%, #0b5ed7 60%, #198754 100%);
    color: #fff;
    display: flex; align-items: center;
    padding: 0 12px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.app-navbar .brand {
    font-weight: 700; font-size: 1.1rem;
    white-space: nowrap; margin-right: 4px;
    color: #fff; text-decoration: none;
}
.app-navbar .brand-kuchnia {
    font-size: 0.75rem; font-weight: 400;
    color: rgba(255,255,255,0.7);
    margin-right: 12px;
}
.app-navbar .nav-links-main {
    display: none;
    align-items: center; gap: 4px; margin-left: auto;
}
.app-navbar .nav-links-main a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    padding: 6px 12px; border-radius: 8px;
    font-size: 0.8rem; display: flex; align-items: center; gap: 4px;
    transition: color 0.15s, background 0.15s;
}
.app-navbar .nav-links-main a:hover { color: #fff; background: rgba(255,255,255,0.1); }
.app-navbar .nav-links-main a.active { color: #fff; background: rgba(255,255,255,0.2); font-weight: 600; }
.app-navbar .nav-links-main a span { display: none; }

/* ===== SUB-NAV (Kuchnia sections, desktop) ===== */
.sub-nav {
    position: fixed; top: var(--navbar-height); left: 0; right: 0;
    height: var(--subnav-height);
    background: #fff; border-bottom: 1px solid var(--gray-200);
    display: flex; align-items: center; gap: 2px;
    padding: 0 12px; z-index: 999;
    overflow-x: auto;
}
.sub-nav a {
    color: var(--gray-700); text-decoration: none;
    padding: 6px 12px; border-radius: 6px;
    font-size: 0.82rem; white-space: nowrap;
    transition: color 0.15s, background 0.15s;
}
.sub-nav a:hover { background: var(--gray-100); }
.sub-nav a.active { color: var(--primary); background: rgba(13,110,253,0.08); font-weight: 600; }

/* ===== BOTTOM TABS (mobile, same style as mB2B) ===== */
.bottom-tabs {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: var(--tab-height);
    background: #fff; display: flex;
    border-top: 1px solid var(--gray-200);
    z-index: 1000;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
}
.bottom-tabs a {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    text-decoration: none; color: var(--gray-500);
    font-size: 0.7rem; gap: 2px;
    min-height: var(--touch-min);
    transition: color 0.15s;
}
.bottom-tabs a i { font-size: 1.3rem; }
.bottom-tabs a.active { color: var(--primary); font-weight: 600; }
.bottom-tabs a.b2b-back { color: var(--gray-700); }
.bottom-tabs a.b2b-back i { color: var(--primary); }

/* ===== STAT CARDS ===== */
.stat-card {
    background: #fff; border-radius: var(--radius);
    padding: 16px; text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.stat-card .number { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-card .label { font-size: 0.8rem; color: var(--gray-500); }

/* ===== DISH CARDS ===== */
.card-dish {
    background: #fff; border-radius: var(--radius);
    padding: 12px; margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    cursor: pointer; transition: box-shadow 0.2s;
    border-left: 4px solid var(--primary);
}
.card-dish:hover { box-shadow: 0 3px 8px rgba(0,0,0,0.12); }
.card-dish .dish-name { font-weight: 600; font-size: 0.95rem; }
.card-dish .dish-meta { font-size: 0.78rem; color: var(--gray-500); }
.card-dish .dish-cost { font-weight: 600; color: var(--success); }

/* ===== NUTRIENT BADGES ===== */
.badge-kcal { background: var(--danger); }
.badge-protein { background: var(--primary); }
.badge-fat { background: var(--warning); color: #333; }
.badge-carbs { background: #6f42c1; }
.nutrient-badge {
    display: inline-block; padding: 2px 8px;
    border-radius: 12px; font-size: 0.75rem; color: #fff;
    margin-right: 4px;
}

/* ===== SEARCH ===== */
.search-box {
    border-radius: 20px; border: 1px solid var(--gray-200);
    padding: 8px 16px; font-size: 0.9rem; width: 100%;
    background: #fff;
}
.search-box:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(13,110,253,0.15); }

/* ===== CATEGORY PILLS ===== */
.cat-pill {
    display: inline-block; padding: 4px 12px;
    border-radius: 16px; font-size: 0.8rem;
    background: var(--gray-200); color: #333;
    cursor: pointer; margin: 2px; transition: all 0.2s;
    text-decoration: none; border: none;
}
.cat-pill:hover, .cat-pill.active { background: var(--primary); color: #fff; }

/* ===== TABLES ===== */
.ing-table { font-size: 0.85rem; }
.ing-table th { font-weight: 600; background: var(--gray-100); position: sticky; top: 0; }
.ing-table .total-row { font-weight: 700; background: #dbeafe; }

/* ===== INPUTS ===== */
.portions-input {
    width: 80px; text-align: center;
    border: 2px solid var(--primary); border-radius: 8px;
    font-size: 1.1rem; font-weight: 600; padding: 4px;
}
.portions-input:focus { outline: none; box-shadow: 0 0 0 2px rgba(13,110,253,0.3); }

/* ===== DAY CARD ===== */
.day-card {
    background: #fff; border-radius: var(--radius);
    padding: 12px; margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.day-card .day-header {
    font-weight: 700; font-size: 0.95rem;
    padding-bottom: 8px; margin-bottom: 8px;
    border-bottom: 2px solid #dbeafe;
}

/* ===== SHOPPING ===== */
.shop-category {
    font-weight: 700; font-size: 0.85rem; color: var(--primary);
    text-transform: uppercase; padding: 8px 0 4px;
    border-bottom: 1px solid var(--gray-200);
}

/* ===== TOAST ===== */
#toast-container { position: fixed; top: 70px; right: 16px; z-index: 2000; }
.toast-msg {
    background: #333; color: #fff; padding: 10px 20px;
    border-radius: 8px; margin-bottom: 8px;
    font-size: 0.85rem; animation: fadeInOut 3s forwards;
}
@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(-10px); }
    10% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* ===== SECTION HEADER ===== */
.section-header {
    font-size: 1.1rem; font-weight: 700; margin-bottom: 12px;
    display: flex; align-items: center; gap: 8px;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 3000;
    display: flex; align-items: center; justify-content: center;
}
.modal-box {
    background: #fff; border-radius: var(--radius);
    padding: 20px; width: 90%; max-width: 400px;
    max-height: 80vh; overflow-y: auto;
}

/* ===== INLINE EDIT ===== */
.edit-row { border: 2px solid var(--primary); }
.item-row:hover { background: var(--gray-100); border-radius: 4px; }

/* ===== HOME ACTION BUTTONS ===== */
.home-action-btn {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 4px; padding: 14px 8px;
    background: #fff; border: 1px solid var(--gray-200);
    border-radius: var(--radius); text-decoration: none;
    color: var(--primary); font-weight: 600; font-size: 0.78rem;
    transition: all 0.15s; min-height: 70px; position: relative;
}
.home-action-btn i { font-size: 1.4rem; }
.home-action-btn:hover { background: rgba(13,110,253,0.05); border-color: var(--primary); }
.home-action-warn { border-color: var(--warning); }

/* ===== HOME ALERTS ===== */
.home-alert {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; margin-bottom: 8px;
    border-radius: var(--radius); color: inherit;
    transition: background 0.15s;
}
.home-alert:hover { filter: brightness(1.05); }
.home-alert i { font-size: 1.3rem; flex-shrink: 0; }
.home-alert-warning { background: rgba(255,193,7,0.1); border-left: 3px solid var(--warning); }
.home-alert-warning i { color: var(--warning); }
.home-alert-info { background: rgba(13,110,253,0.06); border-left: 3px solid var(--primary); }
.home-alert-info i { color: var(--primary); }
.home-alert-muted { background: var(--gray-100); border-left: 3px solid var(--gray-500); }
.home-alert-muted i { color: var(--gray-500); }

/* ===== MORE MENU (mobile slide-up) ===== */
.more-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 2000;
    display: flex; align-items: flex-end;
}
.more-panel {
    background: #fff; width: 100%;
    border-radius: 16px 16px 0 0;
    padding: 16px; padding-bottom: calc(var(--tab-height) + 16px);
    animation: slideUp 0.2s ease-out;
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
.more-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px; padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}
.more-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 8px; text-decoration: none; color: var(--gray-900);
    font-size: 0.95rem; border-radius: 8px;
    transition: background 0.15s;
}
.more-item:hover, .more-item:active { background: var(--gray-100); }
.more-item i { font-size: 1.2rem; color: var(--primary); width: 24px; text-align: center; }

/* ===== NAVIREO SEARCH ===== */
.nav-result:hover { background: #dbeafe; }

/* ===== RESPONSIVE ===== */
@media (min-width: 768px) {
    body {
        padding-bottom: 0;
        padding-top: calc(var(--navbar-height) + var(--subnav-height));
    }
    .bottom-tabs { display: none; }
    .app-navbar .nav-links-main { display: flex; }
    .app-navbar .nav-links-main a span { display: inline; }
    #app { max-width: 960px; margin: 0 auto; }
}

@media (max-width: 767px) {
    .sub-nav { display: none !important; }
}
