/**
 * KR Prenotazioni — Stile frontend form di prenotazione
 *
 * Utilizza la variabile CSS --krp-main-color (impostata inline dal PHP).
 */

/* ============================================================
   Wrapper generale
   ============================================================ */

.krp-form {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    max-width: 700px;
    margin: 0 auto;
}

.krp-form *,
.krp-form *::before,
.krp-form *::after {
    box-sizing: border-box;
}

/* ============================================================
   Progress tracker (barra a step)
   ============================================================ */

.krp-progress-tracker.krp-table {
    display: table;
    width: 100%;
    table-layout: fixed;
    margin-bottom: 20px;
    border-collapse: collapse;
}

.krp-progress-tracker > div {
    display: table-cell;
    text-align: center;
    padding: 12px 4px 8px;
    font-size: 13px;
    font-weight: 600;
    color: #999;
    vertical-align: middle;
    position: relative;
}

.krp-progress-tracker > div span {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    border-radius: 50%;
    background: #ddd;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    margin-right: 2px;
}

.krp-progress-tracker > div .step {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #ddd;
}

/* Stato attivo */
.krp-progress-tracker > div.active {
    color: var(--krp-main-color);
}

.krp-progress-tracker > div.active span {
    background: var(--krp-main-color);
}

.krp-progress-tracker > div.active .step {
    background: var(--krp-main-color);
}

/* Stato completato */
.krp-progress-tracker > div.completed {
    color: #666;
}

.krp-progress-tracker > div.completed span {
    background: var(--krp-main-color);
    opacity: 0.6;
}

.krp-progress-tracker > div.completed .step {
    background: var(--krp-main-color);
    opacity: 0.6;
}

/* ============================================================
   Box container
   ============================================================ */

.krp-box {
    padding: 20px;
}

/* ============================================================
   Form elements
   ============================================================ */

.krp-form select,
.krp-form input[type="text"],
.krp-form input[type="email"],
.krp-form input[type="tel"],
.krp-form textarea {
    font-family: inherit;
    font-size: 14px;
    border: 1px solid silver;
    border-radius: 4px;
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}

.krp-form select:focus,
.krp-form input[type="text"]:focus,
.krp-form input[type="email"]:focus,
.krp-form input[type="tel"]:focus,
.krp-form textarea:focus {
    border-color: var(--krp-main-color);
}

.krp-form label {
    font-size: 14px;
    display: block;
    margin-bottom: 4px;
    color: #333;
    font-weight: 600;
}

.krp-form .krp-row {
    margin-bottom: 14px;
}

/* ============================================================
   Bottoni
   ============================================================ */

.krp-btn {
    font-family: inherit;
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 9px 18px;
    border: none;
    border-radius: 4px;
    background: var(--krp-main-color);
    color: #fff;
    cursor: pointer;
    transition: opacity 0.2s;
    line-height: 1.4;
}

.krp-btn:hover {
    opacity: 0.85;
}

.krp-btn:disabled {
    background: #ccc;
    cursor: default;
    opacity: 1;
}

.krp-back-step {
    background: #999;
}

.krp-back-step:hover {
    opacity: 0.85;
}

/* ============================================================
   Navigazione step
   ============================================================ */

.krp-nav-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.krp-nav-steps .krp-back-step {
    margin-right: auto;
}

.krp-nav-steps .krp-next-step {
    margin-left: auto;
}

/* ============================================================
   Info servizio
   ============================================================ */

.krp-service-info {
    font-size: 13px;
    font-style: italic;
    color: #666;
    padding: 8px 12px;
    border-left: 3px solid var(--krp-main-color);
    background: #f9f9f9;
    margin-top: 10px;
}

/* ============================================================
   Calendario
   ============================================================ */

.krp-calendar {
    width: 100%;
}

.krp-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.krp-calendar-header .krp-calendar-title {
    font-size: 16px;
    font-weight: 700;
    color: #333;
}

.krp-calendar-nav {
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 16px;
    cursor: pointer;
    color: #333;
    line-height: 1;
    transition: border-color 0.2s;
}

.krp-calendar-nav:hover {
    border-color: var(--krp-main-color);
    color: var(--krp-main-color);
}

.krp-calendar-nav:disabled {
    color: #ccc;
    border-color: #eee;
    cursor: default;
}

.krp-calendar table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.krp-calendar th {
    text-align: center;
    padding: 8px 4px;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    border-bottom: 1px solid #eee;
}

.krp-calendar td {
    text-align: center;
    padding: 0;
    height: 40px;
    vertical-align: middle;
    font-size: 14px;
}

.krp-calendar td .krp-day {
    display: inline-block;
    width: 36px;
    height: 36px;
    line-height: 36px;
    text-align: center;
    border-radius: 50%;
    transition: all 0.15s;
}

.krp-calendar td.available .krp-day {
    cursor: pointer;
    color: #333;
}

.krp-calendar td.available .krp-day:hover {
    border: 2px solid var(--krp-main-color);
    line-height: 32px;
}

.krp-calendar td.selected .krp-day {
    background: var(--krp-main-color);
    color: #fff;
}

.krp-calendar td.unavailable .krp-day {
    color: #ccc;
    cursor: default;
}

.krp-calendar td.past .krp-day {
    color: #ccc;
    cursor: default;
}

.krp-calendar td.empty {
    /* cella vuota di riempimento */
}

/* ============================================================
   Slot orari
   ============================================================ */

.krp-time-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.krp-slot {
    display: inline-block;
    height: 36px;
    min-width: 80px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin: 0;
    text-align: center;
    line-height: 34px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
    background: #fff;
    color: #333;
    padding: 0 12px;
}

