/* Kitchen-Hub theme on top of Bootstrap 5 - clean with a playful, warm touch */

:root {
    --app-tomato: #e4572e;
    --app-tomato-dark: #c7461f;
    --app-tomato-rgb: 228, 87, 46;
    --app-herb: #2a9d8f;
    --app-saffron: #f4a259;
    --app-cream: #f8f1e8;
    --app-radius: 1rem;

    --bs-primary: var(--app-tomato);
    --bs-primary-rgb: var(--app-tomato-rgb);
    --bs-link-color: var(--app-tomato-dark);
    --bs-link-color-rgb: 199, 70, 31;
    --bs-link-hover-color: #9f3718;
    /* Components (cards, list groups, inputs) stay white and stand out from the cream page */
    --bs-body-bg: #fff;
    --bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
}

body {
    background-color: var(--app-cream);
}

.btn-primary {
    --bs-btn-bg: var(--app-tomato);
    --bs-btn-border-color: var(--app-tomato);
    --bs-btn-hover-bg: var(--app-tomato-dark);
    --bs-btn-hover-border-color: var(--app-tomato-dark);
    --bs-btn-active-bg: var(--app-tomato-dark);
    --bs-btn-active-border-color: var(--app-tomato-dark);
    --bs-btn-disabled-bg: var(--app-tomato);
    --bs-btn-disabled-border-color: var(--app-tomato);
    --bs-btn-focus-shadow-rgb: var(--app-tomato-rgb);
}

.btn-outline-primary {
    --bs-btn-color: var(--app-tomato-dark);
    --bs-btn-border-color: var(--app-tomato);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--app-tomato);
    --bs-btn-hover-border-color: var(--app-tomato);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--app-tomato-dark);
    --bs-btn-active-border-color: var(--app-tomato-dark);
    --bs-btn-disabled-color: var(--app-tomato);
    --bs-btn-disabled-border-color: var(--app-tomato);
    --bs-btn-focus-shadow-rgb: var(--app-tomato-rgb);
}

.btn {
    border-radius: 999px;
    padding-inline: 1.25rem;
}

.nav-pills {
    --bs-nav-pills-link-active-bg: var(--app-tomato);
    --bs-nav-pills-border-radius: 999px;
}

/* Header */
.app-header {
    box-shadow: 0 1px 0 rgba(0, 0, 0, .06), 0 4px 16px rgba(0, 0, 0, .04);
}

.app-brand-icon {
    display: inline-grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: .75rem;
    background: var(--app-tomato);
    color: #fff;
    font-size: 1.2rem;
    transform: rotate(-6deg);
    transition: transform .2s ease;
}

.navbar-brand:hover .app-brand-icon {
    transform: rotate(6deg) scale(1.05);
}

/* Touch-friendly navigation on small screens */
@media (max-width: 991.98px) {
    .navbar-nav .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* Hero */
.app-hero {
    background:
        radial-gradient(circle at 90% 10%, rgba(244, 162, 89, .35), transparent 45%),
        radial-gradient(circle at 0% 100%, rgba(42, 157, 143, .18), transparent 50%),
        #fff;
    border: 1px solid rgba(0, 0, 0, .05);
}

/* Cards */
.card {
    --bs-card-border-color: rgba(60, 35, 20, .08);
    --bs-card-border-radius: var(--app-radius);
    --bs-card-inner-border-radius: calc(var(--app-radius) - 1px);
    box-shadow: 0 1px 2px rgba(60, 35, 20, .05), 0 6px 18px rgba(60, 35, 20, .06);
}

/* Bootstrap's light badge is almost invisible on white cards */
.badge.text-bg-light {
    background-color: rgba(60, 35, 20, .08) !important;
}

.app-feature-card {
    transition: transform .2s ease, box-shadow .2s ease;
}

.app-feature-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .08);
}

.app-feature-icon {
    display: inline-grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border-radius: .9rem;
    font-size: 1.5rem;
}

.app-feature-icon-recipes {
    background: rgba(var(--app-tomato-rgb), .12);
    color: var(--app-tomato);
}

.app-feature-icon-meal-plan {
    background: rgba(42, 157, 143, .12);
    color: var(--app-herb);
}

