/*
   FOOD & GO - Shared Styles
   Design: "Friendly Kitchen" - Warm, accessible, professional
   Target: Mobile-first, tech-averse users
*/

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@600;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

:root {
    /* Warm, friendly palette */
    --bg: #FAF8F5;
    --bg-warm: #FFF8F2;
    --card: #FFFFFF;

    --text: #2D2D2D;
    --text-soft: #6B6B6B;
    --text-muted: #9B9B9B;

    --orange: #E85A2A;
    --orange-soft: #FFEDE8;
    --green: #2A9D8F;
    --green-soft: #E8F5F3;
    --blue: #4A7FC1;
    --blue-soft: #EBF3FC;
    --red: #D64545;
    --red-soft: #FFEBEB;
    --purple: #7C5CBF;
    --purple-soft: #F3EFFE;

    --border: #EDE9E4;
    --shadow: 0 2px 8px rgba(45, 45, 45, 0.08);
    --shadow-lg: 0 8px 24px rgba(45, 45, 45, 0.12);

    --radius: 20px;
    --radius-sm: 14px;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    line-height: 1.4;
}

/* ═══════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════ */

.app {
    min-height: 100vh;
    max-width: 480px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: 40px;
}

.app--centered {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ═══════════════════════════════════════
   HEADER
   ═══════════════════════════════════════ */

.header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
}

.header__back {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 22px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.15s ease;
}

.header__back:active {
    transform: scale(0.95);
    background: var(--bg);
}

.header__title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.header__icon {
    margin-right: 8px;
}

/* ═══════════════════════════════════════
   BUTTONS - Big, friendly, touchable
   ═══════════════════════════════════════ */

.btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 22px 24px;
    background: var(--card);
    border: 3px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    font-family: inherit;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: var(--shadow);
}

.btn:active {
    transform: scale(0.98);
    box-shadow: none;
}

.btn__icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border-radius: 14px;
    font-size: 26px;
    margin-right: 18px;
    flex-shrink: 0;
}

.btn__content {
    flex: 1;
    text-align: left;
}

.btn__label {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 2px;
}

.btn__sub {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-soft);
}

.btn__arrow {
    font-size: 20px;
    color: var(--text-muted);
    margin-left: 12px;
}

/* Button colors */
.btn--orange { border-color: var(--orange); }
.btn--orange .btn__icon { background: var(--orange-soft); }

.btn--green { border-color: var(--green); }
.btn--green .btn__icon { background: var(--green-soft); }

.btn--blue { border-color: var(--blue); }
.btn--blue .btn__icon { background: var(--blue-soft); }

.btn--purple { border-color: var(--purple); }
.btn--purple .btn__icon { background: var(--purple-soft); }

.btn--red { border-color: var(--red); }
.btn--red .btn__icon { background: var(--red-soft); }

/* Action button (full color) */
.btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 20px;
    background: var(--orange);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-family: inherit;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 4px 12px rgba(232, 90, 42, 0.3);
}

.btn-action:active {
    transform: scale(0.98);
}

.btn-action--green {
    background: var(--green);
    box-shadow: 0 4px 12px rgba(42, 157, 143, 0.3);
}

.btn-action--blue {
    background: var(--blue);
    box-shadow: 0 4px 12px rgba(74, 127, 193, 0.3);
}

/* ═══════════════════════════════════════
   PRODUCT GRID
   ═══════════════════════════════════════ */

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.product {
    background: var(--card);
    border: 3px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: var(--shadow);
}

.product:active {
    transform: scale(0.97);
}

.product--low {
    border-color: var(--orange);
    background: var(--orange-soft);
}

.product--empty {
    border-color: var(--red);
    background: var(--red-soft);
    opacity: 0.7;
}

.product__name {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text);
}

.product__qty {
    font-size: 38px;
    font-weight: 800;
    line-height: 1;
    color: var(--text);
}

.product__unit {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-soft);
    margin-top: 4px;
}

.product__alert {
    display: inline-block;
    margin-top: 10px;
    padding: 4px 10px;
    background: var(--red);
    color: white;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 6px;
}