.krp-slot:hover {
    border: 2px solid var(--krp-main-color);
    line-height: 32px;
}

.krp-slot.selected {
    background: var(--krp-main-color);
    color: #fff;
    border-color: var(--krp-main-color);
}

.krp-slot.disabled {
    opacity: 0.4;
    cursor: default;
    border-color: #ccc;
}

.krp-slot.disabled:hover {
    border: 1px solid #ccc;
    line-height: 34px;
}

.krp-no-slots {
    font-size: 14px;
    color: #999;
    text-align: center;
    padding: 20px;
    width: 100%;
}

/* ============================================================
   Step 4 — Dati richiedente
   ============================================================ */

.krp-details-step .krp-field {
    margin-bottom: 12px;
}

.krp-details-step .krp-field label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    display: block;
    margin-bottom: 4px;
}

.krp-details-step .krp-field label .krp-required {
    color: #c00;
    margin-left: 2px;
}

.krp-label-error {
    font-size: 12px;
    font-weight: 700;
    color: #c00;
    display: block;
    margin-top: 2px;
}

.krp-form input.krp-input-error,
.krp-form textarea.krp-input-error {
    border-color: #c00;
}

/* ============================================================
   Step 5 — Conferma / Riepilogo
   ============================================================ */

.krp-confirmation {
    text-align: center;
    padding: 10px 0;
}

.krp-summary {
    text-align: left;
    margin: 0 auto 20px;
    max-width: 400px;
}

.krp-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.krp-summary-row .krp-summary-label {
    font-weight: 600;
    color: #666;
    flex: 0 0 120px;
}

.krp-summary-row .krp-summary-value {
    color: #333;
    text-align: right;
}

.krp-confirm-btn-wrap {
    text-align: center;
    margin-top: 20px;
}

.krp-confirm-btn-wrap .krp-btn {
    font-size: 16px;
    padding: 12px 30px;
}

/* Successo */
.krp-success {
    text-align: center;
    padding: 30px 20px;
}

.krp-success-icon {
    font-size: 48px;
    color: #27ae60;
    margin-bottom: 10px;
}

.krp-success h3 {
    font-size: 20px;
    color: #27ae60;
    margin: 0 0 10px;
}

.krp-success p {
    font-size: 14px;
    color: #666;
    margin: 4px 0;
}

.krp-success .krp-booking-code {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    background: #f5f5f5;
    display: inline-block;
    padding: 6px 16px;
    border-radius: 4px;
    margin-top: 8px;
    letter-spacing: 1px;
}

/* Errore slot */
.krp-error-message {
    color: #c00;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    padding: 10px;
    margin-bottom: 10px;
    background: #fff0f0;
    border-radius: 4px;
}

/* ============================================================
   Step Disability — Domanda Disability Card
   ============================================================ */

.krp-disability-step h3 {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin: 0 0 8px;
}

.krp-disability-step p {
    font-size: 14px;
    color: #555;
    margin-bottom: 16px;
}

.krp-disability-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.krp-disability-buttons .krp-btn {
    font-size: 14px;
    text-transform: none;
}

.krp-disability-fields label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    display: block;
    margin-bottom: 4px;
}

.krp-disability-fields .krp-required {
    color: #c00;
    margin-left: 2px;
}

.krp-disability-fields input[type="text"] {
    font-family: inherit;
    font-size: 14px;
    border: 1px solid silver;
    border-radius: 4px;
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}

.krp-disability-fields input[type="text"]:focus {
    border-color: var(--krp-main-color);
}

.krp-disability-fields input[type="file"] {
    font-family: inherit;
    font-size: 14px;
}

/* Slot riservato disabili */
.krp-slot.krp-slot-reserved {
    border-color: var(--krp-main-color);
    border-style: dashed;
}

.krp-slot-badge {
    font-size: 12px;
    vertical-align: middle;
}

/* ============================================================
   Step 0 — Card selezione luogo (multi-servizio)
   ============================================================ */

.krp-step-location h3 {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin: 0 0 4px;
    padding: 0 20px;
}

.krp-location-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin: 20px 0;
    padding: 0 20px;
}

.krp-location-card {
    border: 2px solid var(--krp-border, #dee2e6);
    border-radius: 12px;
    padding: 24px;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s;
    background: #fff;
}

.krp-location-card:hover {
    border-color: var(--krp-main-color, #0066CC);
    box-shadow: 0 2px 8px rgba(0,102,204,.15);
}

.krp-location-card.selected {
    border-color: var(--krp-main-color, #0066CC);
    background: var(--krp-main-light, #e8f0fa);
}

.krp-location-card h4 {
    margin: 0 0 8px;
    font-size: 16px;
    color: #333;
}

.krp-location-card p {
    margin: 0;
    color: #6b7785;
    font-size: 14px;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 768px) {
    .krp-progress-tracker.krp-table {
        display: flex;
        flex-wrap: wrap;
    }

    .krp-progress-tracker > div {
        display: block;
        flex: 1 1 auto;
        padding: 8px 2px 6px;
        font-size: 11px;
    }

    .krp-progress-tracker > div span {
        width: 20px;
        height: 20px;
        line-height: 20px;
        font-size: 10px;
    }

    .krp-time-slots {
        justify-content: center;
    }

    .krp-slot {
        flex: 1 1 calc(33% - 8px);
        min-width: 70px;
    }

    .krp-summary-row {
        flex-direction: column;
    }

    .krp-summary-row .krp-summary-value {
        text-align: left;
    }

    .krp-nav-steps {
        padding: 15px;
    }

    .krp-btn {
        font-size: 15px;
        padding: 8px 14px;
    }
}
