/* ================================================================
   Chef Bakers Order Tracker – Frontend Styles
   ================================================================ */

:root {
    --cbot-primary:  #7b3f00;
    --cbot-accent:   #f0a500;
    --cbot-done:     #4caf50;
    --cbot-bg:       #fff8f2;
    --cbot-card-bg:  #ffffff;
    --cbot-border:   #f0dfd0;
    --cbot-text:     #3d1c00;
    --cbot-muted:    #a07850;
    --cbot-grey:     #c8c8c8;
    --cbot-grey-bg:  #f4f4f4;
    --cbot-radius:   18px;
    --cbot-shadow:   0 8px 40px rgba(123,63,0,0.10);
}

/* ── Wrapper ─────────────────────────────────────────────────── */
#cbot-tracker-wrap {
    max-width: 800px;
    margin: 40px auto;
    font-family: 'Segoe UI', sans-serif;
    color: var(--cbot-text);
}

/* ── Card ────────────────────────────────────────────────────── */
.cbot-card {
    background: var(--cbot-card-bg);
    border-radius: var(--cbot-radius);
    box-shadow: var(--cbot-shadow);
    padding: 48px 40px 40px;
    border: 1px solid var(--cbot-border);
    text-align: center;
}

/* ── Logo / Branding ─────────────────────────────────────────── */
.cbot-logo-wrap   { margin-bottom: 20px; }
.cbot-brand       { font-family: 'Georgia', serif; font-size: 2rem; color: var(--cbot-primary); margin: 4px 0 0; }
.cbot-tagline     { color: var(--cbot-muted); font-size: .9rem; margin: 0; }

/* ── Form ────────────────────────────────────────────────────── */
.cbot-form-title { font-size: 1.4rem; margin: 0 0 6px; }
.cbot-form-sub   { color: var(--cbot-muted); margin: 0 0 28px; font-size: .95rem; }

.cbot-field { margin-bottom: 16px; text-align: left; }
.cbot-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: .9rem;
    color: var(--cbot-primary);
}
.cbot-field input {
    width: 100%;
    padding: 13px 16px;
    border: 2px solid var(--cbot-border);
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
    transition: border-color .2s;
    box-sizing: border-box;
}
.cbot-field input:focus { border-color: var(--cbot-accent); }

/* ── Buttons ─────────────────────────────────────────────────── */
.cbot-btn {
    display: inline-block;
    width: 100%;
    padding: 15px;
    background: var(--cbot-primary);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    letter-spacing: .5px;
    transition: background .2s, transform .1s;
}
.cbot-btn:hover  { background: #5a2e00; }
.cbot-btn:active { transform: scale(.98); }

.cbot-btn-outline {
    background: transparent;
    border: 2px solid var(--cbot-primary);
    color: var(--cbot-primary);
    padding: 10px 28px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    font-size: .95rem;
    transition: all .2s;
}
.cbot-btn-outline:hover { background: var(--cbot-primary); color: #fff; }

/* ── Loading / Error ─────────────────────────────────────────── */
.cbot-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px 0;
    color: var(--cbot-muted);
}
.cbot-spinner {
    display: inline-block;
    width: 22px; height: 22px;
    border: 3px solid var(--cbot-border);
    border-top-color: var(--cbot-primary);
    border-radius: 50%;
    animation: cbot-spin .7s linear infinite;
}
@keyframes cbot-spin { to { transform: rotate(360deg); } }

.cbot-error {
    background: #fff0f0;
    border: 1px solid #f5c6cb;
    color: #c0392b;
    padding: 12px 18px;
    border-radius: 10px;
    margin-top: 16px;
    font-size: .95rem;
}

/* ── Results Panel ────────────────────────────────────────────── */
#cbot-results {
    background: var(--cbot-card-bg);
    border-radius: var(--cbot-radius);
    box-shadow: var(--cbot-shadow);
    border: 1px solid var(--cbot-border);
    overflow: hidden;
}

/* Tabs header */
.cbot-tabs-header {
    background: var(--cbot-bg);
    border-bottom: 1px solid var(--cbot-border);
    padding: 20px 30px 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.cbot-logo-wrap-sm { line-height: 1.3; }
.cbot-brand-sm {
    font-family: 'Georgia', serif;
    font-size: 1.2rem;
    color: var(--cbot-primary);
    font-weight: bold;
}
.cbot-logo-wrap-sm small { display: block; color: var(--cbot-muted); font-size: .78rem; }

.cbot-tabs { display: flex; gap: 4px; }
.cbot-tab {
    background: none;
    border: none;
    padding: 10px 22px;
    cursor: pointer;
    font-size: .95rem;
    font-weight: 600;
    color: var(--cbot-muted);
    border-bottom: 3px solid transparent;
    transition: all .2s;
    border-radius: 8px 8px 0 0;
}
.cbot-tab:hover  { color: var(--cbot-primary); }
.cbot-tab.active {
    color: var(--cbot-primary);
    background: var(--cbot-card-bg);
    border-bottom-color: var(--cbot-primary);
}

.cbot-tab-content { display: none; padding: 30px; }
.cbot-tab-content.active { display: block; }

/* ── Order Summary ────────────────────────────────────────────── */
.cbot-order-summary { max-width: 520px; }
.cbot-summary-row {
    display: flex;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--cbot-border);
    font-size: .95rem;
}
.cbot-summary-row:last-child { border-bottom: none; }
.cbot-summary-row > span { min-width: 120px; color: var(--cbot-muted); }
.cbot-badge {
    display: inline-block;
    background: var(--cbot-accent);
    color: #fff;
    padding: 3px 14px;
    border-radius: 20px;
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
}

