/* CloudKitchen — mobile-first premium theme. Green & white, rounded corners,
   glassmorphism, micro-animations. Loaded after Bootstrap 5 so these rules
   layer on top of/override Bootstrap defaults. */

:root {
    --ck-green: #0f9d58;
    --ck-green-dark: #0b7a44;
    --ck-green-light: #e6f6ec;
    --ck-ink: #14231b;
    --ck-muted: #6b7d73;
    --ck-white: #ffffff;
    --ck-radius-lg: 20px;
    --ck-radius-md: 14px;
    --ck-radius-sm: 10px;
    --ck-shadow: 0 8px 24px rgba(15, 157, 88, 0.12);
    --ck-bottom-nav-height: 64px;
}

* { box-sizing: border-box; }

body.ck-body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(180deg, #f3fbf6 0%, #ffffff 220px);
    color: var(--ck-ink);
    -webkit-font-smoothing: antialiased;
    padding-bottom: env(safe-area-inset-bottom);
}

body.has-bottom-nav { padding-bottom: calc(var(--ck-bottom-nav-height) + 12px); }

/* Extra clearance so page content doesn't render underneath the sticky
   checkout-style bar (see .ck-sticky-bar) — added via JS since only some
   pages have one. Stacks on top of the bottom-nav clearance above when
   both are present. */
body.has-sticky-bar .ck-main { padding-bottom: 84px; }

a { text-decoration: none; color: inherit; }

.ck-logo-dot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--ck-green);
    margin-right: 6px;
    box-shadow: 0 0 0 4px var(--ck-green-light);
}

/* ---------- Sticky glass header ---------- */
.ck-header {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(15, 157, 88, 0.08);
}
.ck-header-brand { font-weight: 700; font-size: 1.05rem; color: var(--ck-green-dark); }
.ck-header-actions { display: flex; align-items: center; gap: 16px; }
.ck-header-link { font-weight: 600; color: var(--ck-ink); font-size: 0.92rem; }
.ck-header-cart { position: relative; font-size: 1.2rem; }
.ck-cart-badge {
    position: absolute; top: -6px; right: -10px;
    background: var(--ck-green); color: #fff;
    font-size: 0.65rem; font-weight: 700;
    min-width: 18px; height: 18px; border-radius: 999px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
}

.ck-main { max-width: 720px; margin: 0 auto; padding: 16px; }

/* ---------- Glass cards ---------- */
.glass-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    border-radius: var(--ck-radius-lg);
    box-shadow: var(--ck-shadow);
    border: 1px solid rgba(15, 157, 88, 0.08);
}
.ck-card {
    background: var(--ck-white);
    border-radius: var(--ck-radius-md);
    box-shadow: 0 2px 10px rgba(20, 35, 27, 0.06);
    border: 1px solid #eef4f0;
    padding: 16px;
    margin-bottom: 14px;
    transition: transform .15s ease, box-shadow .15s ease;
}
.ck-card:active { transform: scale(0.99); }
.ck-card-selectable { cursor: pointer; }
.ck-card-selectable.selected {
    border-color: var(--ck-green);
    box-shadow: 0 0 0 2px var(--ck-green-light), 0 6px 18px rgba(15,157,88,.15);
}