.app-feature-icon-shopping {
    background: rgba(244, 162, 89, .18);
    color: #c46f1f;
}

/* Error pages */
.app-error {
    max-width: 32rem;
}

.app-error-status {
    font-size: clamp(4rem, 18vw, 7rem);
    font-weight: 800;
    line-height: 1;
    color: var(--app-tomato);
    opacity: .85;
    margin-bottom: .5rem;
}

/* Account status badges */
.app-status-active {
    background: rgba(42, 157, 143, .15);
    color: #1d6f65;
}

.app-status-disabled {
    background: rgba(0, 0, 0, .08);
    color: #555;
}

.app-status-invited {
    background: rgba(244, 162, 89, .22);
    color: #9a5412;
}

.app-status-invitation_expired {
    background: rgba(var(--app-tomato-rgb), .12);
    color: var(--app-tomato-dark);
}

/* Recipes */
.app-recipe-image {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.app-recipe-placeholder {
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 3;
    font-size: 3rem;
    color: var(--app-tomato);
    background: linear-gradient(135deg, rgba(244, 162, 89, .28), rgba(var(--app-tomato-rgb), .12));
}

.app-recipe-card {
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}

.app-recipe-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .08);
}

.app-photo-thumb img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    transition: transform .2s ease;
}

.app-photo-thumb:hover img,
.app-photo-thumb:focus-visible img {
    transform: scale(1.05);
}

/* Whole photo in the viewer, never taller than the screen */
.app-photo-full {
    display: block;
    width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.app-stars {
    color: var(--app-saffron);
}

.app-favorite {
    color: var(--app-tomato);
}

.app-rating-buttons .btn {
    min-width: 44px;
    min-height: 44px;
    font-size: 1.1rem;
}

.app-preserve-lines {
    white-space: pre-line;
}

.app-ingredient-list li + li {
    border-top: 1px solid rgba(0, 0, 0, .06);
}

.app-ingredient-amount {
    min-width: 6.5rem;
}

.app-step-number {
    display: inline-grid;
    place-items: center;
    flex: 0 0 2rem;
    height: 2rem;
    border-radius: 50%;
    background: rgba(var(--app-tomato-rgb), .12);
    color: var(--app-tomato-dark);
    font-weight: 700;
}

/* Dynamic form rows (recipe ingredients and steps) */
.app-form-row {
    padding: .75rem;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: .75rem;
    background: #fff;
}

.app-touch-height {
    min-height: 38px;
}

/* Searchable select (app.js: select[data-app-combobox]) */
.app-combobox {
    position: relative;
}

.app-combobox-menu {
    width: 100%;
    max-height: 16rem;
    overflow-y: auto;
}

.app-combobox-menu .dropdown-item {
    white-space: normal;
}

/* Meal plan */
.app-day {
    border-radius: var(--app-radius);
}

.app-day-today {
    border-color: rgba(var(--app-tomato-rgb), .55);
    box-shadow: 0 0 0 .2rem rgba(var(--app-tomato-rgb), .12);
}

.app-slot {
    height: 100%;
    padding: .5rem;
    border-radius: .75rem;
    background: rgba(0, 0, 0, .025);
}

.app-slot-entries {
    display: flex;
    flex-direction: column;
    gap: .375rem;
    min-height: 2.75rem;
    margin: 0 0 .375rem;
    padding: 0;
    list-style: none;
    border: 2px dashed transparent;
    border-radius: .5rem;
}

/* :empty would not match: the rendered list contains whitespace */
.app-editable .app-slot-entries:not(:has(> li)) {
    border-color: rgba(0, 0, 0, .08);
}

/* Phones plan with the add buttons (no sidebar): empty meals only take the height of their button */
@media (max-width: 767.98px) {
    .app-slot-entries:not(:has(> li)),
    .app-editable .app-slot-entries:not(:has(> li)) {
        min-height: 0;
        margin-bottom: 0;
        border: 0;
    }
}

.app-entry,
.app-variant-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .375rem .5rem;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: .5rem;
    background: #fff;
}

.app-editable .app-entry,
.app-variant-item {
    cursor: grab;
}

.app-entry-free-text {
    background: rgba(42, 157, 143, .08);
}

