/* ================================================================
   Camping Rental Manager — Public CSS
   Flatpickr custom theme + rental widget
   ================================================================ */

/* ── Flatpickr Custom Theme ─────────────────────────────────── */

/* Override Flatpickr calendar */
.flatpickr-calendar {
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0,0,0,.18) !important;
    border: none !important;
    font-family: inherit !important;
    overflow: hidden;
}

.flatpickr-months {
    background: #1e6fbf !important;
    padding: 6px 0;
    border-radius: 0 !important;
}

.flatpickr-month { color: #fff !important; }

.flatpickr-prev-month svg,
.flatpickr-next-month svg { fill: #fff !important; }

.flatpickr-prev-month:hover,
.flatpickr-next-month:hover { background: rgba(255,255,255,.15) !important; border-radius: 50% !important; }

.flatpickr-current-month {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #fff !important;
}

.flatpickr-current-month select { color: #fff !important; }
.flatpickr-current-month .numInputWrapper input { color: #fff !important; }

.flatpickr-weekdays { background: #f0f6ff !important; }
.flatpickr-weekday  { color: #1e6fbf !important; font-weight: 700 !important; font-size: 12px !important; }

/* Days grid */
.flatpickr-day {
    border-radius: 6px !important;
    font-size: 13px !important;
    height: 36px !important;
    line-height: 36px !important;
    margin: 1px !important;
    transition: background .15s, color .15s !important;
}

/* Available day hover */
.flatpickr-day.crm-day-avail:hover {
    background: #dbeafe !important;
    color: #1e3a8a !important;
    border-color: transparent !important;
}

/* Today */
.flatpickr-day.today {
    border-color: #1e6fbf !important;
    font-weight: 700 !important;
}

/* Selected start/end */
.flatpickr-day.crm-day-start,
.flatpickr-day.crm-day-end,
.flatpickr-day.selected {
    background: #1e6fbf !important;
    color: #fff !important;
    border-color: #1e6fbf !important;
    border-radius: 6px !important;
    font-weight: 700 !important;
}

.flatpickr-day.crm-day-start { border-radius: 6px 0 0 6px !important; }
.flatpickr-day.crm-day-end   { border-radius: 0 6px 6px 0 !important; }

/* Range between start and end */
.flatpickr-day.crm-day-range {
    background: #dbeafe !important;
    color: #1e3a8a !important;
    border-color: transparent !important;
    border-radius: 0 !important;
}

/* Hover preview range */
.flatpickr-day.crm-day-hover {
    background: #eff6ff !important;
    color: #1e3a8a !important;
    border-color: #bfdbfe !important;
}

/* Blocked / disabled days */
.flatpickr-day.crm-day-blocked,
.flatpickr-day.flatpickr-disabled {
    background: #fee2e2 !important;
    color: #f87171 !important;
    text-decoration: line-through !important;
    cursor: not-allowed !important;
    opacity: .8 !important;
    border-color: transparent !important;
}

.flatpickr-day.flatpickr-disabled:hover {
    background: #fecaca !important;
    color: #dc2626 !important;
}

/* ── Rental Widget ───────────────────────────────────────────── */

.crm-rental-fields {
    background: linear-gradient(135deg, #f0f6ff 0%, #fafafa 100%);
    border: 1px solid #bfdbfe;
    border-radius: 14px;
    padding: 22px 24px;
    margin: 18px 0 22px;
    box-shadow: 0 2px 12px rgba(30, 111, 191, .08);
}

.crm-rental-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.crm-rental-icon { font-size: 22px; }

.crm-rental-header h4 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #1e3a8a;
}

/* Stock badge */
.crm-stock-badge {
    margin-bottom: 14px;
}

.crm-stock-ok {
    background: #d1fae5;
    color: #065f46;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.crm-stock-low {
    background: #fef3c7;
    color: #92400e;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    animation: crm-pulse 2s infinite;
}

@keyframes crm-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .7; }
}

/* Date row layout */
.crm-date-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.crm-date-group {
    flex: 1;
    min-width: 160px;
}

.crm-date-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.crm-label-icon { font-size: 15px; }

.crm-input-wrap {
    position: relative;
}

.crm-input-wrap input {
    width: 100%;
    padding: 10px 38px 10px 14px;
    border: 2px solid #bfdbfe;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
    color: #111;
}

.crm-input-wrap input:focus,
.crm-input-wrap input.active {
    border-color: #1e6fbf;
    box-shadow: 0 0 0 3px rgba(30, 111, 191, .15);
    outline: none;
}

.crm-input-wrap input::placeholder { color: #9ca3af; }

.crm-input-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    pointer-events: none;
}

.crm-date-arrow {
    font-size: 22px;
    color: #6b7280;
    padding-bottom: 10px;
    flex-shrink: 0;
}

/* Legend */
.crm-legend-inline {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.crm-leg {
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 12px;
    font-weight: 600;
}

.crm-leg-avail    { background: #d1fae5; color: #065f46; }
.crm-leg-blocked  { background: #fee2e2; color: #991b1b; }
.crm-leg-selected { background: #1e6fbf; color: #fff; }
.crm-leg-range    { background: #dbeafe; color: #1e3a8a; }

/* Price summary */
.crm-price-summary {
    background: #fff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 14px 18px;
    margin-top: 16px;
}

.crm-summary-line {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #374151;
    padding: 3px 0;
}

.crm-summary-label { color: #6b7280; }

.crm-summary-total {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid #e5e7eb;
    margin-top: 8px;
    padding-top: 8px;
    font-size: 16px;
    font-weight: 700;
    color: #1e3a8a;
}

.crm-summary-amount {
    font-size: 20px;
    color: #1e6fbf;
}

/* Dynamic total in WC price area */
.crm-dynamic-total {
    font-size: 14px;
    color: #6b7280;
    margin-top: 4px;
    border-top: 1px dashed #e5e7eb;
    padding-top: 6px;
}

.crm-total-val { color: #1e6fbf; font-size: 18px; }

/* Live availability message */
.crm-avail-live {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    display: none;
}

.crm-live-ok      { background: #d1fae5; color: #065f46; display: block !important; }
.crm-live-error   { background: #fee2e2; color: #991b1b; display: block !important; }
.crm-live-warn    { background: #fef3c7; color: #92400e; display: block !important; }
.crm-live-loading { background: #f3f4f6; color: #374151; display: block !important; }

/* Add to cart disabled state */
button.single_add_to_cart_button.crm-btn-disabled {
    opacity: .5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Availability Checker Shortcode ────────────────────────── */

.crm-avail-checker {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.crm-avail-checker h4 {
    margin: 0 0 14px;
    font-size: 16px;
    color: #1e3a8a;
}

.crm-avail-date-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 10px;
}

.crm-avail-date-group { flex: 1; min-width: 140px; }
.crm-avail-date-group label { font-size: 12px; font-weight: 600; color: #6b7280; display: block; margin-bottom: 4px; }

.crm-avail-start-fp,
.crm-avail-end-fp {
    width: 100%;
    padding: 9px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    box-sizing: border-box;
}

.crm-avail-start-fp:focus,
.crm-avail-end-fp:focus { border-color: #1e6fbf; outline: none; }

.crm-avail-qty {
    width: 70px;
    padding: 9px 8px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
}

.crm-avail-btn {
    padding: 10px 20px;
    background: #1e6fbf;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
    flex-shrink: 0;
}

.crm-avail-btn:hover { background: #155da1; }

.crm-avail-result {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    display: none;
}

.crm-avail-ok      { background: #d1fae5; color: #065f46; display: block !important; }
.crm-avail-error   { background: #fee2e2; color: #991b1b; display: block !important; }
.crm-avail-warn    { background: #fef3c7; color: #92400e; display: block !important; }
.crm-avail-loading { background: #f3f4f6; color: #374151; display: block !important; }

/* ── Mini Calendar (shortcode) ─────────────────────────────── */

.crm-mini-calendar {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    margin: 20px 0;
    max-width: 360px;
}

.crm-mini-cal-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.crm-mini-cal-nav button {
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    width: 30px; height: 30px;
    font-size: 18px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    line-height: 1;
    transition: background .15s;
}

.crm-mini-cal-nav button:hover { background: #f0f6ff; }

.crm-mini-cal-title { font-weight: 700; font-size: 15px; color: #1e3a8a; }

.crm-mini-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.crm-mini-cal-head {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #9ca3af;
    padding: 4px 2px;
}

.crm-mini-cal-day {
    text-align: center;
    padding: 7px 2px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: default;
    transition: transform .1s;
}

.crm-mini-cal-day.available {
    background: #d1fae5;
    color: #065f46;
}

.crm-mini-cal-day.available:hover { transform: scale(1.1); }

.crm-mini-cal-day.blocked {
    background: #fee2e2;
    color: #dc2626;
    text-decoration: line-through;
    opacity: .8;
}

.crm-mini-cal-day.today {
    border: 2px solid #1e6fbf !important;
    font-weight: 800;
}

.crm-mini-cal-day.empty { background: transparent; }

.crm-mini-cal-legend {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    font-size: 12px;
}

.crm-mini-leg { font-weight: 600; display: flex; align-items: center; gap: 4px; }
.crm-mini-leg.available { color: #065f46; }
.crm-mini-leg.blocked   { color: #dc2626; }

/* ── Pack Card ─────────────────────────────────────────────── */

.crm-pack-card {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    margin: 20px 0;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
}

.crm-pack-image img { width: 100%; display: block; }
.crm-pack-title { padding: 18px 22px 0; font-size: 22px; margin: 0; color: #111; }
.crm-pack-desc  { padding: 10px 22px; color: #6b7280; }

.crm-pack-contents {
    padding: 12px 22px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.crm-pack-contents h4 { margin: 0 0 8px; color: #374151; }
.crm-pack-contents ul { margin: 0; padding-left: 18px; }
.crm-pack-contents li { margin-bottom: 4px; font-size: 14px; }
.crm-pack-qty { color: #9ca3af; font-size: 12px; }

.crm-pack-price {
    padding: 14px 22px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 10px;
}

.crm-price-amount  { font-size: 30px; font-weight: 800; color: #1e6fbf; }
.crm-price-unit    { color: #9ca3af; font-size: 14px; }
.crm-price-discount { background: #d1fae5; color: #065f46; padding: 3px 10px; border-radius: 20px; font-size: 13px; font-weight: 700; }

.crm-pack-dates {
    padding: 18px 22px;
    border-top: 1px solid #e5e7eb;
}

.crm-pack-dates label { font-size: 13px; font-weight: 600; color: #374151; display: block; margin-bottom: 5px; }

.crm-pack-dates input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 12px;
    box-sizing: border-box;
}

.crm-pack-total-info { font-weight: 700; color: #1e6fbf; font-size: 15px; margin-top: 4px; }

.crm-pack-book {
    display: block;
    width: calc(100% - 44px);
    margin: 0 22px 22px;
    padding: 14px;
    background: linear-gradient(135deg, #1e6fbf, #1e3a8a);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: opacity .2s, transform .1s;
    letter-spacing: .3px;
}

.crm-pack-book:hover { opacity: .9; transform: translateY(-1px); color: #fff; }

/* ── Responsive ─────────────────────────────────────────────── */

@media (max-width: 520px) {
    .crm-date-row { flex-direction: column; gap: 10px; }
    .crm-date-arrow { display: none; }
    .crm-date-group { min-width: 100%; }
    .crm-legend-inline { display: none; }
}