/* ---------- Buttons ---------- */
.btn-ck-primary {
    background: linear-gradient(135deg, var(--ck-green) 0%, var(--ck-green-dark) 100%);
    color: #fff; border: none; border-radius: 999px;
    padding: 12px 22px; font-weight: 700;
    box-shadow: 0 6px 16px rgba(15,157,88,.30);
    transition: transform .12s ease, box-shadow .12s ease;
}
.btn-ck-primary:hover, .btn-ck-primary:focus { color: #fff; transform: translateY(-1px); }
.btn-ck-primary:active { transform: scale(0.97); box-shadow: 0 3px 8px rgba(15,157,88,.25); }
.btn-ck-primary:disabled { opacity: .55; box-shadow: none; }

.btn-ck-outline {
    background: #fff; color: var(--ck-green-dark);
    border: 1.5px solid var(--ck-green); border-radius: 999px;
    padding: 10px 20px; font-weight: 600;
}

/* ---------- Forms ---------- */
.ck-form-control {
    border-radius: var(--ck-radius-sm);
    border: 1.5px solid #dfe9e3;
    padding: 12px 14px;
    width: 100%;
    font-size: 0.95rem;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.ck-form-control:focus {
    outline: none;
    border-color: var(--ck-green);
    box-shadow: 0 0 0 3px var(--ck-green-light);
}
.ck-form-label { font-weight: 600; font-size: 0.85rem; margin-bottom: 6px; display: block; color: var(--ck-ink); }
.ck-field-error { color: #d64545; font-size: 0.8rem; margin-top: 4px; }

/* ---------- Auth pages ---------- */
.ck-auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px 16px; }
.ck-auth-wrap { width: 100%; max-width: 420px; }
.ck-auth-brand { text-align: center; font-weight: 800; font-size: 1.3rem; color: var(--ck-green-dark); margin-bottom: 18px; }
.ck-auth-card { padding: 28px 24px; }

/* ---------- Bottom nav ---------- */
.ck-bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    display: flex; justify-content: space-around; align-items: stretch;
    height: var(--ck-bottom-nav-height);
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(15,157,88,0.10);
    padding-bottom: env(safe-area-inset-bottom);
}
.ck-nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-size: 0.65rem; font-weight: 600; color: var(--ck-muted); gap: 2px;
}
.ck-nav-icon { font-size: 1.15rem; }
.ck-nav-item-cta .ck-nav-icon {
    background: var(--ck-green); color: #fff; border-radius: 50%;
    width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
    margin-top: -14px; box-shadow: 0 6px 14px rgba(15,157,88,.35);
}

/* ---------- Floating cart ---------- */
.ck-floating-cart {
    position: fixed; right: 16px; bottom: calc(var(--ck-bottom-nav-height) + 16px); z-index: 45;
    display: flex; align-items: center; gap: 8px;
    background: var(--ck-ink); color: #fff;
    padding: 12px 18px; border-radius: 999px;
    box-shadow: 0 10px 24px rgba(0,0,0,.25);
    animation: ck-pop-in .2s ease;
}
.ck-floating-cart-count {
    background: var(--ck-green); border-radius: 50%;
    width: 20px; height: 20px; font-size: 0.7rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.ck-floating-cart-total { font-weight: 700; font-size: 0.9rem; }

/* ---------- Sticky checkout bar ---------- */
.ck-sticky-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 46;
    background: #fff; border-top: 1px solid #eef4f0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 20px rgba(0,0,0,0.06);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
/* On authenticated pages the bottom nav is also fixed at bottom:0 with a
   higher z-index — without this, it draws over the sticky bar and hides
   whatever action button is in it (e.g. "Add to Cart" on /build-meal). */
body.has-bottom-nav .ck-sticky-bar {
    bottom: var(--ck-bottom-nav-height);
    padding-bottom: 12px;
}

/* ---------- Toasts ---------- */
.ck-toast {
    position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
    z-index: 100; padding: 12px 20px; border-radius: 999px;
    font-weight: 600; font-size: 0.85rem; color: #fff;
    box-shadow: 0 8px 20px rgba(0,0,0,.18);
    animation: ck-slide-down .25s ease;
}
.ck-toast-success { background: var(--ck-green); }
.ck-toast-error { background: #d64545; }
.ck-toast-inline { position: static; transform: none; display: block; text-align: center; margin-bottom: 14px; animation: none; }

/* ---------- Skeleton loading ---------- */
.ck-skeleton-card { padding: 16px; }
.ck-skeleton-block {
    background: linear-gradient(90deg, #eef4f0 25%, #e2ece5 37%, #eef4f0 63%);
    background-size: 400% 100%;
    animation: ck-shimmer 1.4s ease infinite;
    border-radius: 10px; margin-bottom: 8px;
}
.ck-skeleton-img { height: 90px; }
.ck-skeleton-line { height: 14px; }
.w-75 { width: 75%; } .w-50 { width: 50%; }

/* ---------- Animations ---------- */
@keyframes ck-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@keyframes ck-slide-down { from { opacity: 0; transform: translate(-50%, -12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes ck-pop-in { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }
@keyframes ck-fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.ck-fade-in { animation: ck-fade-in .25s ease; }

/* ---------- Misc ---------- */
.ck-badge-closed {
    display: inline-block; background: #fdeeee; color: #d64545;
    font-size: 0.72rem; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}
.ck-badge-open {
    display: inline-block; background: var(--ck-green-light); color: var(--ck-green-dark);
    font-size: 0.72rem; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}

@media (min-width: 768px) {
    .ck-main { max-width: 960px; padding: 24px; }
}
