/* ==========================================================
 *  GF Schedule Field – Front-end Styles
 *  Uses CSS custom properties for dynamic per-field theming.
 *  High-specificity selectors to override theme / GF defaults.
 * ========================================================== */

/* ── Container ─────────────────────────────────────────── */
.ginput_container.ginput_container_schedule {
    --gf-slot-color: #0073aa;
    --gf-slot-hover-color: #005f8d;
    --gf-slot-gap: 10px;
    --gf-label-spacing: 10px;

    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    padding: 8px 0;
}

.ginput_container_schedule .gf_schedule_date_wrap,
.ginput_container_schedule .gf_schedule_time_wrap {
    flex: 1 1 200px;
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
}

/* ── Sub-labels ────────────────────────────────────────── */
.ginput_container_schedule .gf_schedule_sub_label {
    display: block;
    margin-bottom: var(--gf-label-spacing, 10px) !important;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    letter-spacing: 0.02em;
}

/* ══════════════════════════════════════════════════════════
 *  Date Input – targets BOTH the original hidden input
 *  AND the Flatpickr alt input that replaces it visually.
 *  Flatpickr adds class "flatpickr-input" to the alt input
 *  and keeps our original class on the hidden input.
 * ══════════════════════════════════════════════════════════ */
.ginput_container_schedule .gf_schedule_date,
.ginput_container_schedule .gf_schedule_date_wrap input.flatpickr-input {
    width: 100% !important;
    padding: 12px 44px 12px 16px !important;
    font-size: 15px !important;
    line-height: 1.5 !important;
    color: #1e1e1e !important;
    background-color: #fff !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 20px 20px !important;
    border: 1.5px solid #d0d5dd !important;
    border-radius: 10px !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.15s ease !important;
    box-sizing: border-box !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    cursor: pointer !important;
    margin: 0 !important;
    height: auto !important;
}

.ginput_container_schedule .gf_schedule_date:hover,
.ginput_container_schedule .gf_schedule_date_wrap input.flatpickr-input:hover {
    border-color: #98a2b3 !important;
    background-color: #f9fafb !important;
}

.ginput_container_schedule .gf_schedule_date:focus,
.ginput_container_schedule .gf_schedule_date_wrap input.flatpickr-input:focus,
.ginput_container_schedule .gf_schedule_date_wrap input.flatpickr-input.active {
    outline: none !important;
    border-color: var(--gf-slot-color, #0073aa) !important;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.12) !important;
    background-color: #fff !important;
}

.ginput_container_schedule .gf_schedule_date::placeholder,
.ginput_container_schedule .gf_schedule_date_wrap input.flatpickr-input::placeholder {
    color: #98a2b3 !important;
    font-weight: 400 !important;
}

/* ── Time Slot Grid ────────────────────────────────────── */
.ginput_container_schedule .gf_schedule_time_grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)) !important;
    gap: var(--gf-slot-gap, 10px) !important;
    margin-top: 4px;
}

/* ══════════════════════════════════════════════════════════
 *  Time Slot Buttons
 *  High specificity + !important to override theme defaults
 *  for <button> elements.
 * ══════════════════════════════════════════════════════════ */
.ginput_container_schedule .gf_schedule_time_grid button.gf_schedule_slot {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 10px 8px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #374151 !important;
    background: #f9fafb !important;
    border: 1.5px solid #d1d5db !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    user-select: none !important;
    text-align: center !important;
    line-height: 1.3 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    outline: none !important;
    min-height: auto !important;
    margin: 0 !important;
    width: auto !important;
}

/* ── Hover ─────────────────────────────────────────────── */
.ginput_container_schedule .gf_schedule_time_grid button.gf_schedule_slot:hover:not(.gf_schedule_slot--booked) {
    background: #e8f4fd !important;
    border-color: var(--gf-slot-hover-color, #005f8d) !important;
    color: var(--gf-slot-hover-color, #005f8d) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

/* ── Active / Selected Slot ────────────────────────────── */
.ginput_container_schedule .gf_schedule_time_grid button.gf_schedule_slot.gf_schedule_slot--active,
.ginput_container_schedule .gf_schedule_time_grid button.gf_schedule_slot.gf_schedule_slot--active:hover {
    background: var(--gf-slot-color, #0073aa) !important;
    border-color: var(--gf-slot-color, #0073aa) !important;
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2) !important;
    transform: translateY(-1px) !important;
}

/* ── Booked / Unavailable Slot ─────────────────────────── */
.ginput_container_schedule .gf_schedule_time_grid button.gf_schedule_slot.gf_schedule_slot--booked,
.ginput_container_schedule .gf_schedule_time_grid button.gf_schedule_slot.gf_schedule_slot--booked:hover {
    background: #f3f4f6 !important;
    border-color: #e5e7eb !important;
    color: #9ca3af !important;
    cursor: not-allowed !important;
    text-decoration: line-through !important;
    opacity: 0.6 !important;
    transform: none !important;
    box-shadow: none !important;
}

/* ── Loading / No Slots Messages ───────────────────────── */
.ginput_container_schedule .gf_schedule_loading,
.ginput_container_schedule .gf_schedule_no_slots {
    font-size: 14px;
    color: #6b7280;
    padding: 12px 0;
    font-style: italic;
}

/* ══════════════════════════════════════════════════════════
 *  Flatpickr Calendar Popup Overrides
 * ══════════════════════════════════════════════════════════ */
.flatpickr-calendar {
    border-radius: 12px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    border: 1px solid #e5e7eb !important;
    overflow: hidden;
}

.flatpickr-months {
    border-radius: 12px 12px 0 0;
    background: #f9fafb;
    padding: 4px 0;
}

.flatpickr-months .flatpickr-month {
    height: 40px;
}

.flatpickr-current-month {
    font-size: 14px;
    font-weight: 600;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover {
    background: var(--gf-slot-color, #0073aa) !important;
    border-color: var(--gf-slot-color, #0073aa) !important;
    color: #fff !important;
}

.flatpickr-day:hover {
    background: #e8f2f8 !important;
    border-color: #e8f2f8 !important;
}

.flatpickr-day.today {
    border-color: var(--gf-slot-color, #0073aa) !important;
}

.flatpickr-day.today:hover {
    background: var(--gf-slot-color, #0073aa) !important;
    color: #fff !important;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 600px) {
    .ginput_container.ginput_container_schedule {
        flex-direction: column;
        gap: 20px;
    }

    .ginput_container_schedule .gf_schedule_date_wrap,
    .ginput_container_schedule .gf_schedule_time_wrap {
        flex: 1 1 100%;
    }

    .ginput_container_schedule .gf_schedule_time_grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)) !important;
    }

    .ginput_container_schedule .gf_schedule_time_grid button.gf_schedule_slot {
        padding: 8px 6px !important;
        font-size: 13px !important;
    }
}