/* ============================================================
   Honest Bison — Checkout Calendar
   ============================================================ */

#hb-checkout-calendar {
    margin: 1rem 0 1.5rem;
}

.hb-calendar-row td {
    padding: 0 !important;
}

.hb-cal {
    font-family: inherit;
    max-width: 420px;
    margin: 0 auto;
}

/* Heading */

.hb-cal__heading {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #555;
    margin: 0 0 0.75rem;
}

/* Speed tabs */

.hb-cal__speed-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.hb-cal__speed-tab {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #555;
    text-align: center;
    transition: border-color 0.12s, background 0.12s, color 0.12s;
    line-height: 1.3;
}

.hb-cal__speed-tab:hover {
    border-color: #aaa;
    color: #333;
}

.hb-cal__speed-tab--active {
    border-color: #333;
    background: #333;
    color: #fff;
}

.hb-cal__speed-tab--active:hover {
    border-color: #333;
    background: #333;
    color: #fff;
}

.hb-cal__tab-price {
    display: block;
    font-size: 0.7rem;
    font-weight: 400;
    opacity: 0.85;
    margin-top: 1px;
}

.hb-cal__speed-tab--active .hb-cal__tab-price {
    opacity: 0.8;
}

/* Header */

.hb-cal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.hb-cal__month-label {
    font-weight: 600;
    font-size: 1rem;
}

.hb-cal__nav {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 2rem;
    height: 2rem;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    color: #444;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s;
}

.hb-cal__nav:hover {
    background: #f5f5f5;
}

.hb-cal__nav:disabled {
    opacity: 0.3;
    cursor: default;
}

.hb-cal__nav:disabled:hover {
    background: none;
}

/* Grid */

.hb-cal__grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    margin-bottom: 0.75rem;
}

.hb-cal__dow {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.25rem 0;
}

.hb-cal__day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.2;
    cursor: default;
    border: 2px solid transparent;
    transition: border-color 0.12s, transform 0.1s;
    background: none;
    padding: 0;
}

.hb-cal__day--empty,
.hb-cal__day--unavailable {
    color: #ddd;
}

/* Ground and Express — both green (zone type is determined by ZIP, never mixed) */
.hb-cal__day--ground,
.hb-cal__day--express {
    background: #e8f5e8;
    color: #1a4d1a;
    cursor: pointer;
}

.hb-cal__day--ground:hover,
.hb-cal__day--express:hover {
    background: #c8e6c8;
    border-color: #4caf50;
}

/* Preferred marker — slightly deeper green */
.hb-cal__day--preferred {
    background: #c8e6c8;
}

/* Overnight — gold/amber */
.hb-cal__day--overnight {
    background: #fff3e0;
    color: #5d3a00;
    cursor: pointer;
}

.hb-cal__day--overnight:hover {
    background: #ffe0b2;
    border-color: #e6a817;
}

/* Selected */
.hb-cal__day--selected {
    border-color: #333 !important;
    transform: scale(1.08);
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

.hb-cal__price {
    font-size: 0.6rem;
    font-weight: 600;
    opacity: 0.8;
    margin-top: 1px;
}

/* Legend */

.hb-cal__legend {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.hb-cal__legend-item {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: #555;
}

.hb-cal__legend-item::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.hb-cal__legend--standard::before  { background: #c8e6c8; }
.hb-cal__legend--overnight::before { background: #ffe0b2; }

/* Selection summary */

.hb-cal__selection {
    padding: 0.625rem 0.875rem;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    min-height: 2.5rem;
    font-size: 0.875rem;
}

.hb-cal__prompt {
    margin: 0;
    color: #888;
}

.hb-cal__selected-summary {
    margin: 0;
    line-height: 1.5;
    color: #333;
}

.hb-cal__selected-tier {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    color: #555;
}

/* Overnight selected-tier label color */
.hb-cal__selected-tier--overnight {
    color: #a06000;
}

/* States */

.hb-cal__loading,
.hb-cal__error {
    font-size: 0.9rem;
    color: #666;
    margin: 0.5rem 0;
}

.hb-cal__error {
    color: #c0392b;
}

/* Order meta in admin */
.hb-order-meta {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}

.hb-order-meta h4 {
    margin: 0 0 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #555;
}

.hb-order-meta p {
    margin: 0.2rem 0;
    font-size: 0.875rem;
}

/* ============================================================
   Mobile
   ============================================================ */

/* Hide the WC shipping methods row — the calendar tabs replace it */
tr.woocommerce-shipping-totals {
    display: none !important;
}

/* Ensure the calendar row is visible — some themes hide table rows on mobile */
.hb-calendar-row {
    display: table-row !important;
}

.hb-calendar-row td {
    display: table-cell !important;
    padding: 0 !important;
}

@media ( max-width: 600px ) {
    .hb-cal {
        max-width: 100%;
    }

    .hb-cal__speed-tab {
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
    }

    .hb-cal__tab-price {
        font-size: 0.65rem;
    }

    .hb-cal__grid {
        gap: 2px;
    }

    /* Fixed cell height instead of aspect-ratio, which can collapse on narrow viewports */
    .hb-cal__day {
        aspect-ratio: unset;
        height: 44px;
        font-size: 0.75rem;
    }

    .hb-cal__price {
        font-size: 0.55rem;
    }

    .hb-cal__dow {
        font-size: 0.6rem;
        padding: 0.15rem 0;
    }

    .hb-cal__month-label {
        font-size: 0.9rem;
    }

    .hb-cal__selection {
        font-size: 0.8rem;
    }

    .hb-cal__selected-summary {
        line-height: 1.6;
    }
}
