/* ==========================================================================
   shippingstyles.css
   Shipping Calculator Modal — SBO
   All selectors prefixed sbo-ship- to avoid any cross-modal conflicts.
   Mobile-first CSS Grid. Breakpoints: 480 / 600 / 720 / 980px.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Overlay (reuses sbo-cart-overlay pattern from cartstyles)
   -------------------------------------------------------------------------- */
.sbo-ship-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: #ffffff;
    -webkit-tap-highlight-color: transparent;
}
.sbo-ship-overlay.active {
    display: block;
}

/* --------------------------------------------------------------------------
   Modal container
   -------------------------------------------------------------------------- */
.sbo-ship-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10001;
    overflow-y: auto;
}
.sbo-ship-modal.active {
    display: block;
    padding: 0 0.5rem 2rem 0.5rem;
}

.sbo-ship-panel {
    background: #ffffff;
    border-bottom-left-radius: 1.375rem;
    border-bottom-right-radius: 1.375rem;
    box-shadow: 0 8px 8px rgba(0,0,0,0.35);
    max-width: 37.5rem;
    margin-inline: auto;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto 1fr auto;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    height: var(--sbo-modal-h);
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.sbo-ship-header {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 0.5rem;
    padding: 0.9rem 1rem 0.85rem 1rem;
    border-bottom: 1px solid #eeeeee;
    background: #ebebeb;
}

.sbo-ship-logo-wrap {
    display: block;
    font-size: 1.3rem;
    font-family: sans-serif;
    line-height: 0.65;
    margin-top: 0.85rem;
}
.sbo-ship-fed {
    color: #4D148C;
    font-weight: 900;
        letter-spacing: -0.09em;
}
.sbo-ship-ex {
    color: #FF6600;
    font-weight: 600;
        letter-spacing: -0.07em;
    margin-left: -0.1rem;
}
.sbo-ship-label {
    font-size: 0.7rem;
    color: #666666;
    padding-left: 0.38rem;
}

.sbo-ship-price-col {
    position: relative;
    text-align: right;
    min-width: 120px;
    min-height: 3.4rem;
    padding-right: 0.75rem;
}
.sbo-ship-price-empty,
.sbo-ship-price-main,
.sbo-ship-price-gst,
.sbo-ship-price-spinner {
    position: absolute;
    right: 0;
    transition: opacity 0.25s ease;
}
/* Delay fade-out of price text so spinner overlaps — no blank gap */
.sbo-ship-price-main,
.sbo-ship-price-gst {
    transition-delay: 0.1s;
}
.sbo-ship-price-empty {
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.82rem;
    color: #aaaaaa;
    font-style: italic;
    opacity: 1;
    white-space: nowrap;
}
.sbo-ship-price-main {
    top: 0.35rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.1;
    white-space: nowrap;
    opacity: 0;
}
.sbo-ship-price-gst {
    top: 2.05rem;
    font-size: 0.78rem;
    color: #666666;
    white-space: nowrap;
    opacity: 0;
}
.sbo-ship-price-spinner {
    top: 50%;
    transform: translateY(-50%);
    width: 1.2rem;
    height: 1.2rem;
    border: 2px solid rgba(77,20,140,0.15);
    border-top-color: #4D148C;
    border-radius: 50%;
    animation: sboShipSpin 0.65s linear infinite;
    opacity: 0;
}

/* --------------------------------------------------------------------------
   Body
   -------------------------------------------------------------------------- */
.sbo-ship-body {
    padding: 0 1rem 0.75rem 1rem;
    display: grid;
    gap: 0.75rem;
    overflow-y: auto;
    min-height: 0;
}

.sbo-ship-fields {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.75rem;
    align-items: end;
}

.sbo-ship-field-label {
    display: block;
    margin-bottom: 0.25rem;
    padding-left: 0.75rem;
    text-align: left;
}

.sbo-ship-actions {
    display: grid;
    grid-template-columns: auto auto;
    justify-content: end;
    align-items: center;
}

#sbo-ship-reset-btn {
    margin-right: 1.35rem;
}

.sbo-ship-apply-btn {
    justify-self: end;
    margin-right: 0.75rem;
    width: fit-content;
}

.sbo-ship-field-wrap {
    position: relative;
}

.sbo-ship-input {
    width: 100%;
    box-sizing: border-box;
    border: 1.5px solid #cccccc;
    border-radius: 0.45rem;
    padding: 0.6rem 0.75rem;
    font-size: 1rem;
    color: #333333;
    background: #ffffff;
    outline: none;
    min-height: 44px;
    transition: border-color 0.15s;
    -webkit-appearance: none;
    appearance: none;
}
.sbo-ship-input:focus {
    border-color: #044cc7;
    background: #f0f8ff;
}
.sbo-ship-input::placeholder {
    color: #aaaaaa;
    font-size: 0.92rem;
}

.sbo-ship-postcode-wrap {
    width: 90px;
}
.sbo-ship-postcode-input {
    width: 90px;
    min-width: 0;
    text-align: center;
    letter-spacing: 0.05em;
}

/* --------------------------------------------------------------------------
   Suburb dropdown
   -------------------------------------------------------------------------- */
