/* ================================================
   JANANI CAKE PALACE — SWIGGY-STYLE CART PAGE
   NOTE: cake-home.css sets html{font-size:10px}
   ALL font sizes use px to avoid tiny text.
   ================================================ */

:root {
    --orange:        #FC8019;
    --orange-dark:   #E3731A;
    --orange-light:  #FFF3E8;
    --green:         #60B246;
    --green-light:   #EAF7E2;
    --red:           #E23744;
    --dark:          #1C1C1C;
    --text:          #3D4152;
    --sub:           #686B78;
    --border:        #E9E9EB;
    --bg:            #F2F2F2;
    --white:         #FFFFFF;
    --shadow-sm:     0 1px 4px rgba(0,0,0,0.08);
    --radius:        16px;
    --radius-sm:     10px;
    --font:          'Nunito', sans-serif;
}

.cart-page {
    padding-top: 80px;
    min-height: 100vh;
    padding-bottom: 60px;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
}

.cart-wrap {
    max-width: 90%;
    margin: 32px auto;
    padding: 0 16px;
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 24px;
    align-items: start;
}

/* === RESTAURANT BAR === */
.restaurant-bar {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}
.rest-info { display: flex; align-items: center; gap: 12px; }
.rest-icon {
    width: 46px; height: 46px;
    background: var(--orange-light);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    color: var(--orange);
    flex-shrink: 0;
}
.rest-name { font-size: 15px; font-weight: 800; color: var(--dark); display: block; }
.rest-loc  { font-size: 12px; color: var(--sub); display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.rest-loc i { color: var(--orange); font-size: 11px; }
.add-more-link {
    font-size: 13px; font-weight: 800; color: var(--orange);
    border: 1.5px solid var(--orange); padding: 7px 14px;
    border-radius: 8px; white-space: nowrap; transition: background 0.15s;
    display: flex; align-items: center; gap: 6px; font-family: var(--font);
}
.add-more-link:hover { background: var(--orange-light); }

/* === ITEMS CARD === */
.items-card {
    background: var(--white); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 12px;
}

/* === CART ITEM === */
.cart-item {
    display: flex !important;
    align-items: flex-start !important;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s, opacity 0.3s, transform 0.3s;
    position: relative;
    grid-template-columns: unset !important;
}
.cart-item:last-child { border-bottom: none; }
.cart-item:hover { background: #FAFAFA; }
.cart-item.loading { opacity: 0.55; }
.cart-item.removing { opacity: 0; transform: translateX(-30px); }
.cart-item.loading::after {
    content: ''; position: absolute; top: 50%; left: 50%;
    width: 20px; height: 20px; margin: -10px 0 0 -10px;
    border: 2px solid rgba(0,0,0,0.1); border-top-color: var(--orange);
    border-radius: 50%; animation: spin 0.7s linear infinite;
}

/* veg dot */
.food-dot {
    width: 14px; height: 14px; border-radius: 3px;
    border: 1.5px solid var(--green); flex-shrink: 0;
    margin-top: 4px; position: relative; display: block;
}
.food-dot::after {
    content: ''; position: absolute; inset: 3px;
    border-radius: 50%; background: var(--green);
}
.food-dot.non-veg { border-color: var(--red); }
.food-dot.non-veg::after { background: var(--red); }

/* item text */
.ci-details { flex: 1; min-width: 0; }
.ci-name {
    font-size: 15px; font-weight: 800; color: var(--dark);
    margin-bottom: 4px; line-height: 1.3; display: block; white-space: normal;
}
.ci-sub {
    font-size: 13px; color: var(--sub);
    margin-bottom: 10px; line-height: 1.4; display: block; white-space: normal;
}

/* cake message */
.cake-message-container { margin-bottom: 12px; }
.cake-message-container label {
    font-size: 12px; font-weight: 700; color: var(--text);
    margin-bottom: 6px; display: flex; align-items: center; gap: 5px;
}
.req-star { color: var(--orange); }
.input-with-counter { position: relative; }
.cake-message-input {
    width: 100%; padding: 9px 52px 9px 12px;
    border: 1.5px solid var(--border); border-radius: 8px;
    font-family: var(--font); font-size: 13px; color: var(--dark);
    background: #FAFAFA; outline: none; transition: border-color 0.2s; display: block;
}
.cake-message-input:focus { border-color: var(--orange); background: var(--white); }
.char-counter {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    font-size: 11px; color: var(--sub); pointer-events: none; display: block;
}
.msg-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.save-message-btn {
    background: var(--green); color: white; border: none;
    padding: 6px 14px; border-radius: 6px; font-size: 12px;
    font-weight: 700; font-family: var(--font);
    display: flex; align-items: center; gap: 5px;
    transition: background 0.15s; cursor: pointer;
}
.save-message-btn:hover { background: #4fa036; }
.save-message-btn:disabled { background: #ccc; cursor: not-allowed; }
.save-status { font-size: 12px; color: var(--green); font-weight: 600; display: inline-block; }

/* qty + remove */
.item-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.qty-control {
    display: flex; align-items: center; background: var(--white);
    border: 1.5px solid var(--orange); border-radius: 8px; overflow: hidden;
}
.quantity-btn {
    width: 34px; height: 34px; background: none; border: none;
    color: var(--orange); font-size: 12px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s; cursor: pointer; font-family: var(--font);
}
.quantity-btn:hover { background: var(--orange-light); }
.quantity {
    min-width: 34px; text-align: center; font-weight: 800;
    font-size: 14px; color: var(--dark);
    border-left: 1px solid var(--border); border-right: 1px solid var(--border);
    height: 34px; display: flex; align-items: center; justify-content: center;
    font-family: var(--font);
}
.remove-btn {
    background: none; border: none; color: var(--red);
    font-size: 13px; font-weight: 700; font-family: var(--font);
    display: flex; align-items: center; gap: 5px;
    transition: opacity 0.15s; padding: 0; cursor: pointer;
}
.remove-btn:hover { opacity: 0.7; }

/* right: image + price */
.ci-right { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; flex-shrink: 0; }
.ci-img {
    width: 90px; height: 90px; object-fit: cover;
    border-radius: 10px; border: 1px solid var(--border); display: block;
}
.ci-price { font-size: 15px; font-weight: 800; color: var(--dark); white-space: nowrap; font-family: var(--font); display: block; }
.item-price { display: none !important; }

/* empty state */
.empty-cart { text-align: center; padding: 60px 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty-illustration i { font-size: 48px; color: #ddd; display: block; margin-bottom: 8px; }
.empty-cart h3 { font-size: 18px; font-weight: 800; color: var(--dark); }
.empty-cart p  { font-size: 14px; color: var(--sub); }
.browse-btn {
    background: var(--orange); color: white; padding: 12px 28px;
    border-radius: 8px; font-weight: 800; font-size: 14px;
    font-family: var(--font); margin-top: 8px;
    transition: background 0.15s; display: inline-block; height: auto;
}
.browse-btn:hover { background: var(--orange-dark); }

/* savings banner */
.savings-banner {
    background: var(--green-light); border: 1px solid #c6eab5;
    border-radius: var(--radius-sm); padding: 12px 18px;
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; font-weight: 700; font-family: var(--font); color: #2d7a18;
}
.savings-banner i { font-size: 16px; color: var(--green); flex-shrink: 0; }

/* === RIGHT COLUMN === */
.cart-right { position: sticky; top: 90px; display: flex; flex-direction: column; gap: 16px; }
.summary-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.sc-head { display: flex; align-items: center; gap: 8px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.sc-head i { color: var(--orange); font-size: 16px; }
.sc-head h3 { font-size: 15px; font-weight: 800; color: var(--dark); font-family: var(--font); }

/* coupon */
.coupon-card .promo-code-form { padding: 16px 20px; }
.promo-input-row {
    display: flex; align-items: center; border: 1.5px solid var(--border);
    border-radius: 8px; overflow: hidden; background: #FAFAFA;
}
.promo-icon { color: var(--orange); font-size: 15px; padding: 0 10px; flex-shrink: 0; display: flex; align-items: center; }
.promo-input {
    flex: 1; padding: 11px 8px; border: none; background: none;
    font-family: var(--font); font-size: 13px; color: var(--dark);
    outline: none; min-width: 0; display: block; width: auto;
}
.apply-btn {
    background: var(--orange) !important; color: white !important;
    border: none; padding: 11px 16px; font-family: var(--font);
    font-size: 13px; font-weight: 800; transition: background 0.15s;
    white-space: nowrap; cursor: pointer; display: block;
    border-radius: 0; height: auto;
}
.apply-btn:hover:not(:disabled) { background: var(--orange-dark) !important; }
.apply-btn:disabled { background: #ccc !important; cursor: not-allowed; }

.applied-coupon { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.coupon-pill { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--green); font-family: var(--font); }
.coupon-pill i { font-size: 16px; }
.remove-coupon-btn {
    background: none !important; border: 1px solid var(--red) !important;
    color: var(--red) !important; padding: 5px 12px; border-radius: 6px;
    font-size: 12px; font-weight: 700; font-family: var(--font);
    transition: background 0.15s; white-space: nowrap; cursor: pointer;
    display: inline-block; height: auto;
}
.remove-coupon-btn:hover { background: #fff0f0 !important; }
.coupon-message { margin-top: 8px; font-size: 12px; font-weight: 600; font-family: var(--font); min-height: 18px; display: block; }
.coupon-success { color: var(--green); }
.coupon-error   { color: var(--red); }

/* bill rows */
.bill-rows { padding: 4px 20px 0; }
.bill-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 11px 0; font-size: 13px; font-family: var(--font);
    color: var(--sub); border-bottom: 1px solid var(--border);
}
.bill-row:last-child { border-bottom: none; }
.bill-row.green { color: var(--green); }
.bill-row.green span:first-child { display: flex; align-items: center; gap: 5px; }
.bill-total {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 20px; font-size: 16px; font-weight: 900;
    font-family: var(--font); color: var(--dark);
    border-top: 1px dashed var(--border); background: #FAFAFA;
}

/* checkout CTA — override .btn from cake-home */
.checkout-btn {
    display: flex !important; align-items: center; justify-content: center;
    gap: 8px; width: 100%; padding: 16px !important;
    background: linear-gradient(135deg, var(--orange), var(--orange-dark)) !important;
    color: white !important; border: none; border-radius: var(--radius-sm) !important;
    font-family: var(--font); font-size: 16px; font-weight: 800;
    cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 16px rgba(252,128,25,0.3);
    text-align: center; height: auto !important; letter-spacing: 0.2px;
}
.checkout-btn:hover:not(.disabled) { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(252,128,25,0.4); }
.checkout-btn.disabled { background: #ccc !important; box-shadow: none; cursor: not-allowed; pointer-events: none; }

.continue-link {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    font-size: 14px; font-weight: 700; font-family: var(--font);
    color: var(--orange); padding: 8px; transition: opacity 0.15s;
}
.continue-link:hover { opacity: 0.75; }

/* === TOAST === */
.toast-container {
    position: fixed; top: 90px; right: 20px; z-index: 9999;
    display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
    background: var(--white); border-radius: 10px; padding: 13px 16px;
    display: flex; align-items: center; gap: 11px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.12);
    min-width: 270px; max-width: 360px; pointer-events: all;
    transform: translateX(120%); opacity: 0;
    transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s;
    border-left: 4px solid #ccc;
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast i { font-size: 16px; flex-shrink: 0; display: block; }
.toast span { flex: 1; font-size: 13px; font-weight: 600; font-family: var(--font); color: var(--dark); line-height: 1.4; display: block; }
.toast-close { background: none; border: none; color: #bbb; font-size: 12px; cursor: pointer; display: block; }
.toast-close:hover { color: var(--dark); }
.toast-success { border-left-color: var(--green); }
.toast-success i { color: var(--green); }
.toast-error   { border-left-color: var(--red); }
.toast-error i { color: var(--red); }
.toast-info    { border-left-color: #2196F3; }
.toast-info i  { color: #2196F3; }
.toast-warning { border-left-color: #FFB800; }
.toast-warning i { color: #FFB800; }

/* === ANIMATIONS === */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.cart-item { animation: fadeUp 0.3s ease both; }
.cart-item:nth-child(1) { animation-delay: 0.05s; }
.cart-item:nth-child(2) { animation-delay: 0.10s; }
.cart-item:nth-child(3) { animation-delay: 0.15s; }
.cart-item:nth-child(4) { animation-delay: 0.20s; }
.cart-item:nth-child(5) { animation-delay: 0.25s; }
.invalid-cake-item { animation: pulseWarn 1.5s ease-in-out; }
@keyframes pulseWarn {
    0%   { box-shadow: 0 0 0 0 rgba(226,55,68,0.4); }
    70%  { box-shadow: 0 0 0 10px rgba(226,55,68,0); }
    100% { box-shadow: 0 0 0 0 rgba(226,55,68,0); }
}

/* === RESPONSIVE === */
@media (max-width: 860px) {
    .cart-wrap { grid-template-columns: 1fr; max-width: 600px; }
    .cart-right { position: static; order: -1; }
}
@media (max-width: 540px) {
    .cart-page { padding-top: 70px; }
    .cart-wrap { margin: 16px auto; padding: 0 10px; gap: 14px; }
    .restaurant-bar { padding: 12px 14px; flex-wrap: wrap; gap: 10px; }
    .add-more-link { font-size: 12px; padding: 6px 10px; }
    .cart-item { padding: 14px; gap: 10px; }
    .ci-img { width: 70px; height: 70px; }
    .ci-name { font-size: 14px; }
    .bill-rows { padding: 0 14px; }
    .bill-total { padding: 12px 14px; font-size: 15px; }
    .sc-head { padding: 13px 14px; }
    .coupon-card .promo-code-form { padding: 12px 14px; }
    .toast-container { right: 10px; left: 10px; }
    .toast { max-width: 100%; min-width: unset; }
}
@media (max-width: 360px) {
    .item-actions { flex-direction: column; align-items: flex-start; }
    .ci-right { flex-direction: row-reverse; align-items: center; }
    .ci-img { width: 58px; height: 58px; }
}

/* === FIX: Cart count badge (overrides cake-home.css span{display:block}) === */
.shopping-cart {
    position: relative !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

.cart-count {
    position: absolute !important;
    top: -5px !important;
    right: -6px !important;
    width: 20px !important;
    height: 20px !important;
    background-color: hsl(3, 90%, 55%) !important;
    color: white !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    font-family: var(--font) !important;
}

/* === messages-container fallback (used by cake-cart-functions.js) === */
.messages-container {
    position: fixed;
    top: 90px;
    right: 20px;
    z-index: 9998;
    max-width: 360px;
    width: 100%;
    pointer-events: none;
}