/* 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: #fee2e2 !important; color: #b91c1c !important;
    text-decoration: line-through !important; border-color: #fca5a5 !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 {
    background: #f3f4f6 !important; color: #9ca3af !important;
    text-decoration: line-through !important; border-color: #d1d5db !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: #fee2e2; border-color: #fca5a5; background-image: linear-gradient(to bottom right, transparent 45%, #b91c1c 45%, #b91c1c 55%, transparent 55%); }
.wcbi-legend-blocked::before   { background: #f3f4f6; border-color: #d1d5db; background-image: linear-gradient(to bottom right, transparent 45%, #9ca3af 45%, #9ca3af 55%, transparent 55%); }

/* 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; }
}