.sbo-ship-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    z-index: 1300;
    background: #ffffff;
    border: 1.5px solid #cccccc;
    border-radius: 0.45rem;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    max-height: 220px;
    overflow-y: auto;
}
.sbo-ship-dropdown.open {
    display: block;
}
.sbo-ship-dropdown-item {
    padding: 0.6rem 0.75rem;
    font-size: 0.92rem;
    color: #333333;

    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    border-bottom: 1px solid #f0f0f0;
}
.sbo-ship-dropdown-item:last-child {
    border-bottom: none;
}
.sbo-ship-dropdown-item.active {
    background: #f0f8ff;
}
.sbo-ship-item-pressing {
    background: #f0f8ff;
}
.sbo-ship-dropdown-suburb {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sbo-ship-dropdown-postcode {
    font-size: 0.85rem;
    color: #888888;
    font-family: monospace;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Status / result row
   -------------------------------------------------------------------------- */
.sbo-ship-status {
    min-height: 4rem;
    font-size: 0.9rem;
    text-align: center;
    padding-top: 1.65rem;
}
@keyframes sboShipSpin { to { transform: rotate(360deg); } }


/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.sbo-ship-footer {
    min-height: 3.25rem;
    padding: 0.55rem 1.25rem;
    border-top: 1px solid #e0e0e0;
    background: #ffffff;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: auto;
    justify-content: end;
    align-items: center;
}
.sbo-ship-disclaimer {
    align-self: end;
    padding: 0 1rem 0.5rem 1rem;
    font-size: 0.75rem;
    color: #888888;
    line-height: 1.4;
    margin: 0;
}
.sbo-ship-close-btn {
    background: transparent;
    border: 1px solid #cccccc;
    border-radius: 0.4rem;
    padding: 0.5rem 0.9rem;
    font-size: 0.88rem;
    color: #555555;

    white-space: nowrap;
    min-height: 44px;
    min-width: 60px;
}
.sbo-ship-footer-btns {
    display: grid;
    grid-auto-flow: column;
    gap: 0.5rem;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (min-width: 480px) {
    .sbo-ship-modal.active {
        padding: 0 0.75rem 3rem 0.75rem;
    }
    .sbo-ship-panel {
        max-width: 37.5rem;
    }
}

@media (min-width: 600px) {
    .sbo-ship-modal.active {
        padding: 0 1.5rem 1.5rem 1.5rem;
    }
    .sbo-ship-panel {
        max-width: 37.5rem;
    }
    .sbo-ship-price-main {
        font-size: 1.4rem;
    }
}

@media (min-width: 720px) {
    .sbo-ship-panel {
        max-width: 37.5rem;
    }
}

/* --------------------------------------------------------------------------
   Shipping breakdown disclosure panel
   -------------------------------------------------------------------------- */
.sbo-ship-breakdown {
    width: 100%;
    text-align: left;
    box-sizing: border-box;
    border-top: 1px solid #e0e0e0;
    padding: 0.5rem 1rem 0.6rem 0;
    display: none;
}
.sbo-ship-breakdown.visible {
    display: block;
}
.sbo-ship-breakdown.sbo-ship-breakdown-updating {
    opacity: 0.4;
    pointer-events: none;
}
.sbo-ship-breakdown-toggle {
    background: none;
    border: none;

    color: #0066ff ;
    font-size: 0.9rem;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0.3rem;
    width: 100%;
        text-align: right;
    -webkit-tap-highlight-color: transparent;
}
.sbo-ship-breakdown-toggle:active { opacity: 0.7; }
.sbo-ship-breakdown-items {
    margin-top: 0.4rem;
}
.sbo-ship-breakdown-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto auto;
    gap: 0.2rem 0.5rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.78rem;
    align-items: center;
    color: #333;
    max-height: 5rem;
    overflow: hidden;
    transition: opacity 0.18s ease, max-height 0.22s ease, padding 0.2s ease, border-color 0.2s ease;
}
.sbo-ship-bd-removing {
    opacity: 0;
    max-height: 0 !important;
    padding-top: 0;
    padding-bottom: 0;
    border-bottom-color: transparent;
}
.sbo-ship-bd-name   { grid-column: 2; }
.sbo-ship-bd-copies { grid-column: 3; color: #666; white-space: nowrap; }
.sbo-ship-bd-weight { grid-column: 4; color: #666; white-space: nowrap; }
.sbo-ship-bd-price  { grid-column: 5; white-space: nowrap; text-align: right; min-width: 3.4rem; }
.sbo-ship-breakdown-total {
    display: grid;
    grid-template-columns: 1fr auto;
    padding: 0.4rem 0 0.1rem 0;
    font-size: 0.8rem;
    color: #333333;
}
.sbo-ship-bd-total-label { grid-column: 1; text-align: right; margin-right: 0.5rem; }
.sbo-ship-bd-total-price { grid-column: 2; width: 5rem; text-align: right; }

.sbo-ship-bd-viewcart {
    display: block;
    width: fit-content;
    margin: 1.6rem 0 0 auto;
}
.sbo-ship-bd-remove {
    grid-column: 1;
    background: none;
    border: none;
    font-size: 1rem;
    color: #999;
    padding: 0 0 0 0.4rem;
    line-height: 1;
    align-self: center;
    font-weight: 600;
}
