/* Frontend Styles – WC Bike Inventory Manager v3.0 */

.wcbi-booking-interface {
    margin: 20px 0;
    padding: 22px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}
.wcbi-booking-interface h3 { margin: 0 0 16px; color: #111827; font-size: 16px; font-weight: 700; }
.wcbi-booking-section { margin-top: 10px; }

/* ── Availability Badge ────────────────────────────────────────── */
.wcbi-inventory-info { margin-bottom: 16px; }
.wcbi-avail-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 30px; font-size: 13px; font-weight: 700;
    background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0;
    transition: all .3s;
}
.wcbi-avail-badge.partial {
    background: #fef3c7; color: #92400e; border-color: #fde68a;
}
.wcbi-avail-badge.empty {
    background: #fee2e2; color: #991b1b; border-color: #fca5a5;
}
.wcbi-avail-badge #wcbi-available-count { font-size: 16px; }

/* ── Date Input ────────────────────────────────────────────────── */
.wcbi-date-range-field { margin-bottom: 20px; }
.wcbi-date-range-field label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.wcbi-date-input {
    width: 100%; padding: 12px 14px; border: 1.5px solid #d1d5db; border-radius: 8px;
    font-size: 14px; background: #fff; cursor: pointer; font-weight: 500;
    box-sizing: border-box; transition: border-color .2s;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%23666" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>');
    background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
.wcbi-date-input:focus { outline: none; border-color: #1a56db; box-shadow: 0 0 0 3px rgba(26,86,219,.1); }
.wcbi-date-hint { font-size: 12px; color: #6b7280; margin-top: 6px; font-style: italic; }

/* ── Clear button ──────────────────────────────────────────────── */
.wcbi-clear-dates {
    margin-top: 6px; padding: 7px 14px; background: #f3f4f6; border: 1px solid #d1d5db;
    border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 600; color: #6b7280;
    transition: all .15s;
}
.wcbi-clear-dates:hover { background: #e5e7eb; color: #374151; }

/* ── Time Slot ─────────────────────────────────────────────────── */
.wcbi-time-slots-section { margin: 16px 0; }
.wcbi-time-slots-section label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.wcbi-select {
    width: 100%; padding: 10px 12px; border: 1.5px solid #d1d5db; border-radius: 8px;
    font-size: 14px; background: #fff; box-sizing: border-box;
}

/* ── Messages ──────────────────────────────────────────────────── */
.wcbi-message {
    display: none; padding: 12px 16px; margin: 12px 0; border-radius: 8px; font-weight: 500; font-size: 14px;
}
.wcbi-message.success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; display: block; }
.wcbi-message.error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; display: block; }
.wcbi-message.info    { background: #e0f2fe; color: #0c4a6e; border: 1px solid #bae6fd; display: block; }
.wcbi-message.warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; display: block; }

/* ── Price Box ─────────────────────────────────────────────────── */
.wcbi-price-box {
    background: #fff; border: 2px solid #1a56db; padding: 16px;
    margin: 16px 0; border-radius: 10px;
}
.wcbi-price-details { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; }
.wcbi-total-line { font-weight: 700; font-size: 1.15em; border-top: 1px solid #e5e7eb; margin-top: 6px; padding-top: 10px; }
.wcbi-total-price { color: #1a56db; }

/* ── Partial Payment ───────────────────────────────────────────── */
.wcbi-partial-payment-section { margin-top: 16px; padding: 16px; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 10px; }
.wcbi-partial-payment-section h4 { margin: 0 0 10px; font-size: 14px; font-weight: 700; }
.wcbi-deposit-option {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; background: #fff; border: 1.5px solid #e5e7eb;
    border-radius: 8px; cursor: pointer; margin-bottom: 6px; transition: all .15s;
}
.wcbi-deposit-option.selected, .wcbi-deposit-option:has(input:checked) { border-color: #1a56db; background: #eff6ff; }
.wcbi-deposit-option input[type="radio"] { margin-right: 10px; }
.wcbi-deposit-label { flex: 1; font-weight: 600; font-size: 14px; }
.wcbi-deposit-amount { font-weight: 700; color: #1a56db; }
.wcbi-remaining-balance { margin-top: 10px; padding: 10px; background: #d1fae5; border: 1px solid #a7f3d0; border-radius: 8px; text-align: center; font-size: 14px; }
.wcbi-remaining-balance strong { color: #065f46; font-size: 1.1em; margin-left: 8px; }

/* ── Add to cart disabled ──────────────────────────────────────── */
button.single_add_to_cart_button:disabled,
button.single_add_to_cart_button.disabled {
    opacity: 0.5 !important; cursor: not-allowed !important;
    pointer-events: none !important; background-color: #9ca3af !important;
}

.required { color: #ef4444; }

/* ====================================================================
   CALENDAR STYLES
==================================================================== */
.ui-datepicker {
    background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
    padding: 16px; width: auto !important; box-shadow: 0 10px 40px rgba(0,0,0,.15);
    z-index: 1000 !important; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.ui-datepicker .ui-datepicker-header { background: #f9fafb; border: none; border-radius: 8px; padding: 10px; margin-bottom: 8px; }
.ui-datepicker .ui-datepicker-title { font-weight: 700; color: #111827; font-size: 14px; }
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { cursor: pointer; top: 10px; }
.ui-datepicker .ui-datepicker-calendar th { padding: 8px 4px; color: #6b7280; font-weight: 600; font-size: 12px; }
.ui-datepicker .ui-datepicker-calendar td { padding: 2px; position: relative; }
.ui-datepicker .ui-datepicker-calendar td a,
.ui-datepicker .ui-datepicker-calendar td span {
    display: flex; align-items: center; justify-content: center;
    min-width: 32px; min-height: 32px; border-radius: 6px;
    text-decoration: none; border: 1px solid transparent; font-size: 13px;
}
.ui-datepicker .ui-datepicker-calendar td a:hover { background: #f3f4f6; }

/* Booked – RED strikethrough */
.ui-datepicker .wcbi-booked-date a,
.ui-datepicker .wcbi-booked-date span,
.ui-datepicker td.wcbi-booked-date.ui-state-disabled span {
    background: #fde047 !important; color: #713f12 !important;
    text-decoration: line-through !important; border-color: #eab308 !important;
    cursor: not-allowed !important; pointer-events: none !important; opacity: 1 !important; font-weight: 600;
}

/* Partially booked – AMBER (still selectable) */
.ui-datepicker .wcbi-partial-booked a,
.ui-datepicker td.wcbi-partial-booked > a {
    background: #fef3c7 !important; color: #92400e !important;
    border-color: #fde68a !important; cursor: pointer !important; font-weight: 600;
}
.ui-datepicker .wcbi-partial-booked a:hover { background: #fde68a !important; }

/* Buffer blocked – ORANGE strikethrough */
.ui-datepicker .wcbi-buffer-blocked-date a,
.ui-datepicker .wcbi-buffer-blocked-date span {
    background: #fff7ed !important; color: #c2410c !important;
    text-decoration: line-through !important; border-color: #fed7aa !important;
    cursor: not-allowed !important; pointer-events: none !important;
}

/* Blocked – GRAY strikethrough */
.ui-datepicker .wcbi-blocked-date a,
.ui-datepicker .wcbi-blocked-date span,
.ui-datepicker td.wcbi-blocked-date.ui-state-disabled span {
    opacity: 1 !important; font-weight: 600;
    background: #fecaca !important; color: #b91c1c !important;
    text-decoration: line-through !important; border-color: #f87171 !important;
    cursor: not-allowed !important; pointer-events: none !important;
}

/* Past – LIGHT GRAY strikethrough */
.ui-datepicker .wcbi-past-date a,
.ui-datepicker .wcbi-past-date span {
    background: #f9fafb !important; color: #d1d5db !important;
    text-decoration: line-through !important; cursor: not-allowed !important;
    pointer-events: none !important; opacity: 0.6 !important;
}

/* Available – WHITE */
.ui-datepicker .wcbi-available a {
    background: #fff !important; color: #111827 !important;
    border: 1px solid #e5e7eb !important; cursor: pointer !important;
}
.ui-datepicker .wcbi-available a:hover { background: #f3f4f6 !important; border-color: #9ca3af !important; }

/* Range – BLUE */
.ui-datepicker .wcbi-range-middle a { background: #dbeafe !important; border-color: #93c5fd !important; color: #1e40af !important; }
.ui-datepicker .wcbi-range-edge a { background: #1a56db !important; color: #fff !important; border-color: #1341b8 !important; font-weight: 700 !important; }
.ui-datepicker .wcbi-range-edge a:hover { background: #1341b8 !important; }

/* Today */
.ui-datepicker .ui-datepicker-today a {
    background: #fef9c3 !important; border: 1.5px solid #fbbf24 !important; font-weight: 700;
}

/* Legend */
.wcbi-calendar-legend {
    display: flex; flex-wrap: wrap; gap: 10px;
    padding: 12px 0 0; margin-top: 10px;
    border-top: 1px solid #f3f4f6; font-size: 12px;
}
.wcbi-legend-item { display: flex; align-items: center; gap: 5px; color: #6b7280; }
.wcbi-legend-item::before { content: ''; display: inline-block; width: 18px; height: 18px; border-radius: 4px; border: 1px solid transparent; flex-shrink: 0; }
.wcbi-legend-available::before { background: #fff; border-color: #e5e7eb; }
.wcbi-legend-partial::before   { background: #fef3c7; border-color: #fde68a; }
.wcbi-legend-booked::before    { background: #fde047; border-color: #eab308; background-image: linear-gradient(to bottom right, transparent 45%, #713f12 45%, #713f12 55%, transparent 55%); }
.wcbi-legend-blocked::before   { background: #fecaca; border-color: #f87171; background-image: linear-gradient(to bottom right, transparent 45%, #b91c1c 45%, #b91c1c 55%, transparent 55%); }

/* jQuery UI fades disabled cells (opacity .35): keep red/yellow cross dates at full strength */
.ui-datepicker td.wcbi-booked-date.ui-state-disabled,
.ui-datepicker td.wcbi-blocked-date.ui-state-disabled { opacity: 1 !important; }

/* Force pointer-events off for all disabled date cells */
.ui-datepicker .wcbi-booked-date,
.ui-datepicker .wcbi-buffer-blocked-date,
.ui-datepicker .wcbi-blocked-date,
.ui-datepicker .wcbi-past-date { pointer-events: none !important; cursor: not-allowed !important; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 768px) {
    /* Applies to EVERY .ui-datepicker on mobile, not just .ui-datepicker-multi —
       on phones we force numberOfMonths to 1 (see frontend.js initMobile()),
       so the widget never actually gets the -multi class and this rule was
       silently never matching. Because it's plain CSS with !important, it
       always wins over jQuery UI's own inline position/top/left (which has
       no !important) the instant the element exists — no JS timing/race,
       so no flash of the old cut-off position before it snaps to center. */
    .ui-datepicker { width: 90vw !important; max-width: 360px !important; left: 50% !important; top: 50% !important; position: fixed !important; transform: translate(-50%,-50%) !important; margin: 0 !important; max-height: 90vh; overflow-y: auto; z-index: 999999 !important; }
    .ui-datepicker-group { width: 100% !important; float: none !important; }
    .ui-datepicker-calendar td a, .ui-datepicker-calendar td span { min-width: 36px; min-height: 36px; }
    .wcbi-date-input, .wcbi-select, input, button { font-size: 16px !important; }
}
@media (max-width: 480px) {
    .ui-datepicker-calendar th { font-size: 11px; }
    .ui-datepicker-calendar td a, .ui-datepicker-calendar td span { min-width: 30px; min-height: 30px; font-size: 12px; }
}

/* ===== v3.10 BOOKING CALENDAR SKIN – same clean orange look as the home "Check Availability" widget ===== */
.ui-datepicker.wcbi-bk-dp{border:0!important;border-radius:20px!important;padding:16px!important;background:#fff!important;box-shadow:0 28px 70px -24px rgba(14,42,71,.55)!important}
.ui-datepicker.wcbi-bk-dp[data-step]::before{content:attr(data-label);display:block;margin:-2px 0 10px;padding:9px 12px;border-radius:12px;background:#fff7ed;border:1px solid #fed7aa;color:#9a3412;font-size:13px;font-weight:800;text-align:center;line-height:1.25}
.wcbi-bk-dp .ui-datepicker-header{background:none!important;border:0!important;padding:2px 0 12px!important}
.wcbi-bk-dp .ui-datepicker-title{font-size:16px;font-weight:800;color:#0e2a47;line-height:2.1}
.wcbi-bk-dp .ui-datepicker-prev,.wcbi-bk-dp .ui-datepicker-next{top:4px!important;width:34px!important;height:34px!important;border-radius:50%!important;border:1px solid #d9e3ef!important;background:#fff!important;cursor:pointer}
.wcbi-bk-dp .ui-datepicker-prev:hover,.wcbi-bk-dp .ui-datepicker-next:hover{background:#f2f6fb!important}
.wcbi-bk-dp .ui-datepicker-prev{left:0!important}.wcbi-bk-dp .ui-datepicker-next{right:0!important}
.wcbi-bk-dp th{color:#8a98ab;font-weight:700;font-size:12px;padding:6px 0}
.wcbi-bk-dp td{padding:2px!important}
.wcbi-bk-dp td a,.wcbi-bk-dp td span{border-radius:10px!important;text-align:center!important;padding:9px 0!important;font-weight:600}

.wcbi-bk-dp .ui-datepicker-buttonpane{border:0!important;background:none!important;margin:8px 0 0!important;padding:0!important}
.wcbi-bk-dp .ui-datepicker-current{display:none!important}
.ui-datepicker.wcbi-bk-dp .ui-datepicker-buttonpane button.ui-datepicker-close{float:none!important;display:block;width:100%!important;margin:0!important;padding:10px!important;border-radius:12px!important;border:0!important;background:#0e2a47!important;color:#fff!important;font-weight:700!important;opacity:1!important;cursor:pointer}

/* flat available days (no boxes) */
.ui-datepicker.wcbi-bk-dp td.wcbi-available a{background:#fff!important;border-color:transparent!important;color:#0e2a47!important}
.ui-datepicker.wcbi-bk-dp td.wcbi-available a:hover{background:#fff1e6!important;border-color:transparent!important}
.ui-datepicker.wcbi-bk-dp td.ui-datepicker-today:not(.wcbi-range-edge):not(.wcbi-range-middle) a{background:#fff!important;border:1.5px solid #fdba74!important}

/* selected range: pick-up + return = solid orange, days in between = soft orange */
.ui-datepicker.wcbi-bk-dp td.wcbi-range-edge a,.ui-datepicker.wcbi-bk-dp td.wcbi-range-edge a:hover{background:#f97316!important;color:#fff!important;border-color:#ea580c!important;font-weight:800!important;
    flex-direction:column;line-height:1.15;box-shadow:0 6px 14px -6px rgba(234,88,12,.7)}
.ui-datepicker.wcbi-bk-dp td.wcbi-range-middle a{background:#ffedd5!important;color:#9a3412!important;border-color:#fed7aa!important}
.ui-datepicker.wcbi-bk-dp td.wcbi-range-edge a::after{display:block;margin-top:1px;white-space:nowrap;font-size:7.5px;line-height:1;font-weight:800;letter-spacing:.04em;text-transform:uppercase;opacity:.92}
.ui-datepicker.wcbi-bk-dp td.wcbi-bk-start a::after{content:"Pick-up"}
.ui-datepicker.wcbi-bk-dp td.wcbi-bk-end a::after{content:"Return"}
.ui-datepicker.wcbi-bk-dp td.wcbi-bk-start.wcbi-bk-end a::after{content:"Same day"}
.ui-datepicker.wcbi-bk-dp td.wcbi-range-edge a{padding:6px 0 5px!important}

/* ── Mobile: calendar = bottom sheet with dim backdrop ── */
@media (max-width:768px){
    .ui-datepicker.wcbi-bk-dp{position:fixed!important;left:0!important;right:0!important;bottom:0!important;top:auto!important;
        width:100%!important;max-width:none!important;box-sizing:border-box!important;transform:none!important;margin:0!important;max-height:92vh;overflow:auto;
        border-radius:22px 22px 0 0!important;padding:18px 14px calc(20px + env(safe-area-inset-bottom,0px))!important;
        box-shadow:0 0 0 100vmax rgba(14,42,71,.5)!important;z-index:999999!important}
    .ui-datepicker.wcbi-bk-dp table{width:100%;margin:0;table-layout:fixed}
    .wcbi-bk-dp td a,.wcbi-bk-dp td span{padding:12px 0!important;font-size:16px}
    .wcbi-bk-dp td.wcbi-range-edge a{padding:8px 0 7px!important}
    .ui-datepicker.wcbi-bk-dp[data-step]::before{font-size:13.5px;padding:10px 12px}
}
