/* ============================================================
   iWeb AI Chat — Booking Widget v1.4.1
   ============================================================ */

/* --- Outer wrapper ----------------------------------------- */
.iweb-booking-calendar {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin: 8px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 100%;
}

/* --- Month header ------------------------------------------ */
.iweb-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 2px;
}

.iweb-calendar-month {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
}

.iweb-calendar-nav-btn {
    background: transparent;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    color: #6b7280;
    transition: background 0.15s;
}

.iweb-calendar-nav-btn:hover:not(:disabled) {
    background: #f3f4f6;
    color: #111827;
}

.iweb-calendar-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* --- Weekday row (Su Mo Tu We Th Fr Sa) -------------------- */
/* CRITICAL: separate <div> from the days grid so they can scroll independently */
.iweb-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 4px;
}

.iweb-calendar-weekday {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    padding: 4px 0;
    letter-spacing: 0.04em;
}

/* --- Days grid --------------------------------------------- */
.iweb-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.iweb-calendar-day {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    background: transparent;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    user-select: none;
    padding: 0;
    min-width: 0;
}

.iweb-calendar-day:hover:not(.is-disabled):not(.is-selected):not(.is-other-month) {
    background: #f3f4f6;
    border-color: #e5e7eb;
}

.iweb-calendar-day.is-today {
    font-weight: 700;
    color: #E11D48;
}

.iweb-calendar-day.is-selected {
    background: #E11D48 !important;
    color: #fff !important;
    font-weight: 600;
    border-color: #E11D48 !important;
}

.iweb-calendar-day.is-disabled {
    color: #d1d5db;
    cursor: not-allowed;
}

.iweb-calendar-day.is-other-month {
    color: #e5e7eb;
    pointer-events: none;
}

/* --- Time slots -------------------------------------------- */
.iweb-time-slots {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #f3f4f6;
}

.iweb-time-slots-title {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 8px;
}

.iweb-time-slots-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.iweb-time-slot {
    padding: 9px 4px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.12s;
    text-align: center;
    line-height: 1.2;
}

.iweb-time-slot:hover:not(.is-disabled):not(.is-selected) {
    border-color: #E11D48;
    color: #E11D48;
    background: #FFF1F2;
}

/* CRITICAL: selected state for time slots */
.iweb-time-slot.is-selected {
    background: #E11D48 !important;
    border-color: #E11D48 !important;
    color: #fff !important;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(225, 29, 72, 0.25);
}

.iweb-time-slot.is-disabled {
    background: #f9fafb;
    color: #d1d5db;
    cursor: not-allowed;
    border-color: #f3f4f6;
}

/* --- Booking form ------------------------------------------ */
.iweb-booking-form-wrap {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #f3f4f6;
}

.iweb-booking-form-wrap h4 {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 10px;
}

.iweb-booking-form-wrap input,
.iweb-booking-form-wrap textarea {
    width: 100%;
    padding: 9px 12px;
    margin-bottom: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    color: #111827;
    box-sizing: border-box;
    transition: border-color 0.12s;
    background: #fff;
}

.iweb-booking-form-wrap input:focus,
.iweb-booking-form-wrap textarea:focus {
    outline: none;
    border-color: #E11D48;
    box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.08);
}

.iweb-booking-form-wrap textarea {
    resize: none;
    min-height: 72px;
}

.iweb-booking-form-error {
    color: #dc2626;
    font-size: 12px;
    margin-bottom: 8px;
    display: none;
}

/* Lead summary card (pre-filled mode) */
.iweb-booking-summary {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 12px;
}

.iweb-booking-summary .summary-label {
    font-size: 10px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 3px;
}

.iweb-booking-summary .summary-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.iweb-booking-summary .summary-contact {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.iweb-booking-summary .summary-edit {
    display: inline-block;
    margin-top: 6px;
    font-size: 12px;
    color: #E11D48;
    text-decoration: none;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.iweb-booking-summary .summary-edit:hover {
    text-decoration: underline;
}

/* Confirm button */
.iweb-btn-confirm {
    width: 100%;
    padding: 11px;
    background: #E11D48;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 4px;
}

.iweb-btn-confirm:hover:not(:disabled) {
    background: #BE123C;
}

.iweb-btn-confirm:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Confirmed state */
.iweb-booking-confirmed {
    text-align: center;
    padding: 16px 8px;
}

.iweb-booking-confirmed .confirm-icon {
    font-size: 30px;
    margin-bottom: 8px;
}

.iweb-booking-confirmed .confirm-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 4px;
}

.iweb-booking-confirmed .confirm-sub {
    font-size: 13px;
    color: #6b7280;
}

/* --- Staff grid (multi-provider) --------------------------- */
.iweb-staff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    margin: 4px 0;
}

.iweb-staff-card {
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    background: #fff;
}

.iweb-staff-card:hover {
    border-color: #E11D48;
    background: #FFF1F2;
}

.iweb-staff-card img,
.iweb-staff-initial {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 8px;
    display: block;
}

.iweb-staff-initial {
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #6b7280;
}

.iweb-staff-card h5 {
    margin: 0 0 2px;
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

.iweb-staff-card p {
    margin: 0;
    font-size: 11px;
    color: #6b7280;
}

/* --- Proactive offer actions ------------------------------- */
.iweb-bot-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.iweb-bot-action {
    padding: 7px 14px;
    border-radius: 18px;
    border: 1.5px solid #E11D48;
    background: #fff;
    color: #E11D48;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1;
}

.iweb-bot-action.is-primary {
    background: #E11D48;
    color: #fff;
}

.iweb-bot-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(225, 29, 72, 0.2);
}

/* --- Staff subtitle en el resumen (Nombre — Título) -------- */
.iweb-staff-subtitle {
    color: #6b7280;
    font-weight: 400;
    font-size: 11px;
}

/* --- Date/time summary card (encima del form adaptativo) --- */
.iweb-booking-summary-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: linear-gradient(135deg, #FFF1F2, #FFE4E9);
    border-radius: 10px;
    margin-bottom: 12px;
    border-left: 3px solid #E11D48;
}

.iweb-summary-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.iweb-summary-text {
    flex: 1;
    font-size: 13px;
    line-height: 1.5;
}

.iweb-summary-line {
    color: #881337;
}

.iweb-summary-line strong {
    color: #9F1239;
    font-weight: 600;
}

/* --- Mobile ------------------------------------------------ */
@media (max-width: 480px) {
    .iweb-time-slots-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .iweb-calendar-day {
        font-size: 12px;
    }
    .iweb-staff-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