/* ══════════════════════════════════════════════════════════════
   STEPPER
   ══════════════════════════════════════════════════════════════ */
.cbot-stepper-wrap {
    padding: 36px 10px 28px;
    overflow-x: auto;
    background: var(--cbot-bg);
    border-radius: 14px;
    margin-bottom: 28px;
}
.cbot-stepper {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-width: 460px;
}

/* ── Each step ────────────────────────────────────────────────── */
.cbot-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

/* Connector line – drawn to the LEFT of each step except the first */
.cbot-step::before {
    content: '';
    position: absolute;
    top: 26px;           /* vertically centred on 54px circle */
    left: 0;
    right: 50%;
    left: calc(-50% + 0px);
    width: 100%;
    height: 3px;
    z-index: 0;
    transition: background .35s;
}
.cbot-step:first-child::before { display: none; }

/* ── DONE  – fully coloured ──────────────────────────────────── */
.cbot-step.done::before { background: var(--cbot-done); }

.cbot-step.done .cbot-step-circle {
    border-color: var(--cbot-done);
    background: var(--cbot-done);
    color: #fff;
    opacity: 1;
}
.cbot-step.done .cbot-step-label { color: var(--cbot-text); opacity: 1; }

/* ── CURRENT – pulsing ring ──────────────────────────────────── */
.cbot-step.current::before { background: var(--cbot-done); }

.cbot-step.current .cbot-step-circle {
    /* inline style sets border/shadow colour; background white */
    background: #fff;
    opacity: 1;
    animation: cbot-pulse 1.6s ease-in-out infinite;
}
.cbot-step.current .cbot-step-label { color: var(--cbot-text); font-weight: 700; opacity: 1; }

@keyframes cbot-pulse {
    0%, 100% { transform: scale(1);    }
    50%       { transform: scale(1.07); }
}

/* ── PENDING – greyed out ────────────────────────────────────── */
.cbot-step.pending::before { background: #ddd; }

.cbot-step.pending .cbot-step-circle {
    border-color: #d0d0d0 !important;
    background: #f0f0f0 !important;
    color: #bbb !important;
    box-shadow: none !important;
    opacity: .7;
}
.cbot-step.pending .cbot-step-label {
    color: #bbb;
    opacity: .7;
}
.cbot-step.pending .cbot-step-icon { filter: grayscale(1); opacity: .5; }

/* ── Circle base ─────────────────────────────────────────────── */
.cbot-step-circle {
    width: 54px; height: 54px;
    border-radius: 50%;
    border: 3px solid #d0d0d0;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    position: relative;
    z-index: 1;
    transition: all .3s;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.cbot-tick { font-size: 1.3rem; font-weight: 700; line-height: 1; }

.cbot-step-label {
    margin-top: 12px;
    font-size: .75rem;
    font-weight: 600;
    text-align: center;
    color: #bbb;
    max-width: 90px;
    line-height: 1.3;
    transition: color .3s;
}

/* ══════════════════════════════════════════════════════════════
   TIMELINE
   ══════════════════════════════════════════════════════════════ */
.cbot-timeline-sections { padding: 0; }

/* ── Section wrapper ─────────────────────────────────────────── */
.cbot-tl-section {
    margin-bottom: 20px;
    padding: 14px 16px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--cbot-border);
    transition: opacity .3s;
}

/* Pending sections – visually faded */
.cbot-tl-pending-section {
    background: var(--cbot-grey-bg);
    border-color: #e8e8e8;
    opacity: .65;
}

/* Section title */
.cbot-tl-section-title {
    font-weight: 800;
    font-size: .88rem;
    padding: 0 0 8px 12px;
    border-left: 4px solid #ccc;
    margin-bottom: 8px;
    letter-spacing: .5px;
    transition: color .3s, border-left-color .3s;
}

/* ── Timeline row ────────────────────────────────────────────── */
.cbot-tl-item {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--cbot-border);
    align-items: flex-start;
}
.cbot-tl-item:last-child { border-bottom: none; }

/* Dim variant */
.cbot-tl-item--dim { opacity: .5; }

