/* ==========================================================================
   Step-by-step pages: login and checkout
   (markup: storefront/login/*.blade.php, storefront/checkout/*.blade.php,
    partials/flow-header and flow-bar; behaviour: js/storefront/otp-input.js,
    js/storefront/checkout-bar.js)
   ========================================================================== */

.store--flow {
    background: #F6F3FA;
}

.store--flow .store__main {
    max-width: 640px;
    padding: 14px 14px calc(110px + env(safe-area-inset-bottom));
}

.flow {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* ---------- Header ---------- */

.flow-header {
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 10px 10px 12px;
    background: linear-gradient(180deg, #E9DBFF 0%, #F4EDFF 100%);
    display: flex;
    align-items: center;
    gap: 6px;
}

.flow-header__back {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: var(--radius-pill);
    color: var(--color-ink);
    display: flex;
    align-items: center;
    justify-content: center;
}

.flow-header__back:hover {
    background: rgba(255, 255, 255, 0.6);
}

.flow-header__back .icon {
    width: 24px;
    height: 24px;
    stroke-width: 2.5;
}

.flow-header__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.flow-header__title {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
    color: var(--color-ink);
}

.flow-header__sub {
    font-size: 13px;
    font-weight: 500;
    color: #4B3E66;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- White cards ---------- */

.flow-card {
    padding: 18px 16px;
    border-radius: 18px;
    background: var(--color-surface);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.flow-card__intro {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.flow-card__title {
    font-size: 18px;
    font-weight: 800;
}

.flow-card__text {
    font-size: 14px;
    color: var(--color-text-muted);
}

.flow-card__fine {
    font-size: 12px;
    color: var(--color-text-muted);
}

.flow-card__link,
.flow-card__link-button {
    color: var(--color-primary);
    font-weight: 700;
}

.flow-card__link:hover,
.flow-card__link-button:hover {
    color: var(--color-primary-dark);
}

.flow-card__link-button {
    padding: 0;
    border: 0;
    background: none;
    font-size: 14px;
    cursor: pointer;
}

/* ---------- Form fields ---------- */

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field__label {
    font-size: 13px;
    font-weight: 700;
    color: #4B3E66;
}

.field__error {
    font-size: 13px;
    font-weight: 600;
    color: #DC2626;
}

/* Mobile number with +91 in front */
.phone-input {
    height: 52px;
    padding: 0 14px;
    border: 2px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 10px;
}

.phone-input:focus-within {
    border-color: var(--color-primary);
}

.phone-input.is-invalid {
    border-color: #DC2626;
}

.phone-input__code {
    padding-right: 10px;
    border-right: 1px solid var(--color-border-strong);
    color: var(--color-text-muted);
    font-size: 18px;
    font-weight: 700;
}

.phone-input__field {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: none;
    background: transparent;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.phone-input__field::placeholder {
    color: #C9C2D6;
}

/* 6-digit code: one real input; with JavaScript it sits invisibly over six boxes */
.otp-input {
    position: relative;
}

.otp-input__field {
    width: 100%;
    height: 52px;
    padding: 0 14px;
    border: 2px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    outline: none;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.4em;
    text-align: center;
}

.otp-input__field:focus {
    border-color: var(--color-primary);
}

.otp-input__boxes {
    display: none;
}

.otp-input.is-enhanced .otp-input__field {
    position: absolute;
    inset: 0;
    height: 100%;
    opacity: 0;
    font-size: 16px; /* stops phones from zooming in */
}

.otp-input.is-enhanced .otp-input__boxes {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}

.otp-input__box {
    height: 52px;
    border: 2px solid var(--color-border-strong);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 800;
}

.otp-input__box.is-current {
    border-color: var(--color-primary);
}

.otp-input.is-invalid .otp-input__box,
.otp-input.is-invalid .otp-input__field {
    border-color: #DC2626;
}

/* Testing only: the code shown on the page */
.demo-otp {
    padding: 10px 12px;
    border: 1px dashed #E2B93B;
    border-radius: 12px;
    background: #FFF6D6;
    color: #6B4E00;
    font-size: 13px;
}

.resend {
    font-size: 13px;
    color: var(--color-text-muted);
}

.resend__button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-primary);
    font-weight: 700;
    cursor: pointer;
}

.resend__button:disabled {
    color: var(--color-text-muted);
    font-weight: 500;
    cursor: default;
}

/* ---------- Text fields ---------- */

.flow-card__heading {
    font-size: 15px;
    font-weight: 800;
}

.field--plain {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

.field--short .text-input {
    max-width: 160px;
}

.text-input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid var(--color-border-strong);
    border-radius: 12px;
    outline: none;
    background: var(--color-surface);
    font-size: 16px; /* 16px stops phones from zooming in */
    font-weight: 600;
}

.text-input::placeholder {
    color: #A79FB8;
    font-weight: 500;
}

.text-input:focus {
    border: 2px solid var(--color-primary);
    padding: 0 13px;
}

.text-input.is-invalid {
    border: 2px solid #DC2626;
    padding: 0 13px;
}

/* ---------- Choice cards (saved addresses) ---------- */

.address-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.address-option {
    position: relative;
}

.choice {
    display: block;
    position: relative;
    cursor: pointer;
}

.choice__input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice__box {
    padding: 12px 64px 12px 12px;
    border: 1px solid #E5DCF2;
    border-radius: 14px;
    background: var(--color-surface);
    display: flex;
    gap: 10px;
}

.choice__dot {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    flex-shrink: 0;
    border: 2px solid #C9BEDD;
    border-radius: var(--radius-pill);
    display: flex;
    align-items: center;
    justify-content: center;
}

.choice__dot::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: var(--radius-pill);
    background: transparent;
}

.choice__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.choice__title {
    font-size: 14px;
    font-weight: 800;
}

.choice__sub {
    font-size: 13px;
    line-height: 1.4;
    color: #4B3E66;
    overflow-wrap: anywhere;
}

.choice__input:checked + .choice__box {
    padding: 11px 63px 11px 11px;
    border: 2px solid var(--color-primary);
    background: #FFF0F5;
}

.choice__input:checked + .choice__box .choice__dot {
    border-color: var(--color-primary);
}

.choice__input:checked + .choice__box .choice__dot::after {
    background: var(--color-primary);
}

.choice__input:focus-visible + .choice__box {
    outline: 2px solid var(--color-ink);
    outline-offset: 2px;
}

.address-option__edit {
    position: absolute;
    top: 8px;
    right: 8px;
    height: 32px;
    padding: 0 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-primary);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.address-option__edit:hover {
    background: #FFF0F5;
}

.address-add {
    height: 44px;
    border: 1px dashed var(--color-primary);
    border-radius: 12px;
    background: var(--color-surface);
    color: var(--color-primary);
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.address-add:hover {
    background: #FFF0F5;
}

.address-delete {
    align-self: flex-start;
    padding: 0;
    border: 0;
    background: none;
    color: #DC2626;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

/* Home / Work / Other */
.label-chips {
    margin-top: 6px;
    display: flex;
    gap: 8px;
}

.label-chip {
    position: relative;
    cursor: pointer;
}

.label-chip__input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.label-chip__text {
    height: 36px;
    padding: 0 16px;
    border: 1px solid #E5DCF2;
    border-radius: var(--radius-pill);
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--color-ink);
}

.label-chip__input:checked + .label-chip__text {
    border-color: var(--color-ink);
    background: var(--color-ink);
    color: #FFFFFF;
}

.label-chip__input:focus-visible + .label-chip__text {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Soft purple note, e.g. "no address is needed" */
.info-note {
    padding: 12px 14px;
    border-radius: 14px;
    background: #F6F1FF;
    color: var(--color-ink);
    font-size: 14px;
    line-height: 1.45;
}

/* ---------- Delivery time step ---------- */

.choice__box--compact {
    padding: 12px;
    align-items: center;
}

.choice__input:checked + .choice__box--compact {
    padding: 11px;
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.mode-card {
    position: relative;
    cursor: pointer;
}

.mode-card__input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.mode-card__box {
    height: 100%;
    padding: 10px 6px;
    border: 1px solid #E5DCF2;
    border-radius: 14px;
    background: var(--color-surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-align: center;
}

.mode-card__title {
    font-size: 14px;
    font-weight: 800;
    color: var(--color-ink);
}

.mode-card__sub {
    font-size: 11px;
    color: #5F5870;
}

.mode-card__input:checked + .mode-card__box {
    padding: 9px 5px;
    border: 2px solid var(--color-primary);
    background: #FFF0F5;
}

.mode-card__input:checked + .mode-card__box .mode-card__title {
    color: var(--color-primary-dark);
}

.mode-card__input:focus-visible + .mode-card__box {
    outline: 2px solid var(--color-ink);
    outline-offset: 2px;
}

.mode-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mode-panel[hidden] {
    display: none;
}

/* Without JavaScript all panels show, so give them a little space */
[data-delivery-time]:not(.is-enhanced) .mode-panel {
    padding-top: 10px;
    border-top: 1px solid #F1ECF7;
}

.info-note--green {
    background: #EAF8F0;
    color: #0B4F26;
    font-weight: 700;
}

/* Today / Tomorrow / Mon 12 Oct … (scrolls sideways when there are many days) */
.day-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.day-tabs::-webkit-scrollbar {
    display: none;
}

[data-delivery-time]:not(.is-enhanced) .day-tabs {
    display: none;
}

.day-tab {
    position: relative;
    flex: 1 0 auto;
    min-width: 92px;
    cursor: pointer;
}

.day-tab__input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.day-tab__text {
    height: 40px;
    padding: 0 12px;
    white-space: nowrap;
    border-radius: 12px;
    background: var(--color-soft);
    color: var(--color-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
}

.day-tab__input:checked + .day-tab__text {
    background: var(--color-ink);
    color: #FFFFFF;
}

.day-tab__input:focus-visible + .day-tab__text {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.slot-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.slot-group[hidden] {
    display: none;
}

.slot-group__title {
    font-size: 13px;
    font-weight: 800;
    color: #4B3E66;
}

[data-delivery-time].is-enhanced .slot-group__title {
    display: none;
}

.slot-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.slot {
    position: relative;
    cursor: pointer;
}

.slot__input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.slot__text {
    min-height: 48px;
    padding: 4px;
    border: 1px solid #E5DCF2;
    border-radius: 12px;
    background: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
}

.slot__input:checked + .slot__text {
    border: 2px solid var(--color-primary);
    background: #FFF0F5;
    color: var(--color-primary-dark);
}

.slot__input:focus-visible + .slot__text {
    outline: 2px solid var(--color-ink);
    outline-offset: 2px;
}

.slot__input:disabled + .slot__text {
    background: #F3F1F6;
    color: #B3ABC2;
    text-decoration: line-through;
    cursor: not-allowed;
}

.select-input {
    width: 100%;
    height: 46px;
    padding: 0 12px;
    border: 1px solid var(--color-border-strong);
    border-radius: 12px;
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
    font-size: 16px;
    font-weight: 600;
}

.select-input:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 0;
}

/* ---------- Review step ---------- */

.flow-alert {
    padding: 12px 14px;
    border: 1px solid #F5C2C7;
    border-radius: 14px;
    background: #FDECEE;
    color: #8A1C2B;
    font-size: 14px;
    font-weight: 600;
}

.flow-card--rows {
    padding: 4px 14px;
    gap: 0;
}

.review-row {
    padding: 12px 0;
    border-bottom: 1px solid #F1ECF7;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.review-row:last-child {
    border-bottom: 0;
}

.review-row__label {
    width: 76px;
    flex-shrink: 0;
    font-size: 13px;
    color: var(--color-text-muted);
}

.review-row__value {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.review-row__action {
    flex-shrink: 0;
    color: var(--color-primary);
    font-size: 13px;
    font-weight: 700;
}

.review-row__action:hover {
    color: var(--color-primary-dark);
}

.review-bill {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.review-lines {
    padding: 6px 14px;
    gap: 0;
}

.review-line {
    padding: 10px 0;
    border-bottom: 1px solid #F1ECF7;
    display: flex;
    align-items: center;
    gap: 10px;
}

.review-line:last-child {
    border-bottom: 0;
}

.review-line__media {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 10px;
    background: #F6F3FA;
    overflow: hidden;
}

.review-line__media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.review-line__info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.review-line__name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.review-line__meta {
    font-size: 12px;
    color: var(--color-text-muted);
}

.review-line__total {
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 800;
}

.text-area {
    width: 100%;
    min-height: 72px;
    padding: 10px 12px;
    border: 1px solid var(--color-border-strong);
    border-radius: 12px;
    outline: none;
    resize: vertical;
    font: inherit;
    font-size: 16px;
    line-height: 1.4;
}

.text-area::placeholder {
    color: #8A8199;
}

.text-area:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary);
}

.text-area.is-invalid {
    border-color: #DC2626;
}

/* ---------- Order placed ---------- */

.placed {
    padding: 22px 16px;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.placed__icon {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-pill);
    background: #15803D;
    color: #FFFFFF;
    box-shadow: 0 8px 20px rgba(21, 128, 61, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
}

.placed__icon .icon {
    width: 36px;
    height: 36px;
    stroke-width: 3;
}

.placed__title {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 800;
    color: var(--color-ink);
}

.placed__text {
    font-size: 14px;
    color: #4B3E66;
}

.placed__shop {
    align-self: center;
}

/* ---------- Fixed bar at the bottom ---------- */

.flow-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    padding: 10px max(14px, calc((100% - 640px) / 2 + 14px)) calc(14px + env(safe-area-inset-bottom));
    border-top: 1px solid #EEE8F5;
    background: var(--color-surface);
    box-shadow: 0 -6px 18px rgba(42, 16, 82, 0.06);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.flow-bar__amount {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

.flow-bar__amount[hidden] {
    display: none;
}

.flow-bar__total {
    font-size: 18px;
    font-weight: 800;
}

.flow-bar__label {
    font-size: 12px;
    color: var(--color-text-muted);
}

.flow-bar__next {
    height: 50px;
    margin-left: auto;
    padding: 0 22px;
    border: 0;
    border-radius: var(--radius-md);
    background: var(--color-primary);
    color: var(--color-on-primary);
    box-shadow: 0 6px 14px rgba(217, 30, 91, 0.30);
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
}

.flow-bar__next:hover {
    background: var(--color-primary-dark);
}

.flow-bar__next:disabled {
    background: #C9C2D6;
    box-shadow: none;
    cursor: wait;
}

/* A delivery type that cannot be chosen right now (e.g. fast delivery outside its timings) */
.mode-card.is-off {
    cursor: not-allowed;
}

.mode-card.is-off .mode-card__box {
    background: #F1EDF7;
    border-color: #F1EDF7;
    opacity: 0.7;
}

.mode-card.is-off .mode-card__sub {
    color: #B0124A;
}

/* Spot delivery: the chosen spot's times */
.spot-times[hidden] {
    display: none;
}