.app-entry-thumb {
    flex: 0 0 2rem;
    width: 2rem;
    height: 2rem;
    border-radius: .375rem;
    object-fit: cover;
}

.app-entry-actions .btn {
    min-width: 36px;
    min-height: 36px;
}

.sortable-ghost {
    opacity: .45;
}

.app-planner-sidebar {
    position: sticky;
    top: calc(5rem + env(safe-area-inset-top));
    max-height: calc(100vh - 6rem - env(safe-area-inset-top));
    overflow-y: auto;
}

.app-busy {
    pointer-events: none;
    opacity: .7;
}

/* Shopping list (mobile first: large touch targets, quantities first) */
.app-shopping-group + .app-shopping-group {
    margin-top: 1.25rem;
}

.app-shopping-group-title {
    position: sticky;
    top: calc(4.25rem + env(safe-area-inset-top));
    z-index: 2;
    margin: 0 0 .5rem;
    padding: .375rem .75rem;
    border-radius: .5rem;
    background: rgba(var(--app-tomato-rgb), .08);
    color: var(--app-tomato-dark);
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.app-shopping-item {
    display: flex;
    align-items: stretch;
    gap: .25rem;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: .75rem;
    background: #fff;
}

.app-shopping-item + .app-shopping-item {
    margin-top: .5rem;
}

.app-check-form {
    flex: 1 1 auto;
    min-width: 0;
}

.app-check-button {
    display: flex;
    align-items: center;
    gap: .75rem;
    width: 100%;
    min-height: 56px;
    padding: .5rem .75rem;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
}

.app-check-button:disabled {
    cursor: default;
}

.app-check-icon {
    flex: 0 0 auto;
    font-size: 1.9rem;
    line-height: 1;
    color: var(--app-herb);
}

.app-item-quantity {
    flex: 0 0 auto;
    min-width: 4.5rem;
    font-weight: 700;
}

.app-item-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 1.05rem;
    overflow-wrap: anywhere;
}

.app-item-checked {
    background: rgba(0, 0, 0, .03);
}

.app-item-checked .app-item-name,
.app-item-checked .app-item-quantity {
    text-decoration: line-through;
    color: var(--bs-secondary-color);
}

.app-item-actions {
    display: flex;
    align-items: center;
}

.app-item-actions .btn {
    min-width: 44px;
    min-height: 44px;
}

.app-quick-add {
    position: sticky;
    bottom: 0;
    z-index: 3;
    padding: .75rem 0 calc(.75rem + env(safe-area-inset-bottom));
    background: var(--app-cream);
}

/* Freshly created invitation link */
.app-invitation-card {
    border-color: rgba(244, 162, 89, .6);
    background: #fff8ef;
}

/* Footer */
.app-footer {
    border-top: 1px solid rgba(0, 0, 0, .06);
    background: #fff;
}

/* Offline mode (service worker): banner and read-only pages */
.app-offline-banner {
    background: #34495e;
    color: #fff;
    font-size: .9rem;
}

html.app-offline [data-app-online-only] {
    display: none !important;
}

html.app-offline .app-check-button:disabled {
    opacity: 1;
}

.app-offline-lists {
    max-width: 32rem;
}

/* Touch devices: at least 44px touch targets and no zoom on focus (iOS zooms into inputs below 16px) */
a,
button,
summary,
label,
.btn,
.form-select,
.form-check-input {
    touch-action: manipulation;
}

@media (pointer: coarse) {
    .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
    }

    .btn-sm,
    .app-entry-actions .btn {
        min-width: 44px;
    }

    .navbar-toggler {
        min-width: 48px;
        min-height: 44px;
    }

    .dropdown-item {
        padding-block: .625rem;
    }

    .page-link {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
    }

    .form-check-input {
        width: 1.35em;
        height: 1.35em;
    }

    .form-control,
    .form-select {
        font-size: max(1rem, 16px);
    }

    .btn-close {
        padding: .75rem;
    }
}

/* Devices with display cutouts and the installed app (viewport-fit=cover) */
body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.app-header {
    padding-top: env(safe-area-inset-top);
    background: #fff;
}

.app-footer {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom)) !important;
}

.toast-container {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom)) !important;
}