/* Dot */
.cbot-tl-dot {
    width: 11px; height: 11px;
    border-radius: 50%;
    background: #ccc;
    margin-top: 5px;
    flex-shrink: 0;
    transition: background .3s;
}

/* Body */
.cbot-tl-body  { flex: 1; }
.cbot-tl-msg   { font-size: .92rem; color: var(--cbot-text); }
.cbot-tl-msg--dim { color: #b0b0b0 !important; }
.cbot-tl-date  { font-size: .76rem; color: var(--cbot-muted); margin-top: 2px; }
.cbot-tl-status { font-size: .76rem; color: var(--cbot-muted); text-align: right; flex-shrink: 0; }

/* ── Delivered banner ─────────────────────────────────────────── */
.cbot-delivered-banner {
    background: linear-gradient(135deg, #e8f8e8, #f0fff0);
    border: 1.5px solid #b2dfb2;
    border-radius: 14px;
    padding: 22px 28px;
    text-align: center;
    margin: 16px 0;
}
.cbot-check-big { font-size: 2.5rem; display: block; }
.cbot-delivered-banner p { margin: 8px 0 0; font-weight: 700; font-size: 1.05rem; color: #2e7d2e; }

/* ── Track again ──────────────────────────────────────────────── */
.cbot-track-again { text-align: center; padding: 16px 0 28px; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 580px) {
    .cbot-card         { padding: 32px 18px; }
    .cbot-tab-content  { padding: 18px 14px; }
    .cbot-tabs-header  { padding: 14px 14px 0; }
    .cbot-step-circle  { width: 44px; height: 44px; font-size: 1.1rem; }
    .cbot-step::before { top: 21px; }
    .cbot-step-label   { font-size: .68rem; max-width: 66px; }
    .cbot-summary-row > span { min-width: 90px; }
}

/* ══════════════════════════════════════════════════════════════
   ITEM CARDS
   ══════════════════════════════════════════════════════════════ */
.cbot-items-section { margin: 24px 0 0; }
.cbot-section-heading {
    font-size: .92rem;
    font-weight: 800;
    letter-spacing: .5px;
    color: var(--cbot-primary);
    margin: 0 0 12px;
    text-transform: uppercase;
}

.cbot-item-card {
    display: flex;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--cbot-border);
    border-radius: 12px;
    margin-bottom: 12px;
    background: var(--cbot-bg);
    transition: box-shadow .2s;
}
.cbot-item-card:last-child { margin-bottom: 0; }
.cbot-item-card:hover { box-shadow: 0 4px 18px rgba(123,63,0,.08); }

/* Thumbnail */
.cbot-item-img {
    width: 70px; height: 70px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid var(--cbot-border);
}
.cbot-item-img img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}

/* Body */
.cbot-item-body { flex: 1; min-width: 0; }

.cbot-item-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 2px;
}
.cbot-item-name {
    font-weight: 700;
    font-size: .95rem;
    color: var(--cbot-text);
    line-height: 1.3;
}
.cbot-item-price {
    font-weight: 700;
    font-size: .95rem;
    color: var(--cbot-primary);
    white-space: nowrap;
}
.cbot-item-qty {
    font-size: .78rem;
    color: var(--cbot-muted);
    margin-bottom: 8px;
}

/* Meta chips row */
.cbot-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}
.cbot-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 11px;
    border-radius: 20px;
    font-size: .76rem;
    line-height: 1.4;
    font-weight: 500;
    border: 1px solid transparent;
}
.cbot-meta-label { font-weight: 700; }

/* Chip colour themes */
.chip-egg      { background: #fff3e0; border-color: #ffcc80; color: #7b4e00; }
.chip-weight   { background: #e8f5e9; border-color: #a5d6a7; color: #1b5e20; }
.chip-flavour  { background: #fce4ec; border-color: #f48fb1; color: #880e4f; }
.chip-color    { background: #e3f2fd; border-color: #90caf9; color: #0d47a1; }
.chip-message  { background: #f3e5f5; border-color: #ce93d8; color: #4a148c; }
.chip-tier     { background: #e0f7fa; border-color: #80deea; color: #006064; }
.chip-default  { background: #f5f5f5; border-color: #ddd;    color: #444;    }

/* ── Price breakdown ──────────────────────────────────────────── */
.cbot-price-breakdown {
    margin-top: 20px;
    border-top: 2px solid var(--cbot-border);
    padding-top: 14px;
}
.cbot-price-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: .92rem;
    color: var(--cbot-muted);
}
.cbot-price-discount { color: #c0392b; }
.cbot-price-total {
    border-top: 1px solid var(--cbot-border);
    margin-top: 6px;
    padding-top: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--cbot-text);
}

.cbot-no-items { color: var(--cbot-muted); font-size: .9rem; padding: 10px 0; }

@media (max-width: 480px) {
    .cbot-item-img { width: 54px; height: 54px; }
    .cbot-item-name { font-size: .87rem; }
}