/* ═══════════════════════════════════════
   MODAL - Bottom sheet style
   ═══════════════════════════════════════ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(45, 45, 45, 0.6);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    z-index: 100;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--card);
    width: 100%;
    max-width: 480px;
    border-radius: 28px 28px 0 0;
    padding: 28px 24px;
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 20px));
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.modal-overlay.show .modal {
    transform: translateY(0);
}

.modal__handle {
    width: 40px;
    height: 5px;
    background: var(--border);
    border-radius: 3px;
    margin: 0 auto 20px;
}

.modal__title {
    font-size: 24px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 6px;
}

.modal__subtitle {
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    color: var(--text-soft);
    margin-bottom: 28px;
}

.modal__qty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 10px;
}

.modal__qty-btn {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border: 3px solid var(--border);
    border-radius: 18px;
    font-size: 36px;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    transition: all 0.1s ease;
}

.modal__qty-btn:active {
    transform: scale(0.93);
    background: var(--border);
}

.modal__qty-btn--minus { color: var(--red); }
.modal__qty-btn--plus { color: var(--green); }

.modal__qty-input {
    width: 110px;
    font-family: inherit;
    font-size: 56px;
    font-weight: 800;
    text-align: center;
    border: none;
    background: transparent;
    color: var(--text);
}

.modal__qty-input:focus {
    outline: none;
}

.modal__unit {
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    color: var(--text-soft);
    margin-bottom: 28px;
}

.modal__buttons {
    display: flex;
    gap: 12px;
}

.modal__btn {
    flex: 1;
    padding: 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.1s ease;
}

.modal__btn:active {
    transform: scale(0.98);
}

.modal__btn--cancel {
    background: var(--bg);
    color: var(--text);
}

.modal__btn--confirm {
    background: var(--green);
    color: white;
}

.modal__btn--orange {
    background: var(--orange);
}

/* ═══════════════════════════════════════
   TOAST
   ═══════════════════════════════════════ */

.toast {
    position: fixed;
    bottom: 32px;
    left: 20px;
    right: 20px;
    max-width: 440px;
    margin: 0 auto;
    padding: 16px 24px;
    background: var(--text);
    color: white;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    transform: translateY(120%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 200;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast--success { background: var(--green); }
.toast--error { background: var(--red); }

/* ═══════════════════════════════════════
   CARDS & LISTS
   ═══════════════════════════════════════ */

.card {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.card__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.list-item {
    display: flex;
    align-items: center;
    padding: 14px 0;
    border-bottom: 2px solid var(--border);
}

.list-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.list-item:first-child {
    padding-top: 0;
}

.list-item__name {
    flex: 1;
    font-size: 16px;
    font-weight: 700;
}

.list-item__value {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
}

.list-item__value--positive { color: var(--green); }
.list-item__value--negative { color: var(--red); }

/* ═══════════════════════════════════════
   SYNC BUTTON
   ═══════════════════════════════════════ */

.sync-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 20px;
    background: var(--blue);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-family: inherit;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 4px 12px rgba(74, 127, 193, 0.3);
}

.sync-btn:active {
    transform: scale(0.98);
}

.sync-btn__icon {
    font-size: 22px;
    transition: transform 0.5s ease;
}

.sync-btn--loading .sync-btn__icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════
   STATUS / INFO
   ═══════════════════════════════════════ */

.status {
    text-align: center;
    padding: 16px;
    background: var(--bg-warm);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.status__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-soft);
}

.status__value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

/* ═══════════════════════════════════════
   ALERTS BANNER
   ═══════════════════════════════════════ */

.alert-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    background: var(--red-soft);
    border: 2px solid var(--red);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.alert-banner--success {
    background: var(--green-soft);
    border-color: var(--green);
}

.alert-banner__icon {
    font-size: 28px;
}

.alert-banner__text {
    flex: 1;
}

.alert-banner__title {
    font-size: 16px;
    font-weight: 800;
}

.alert-banner__sub {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-soft);
}

/* ═══════════════════════════════════════
   SECTION SPACING
   ═══════════════════════════════════════ */

.section {
    margin-bottom: 28px;
}

.section__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 14px;
}

/* ═══════════════════════════════════════
   SUMMARY CARDS
   ═══════════════════════════════════════ */

.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.summary-card {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    text-align: center;
    box-shadow: var(--shadow);
}

.summary-card--highlight {
    border-color: var(--orange);
    background: var(--orange-soft);
}

.summary-card--success {
    border-color: var(--green);
    background: var(--green-soft);
}

.summary-card--danger {
    border-color: var(--red);
    background: var(--red-soft);
}

.summary-card__label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-soft);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.summary-card__value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text);
}

.summary-card__unit {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-soft);
}

/* ═══════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════ */

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

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

/* Staggered animation for lists */
.stagger > *:nth-child(1) { animation-delay: 0.03s; }
.stagger > *:nth-child(2) { animation-delay: 0.06s; }
.stagger > *:nth-child(3) { animation-delay: 0.09s; }
.stagger > *:nth-child(4) { animation-delay: 0.12s; }
.stagger > *:nth-child(5) { animation-delay: 0.15s; }
.stagger > *:nth-child(6) { animation-delay: 0.18s; }

/* ═══════════════════════════════════════
   SETTINGS BUTTONS
   ═══════════════════════════════════════ */

.settings-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 18px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--border);
    text-align: left;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease;
}

.settings-btn:last-child {
    border-bottom: none;
}

.settings-btn:active {
    background: var(--bg);
}

.settings-btn__icon {
    font-size: 24px;
}

.settings-btn__text {
    flex: 1;
}

.settings-btn__title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.settings-btn__sub {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 2px;
}

.settings-btn--danger .settings-btn__title {
    color: var(--red);
}
