/**
 * ITER Rental Widget styles.
 * Reproduces the "Riepilogo dell'ordine" design (Noleggio Fast).
 */

.iter-rental-widget,
.iter-rental-confirmation,
.iter-rental-enquiry {
    --ir-red: #c1122e;
    --ir-red-dark: #a30f26;
    --ir-ink: #16232b;
    --ir-navy: #102a43;
    --ir-muted: #8a929a;
    --ir-muted-2: #6b7785;
    --ir-box: #f2f2f3;
    --ir-box-border: #ededee;
    --ir-line: #e3e3e5;
    --ir-ok: #1e9e57;
    --ir-ok-dark: #187f46;
    --ir-warn: #d98300;
    --ir-avail: #8fcf9b;
    --ir-avail-hover: #7cc48a;
    --ir-avail-strong: #3aa05c;
    --ir-day-off: #c4c9ce;
    font-family: inherit;
    color: var(--ir-ink);
    line-height: 1.4;
}

.iter-rental-widget *,
.iter-rental-confirmation *,
.iter-rental-enquiry * {
    box-sizing: border-box;
}

/* Card --------------------------------------------------------------- */
.iter-rental-widget .ir-card,
.iter-rental-confirmation .ir-card,
.iter-rental-enquiry .ir-card {
    background: #fff;
    border: 1px solid var(--ir-line);
    border-radius: 16px;
    box-shadow: 0 10px 34px rgba(22, 35, 43, .07);
    padding: 28px;
}

/* States ------------------------------------------------------------- */
.ir-state-loading,
.ir-confirm-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ir-muted-2);
    padding: 12px 0;
}

.ir-state-error {
    text-align: center;
    padding: 12px 0;
}

.ir-error-msg {
    color: var(--ir-red-dark);
    margin-bottom: 12px;
}

.ir-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid var(--ir-line);
    border-top-color: var(--ir-red);
    border-radius: 50%;
    animation: ir-spin .8s linear infinite;
    flex: 0 0 auto;
}

@keyframes ir-spin {
    to { transform: rotate(360deg); }
}

/* Header ------------------------------------------------------------- */
.ir-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 22px;
}

.ir-card-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--ir-ink);
    margin: 0 0 2px;
    letter-spacing: -.01em;
}

.ir-model-name {
    margin: 0;
    font-size: .95rem;
    font-weight: 600;
    color: var(--ir-muted-2);
}

.ir-price-from {
    text-align: right;
    white-space: nowrap;
}

.ir-online-badge {
    display: inline-block;
    margin-bottom: 6px;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--ir-red);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .01em;
}

.ir-online-badge[hidden] {
    display: none;
}

.ir-price-from-label {
    display: block;
    font-size: .68rem;
    color: var(--ir-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.ir-price-from-value {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--ir-navy);
}

/* Wizard: dot step indicator ----------------------------------------- */
.ir-steps {
    display: flex;
    list-style: none;
    margin: 0 0 24px;
    padding: 0;
}

.ir-step-dot {
    position: relative;
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    font-size: .72rem;
    color: var(--ir-muted);
    text-align: center;
}

/* Connecting line between dots (sits behind, drawn to the left). */
.ir-step-dot::before {
    content: "";
    position: absolute;
    top: 8px;
    right: 50%;
    width: 100%;
    height: 2px;
    background: var(--ir-line);
    z-index: 0;
}

.ir-step-dot:first-child::before {
    display: none;
}

.ir-step-dot.is-active::before,
.ir-step-dot.is-done::before {
    background: var(--ir-red);
}

.ir-dot {
    position: relative;
    z-index: 1;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--ir-line);
    background: #fff;
    box-sizing: border-box;
    transition: background .15s, border-color .15s, box-shadow .15s;
}

.ir-step-dot.is-done .ir-dot {
    border-color: var(--ir-red);
    background: var(--ir-red);
}

/* Checkmark inside completed dots. */
.ir-step-dot.is-done .ir-dot::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.ir-step-dot.is-active .ir-dot {
    border-color: var(--ir-red);
    background: var(--ir-red);
    box-shadow: 0 0 0 4px rgba(193, 18, 46, .15);
    animation: ir-dot-pulse 2s ease-in-out infinite;
}

/* Soft breathing halo on the current step's dot. */
@keyframes ir-dot-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(193, 18, 46, .12); }
    50%      { box-shadow: 0 0 0 6px rgba(193, 18, 46, .20); }
}

@media (prefers-reduced-motion: reduce) {
    .ir-step-dot.is-active .ir-dot {
        animation: none;
    }
}

.ir-step-dot.is-active .ir-step-name,
.ir-step-dot.is-done .ir-step-name {
    color: var(--ir-ink);
    font-weight: 600;
}

.ir-step-dot.is-clickable {
    cursor: pointer;
}

/* Wizard: step panels + navigation ----------------------------------- */
.ir-step-panel {
    outline: none;
}

.ir-step-panel[hidden] {
    display: none;
}

.ir-step-nav {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 18px;
}

.ir-step-nav .ir-btn-primary { flex: 1; }
.ir-step-nav .ir-btn-outline { flex: 0 0 auto; width: auto; }

.ir-step-nav.ir-nav-end {
    justify-content: flex-end;
}

/* Section labels ----------------------------------------------------- */
.ir-section-title {
    font-size: 1.06rem;
    font-weight: 800;
    color: var(--ir-ink);
    margin: 0 0 1px;
}

.ir-section-sub {
    font-size: .82rem;
    color: var(--ir-muted);
    margin: 0 0 10px;
}

.ir-field {
    margin-bottom: 18px;
}

.ir-label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
    font-size: .95rem;
    color: var(--ir-ink);
}

/* Gray icon-boxes (formula / date / time) ---------------------------- */
.ir-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--ir-box);
    border: 1px solid var(--ir-box-border);
    border-radius: 10px;
    padding: 13px 15px;
    width: 100%;
    font-size: .95rem;
    color: var(--ir-ink);
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}

.ir-box:focus-within,
.ir-box.is-active {
    border-color: var(--ir-red);
    box-shadow: 0 0 0 2px rgba(193, 18, 46, .12);
}

.ir-box .ir-icon {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    color: var(--ir-red);
}

.ir-box .ir-icon-ink {
    color: var(--ir-ink);
}

.ir-box select,
.ir-box input {
    border: 0;
    background: transparent;
    outline: none;
    width: 100%;
    font: inherit;
    color: inherit;
    padding: 0;
    cursor: pointer;
}

.ir-box select {
    appearance: none;
    -webkit-appearance: none;
}

.ir-box-chevron {
    margin-left: auto;
    flex: 0 0 auto;
    color: var(--ir-muted-2);
}

.ir-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Hourly formula: prompt the customer to also pick a start time */
.ir-time-hint {
    font-size: .85rem;
    color: var(--ir-red-dark);
    font-weight: 600;
    margin: 8px 0 0;
}

/* Time stepper — replaces the long dropdown for 30-min slot navigation */
.ir-time-stepper {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.ir-step-display {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--ir-box);
    border: 1px solid var(--ir-box-border);
    border-radius: 10px;
    padding: 13px 12px;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--ir-ink);
    font-variant-numeric: tabular-nums;
}

.ir-step-display .ir-icon {
    width: 18px;
    height: 18px;
    color: var(--ir-red);
    flex: 0 0 auto;
}

.ir-step {
    flex: 0 0 auto;
    width: 46px;
    border: 1px solid var(--ir-box-border);
    background: #fff;
    border-radius: 10px;
    color: var(--ir-ink);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, border-color .15s, color .15s, opacity .15s;
}

.ir-step:hover:not(:disabled) {
    border-color: var(--ir-red);
    color: var(--ir-red);
    background: rgba(193, 18, 46, .04);
}

.ir-step:disabled {
    opacity: .35;
    cursor: not-allowed;
}

/* Empty / placeholder state */
.ir-time-stepper[data-empty] .ir-step-display {
    color: var(--ir-muted);
    font-weight: 600;
    font-size: .95rem;
}

.ir-field-time.ir-needs-attention .ir-step-display {
    border-color: var(--ir-red);
    box-shadow: 0 0 0 2px rgba(193, 18, 46, .14);
}

/* Inline calendar field */
.ir-field-date .ir-date {
    display: none;
}

.ir-calendar-wrap {
    margin-top: 10px;
}

/* Info rows (red icon + text) ---------------------------------------- */
.ir-info-list {
    display: grid;
    gap: 14px;
    margin: 4px 0 4px;
}

.ir-info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: .95rem;
    color: var(--ir-ink);
}

.ir-info-row .ir-icon {
    width: 20px;
    height: 20px;
    color: var(--ir-red);
    flex: 0 0 auto;
}

/* Divider ------------------------------------------------------------ */
.ir-divider {
    height: 1px;
    background: var(--ir-line);
    border: 0;
    margin: 20px 0;
}

/* Availability ------------------------------------------------------- */
.ir-avail-badge {
    display: inline-block;
    font-weight: 700;
    font-size: .92rem;
    margin-bottom: 14px;
}

.ir-badge-ok { color: var(--ir-ok); }
.ir-badge-warn { color: var(--ir-warn); }

/* Payment options ---------------------------------------------------- */
.ir-payment-options {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.ir-pay-option {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    border: 1px solid var(--ir-line);
    border-radius: 12px;
    padding: 13px 14px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, background .15s;
}

.ir-pay-option:has(input:checked) {
    border-color: var(--ir-red);
    background: rgba(193, 18, 46, .03);
    box-shadow: 0 0 0 1px var(--ir-red) inset;
}

.ir-pay-option input {
    margin-top: 3px;
    accent-color: var(--ir-red);
}

/* Single option left (no partial deposit): show it as plain info, no selector. */
.ir-payment-options.ir-single-option .ir-pay-option {
    cursor: default;
}

.ir-payment-options.ir-single-option .ir-pay-option input {
    display: none;
}

.ir-pay-option-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ir-pay-title {
    font-weight: 800;
    color: var(--ir-ink);
}

.ir-pay-now,
.ir-pay-balance,
.ir-pay-discount {
    font-size: .88rem;
    color: var(--ir-ok);
    font-weight: 600;
}

.ir-pay-now { color: var(--ir-ink); font-weight: 600; }

/* Total block (big navy price) --------------------------------------- */
.ir-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 6px 0 4px;
}

.ir-total-label {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--ir-ink);
}

.ir-total-value {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.ir-total-strike {
    color: var(--ir-muted);
    text-decoration: line-through;
    font-weight: 700;
    font-size: 1rem;
}

.ir-total-amount {
    color: var(--ir-navy);
    font-weight: 800;
    font-size: 2.3rem;
    letter-spacing: -.02em;
    line-height: 1;
}

.ir-balance-note,
.ir-physical-deposit {
    font-size: .84rem;
    color: var(--ir-muted);
    margin: 2px 0 0;
}

.ir-physical-deposit { margin: 10px 0 0; }

/* Price shown on the "Data" step as soon as it is computed. */
.ir-data-price {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 14px 0 4px;
    padding: 12px 14px;
    background: var(--ir-box);
    border: 1px solid var(--ir-box-border);
    border-radius: 12px;
}

.ir-data-price-label {
    font-weight: 700;
    font-size: .95rem;
    color: var(--ir-ink);
}

.ir-data-price-value {
    color: var(--ir-navy);
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -.02em;
    line-height: 1;
}

/* Buttons ------------------------------------------------------------ */
.ir-btn {
    display: inline-block;
    border: none;
    border-radius: 9px;
    padding: 16px 22px;
    font-weight: 800;
    font-size: 1.02rem;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    line-height: 1.1;
    transition: background .15s, opacity .15s, transform .05s;
}

.ir-btn:active { transform: translateY(1px); }

.ir-btn-primary {
    background: var(--ir-red);
    color: #fff;
    width: 100%;
}

.ir-btn-primary:hover { background: var(--ir-red-dark); color: #fff; }
.ir-btn-primary:disabled { opacity: .45; cursor: not-allowed; }

/* Final conversion CTA: green to signal a safe, confirming action. */
.ir-submit { background: var(--ir-ok); }
.ir-submit:hover { background: var(--ir-ok-dark); }

/* Secure-payment trust row (card logos + Stripe reassurance) --------- */
.ir-pay-trust {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    text-align: center;
}

.ir-pay-trust-cards {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ir-card-logo {
    width: 48px;
    height: auto;
    display: block;
}

.ir-pay-trust-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .78rem;
    color: var(--ir-muted-2);
    line-height: 1.3;
}

.ir-lock {
    width: 12px;
    height: 13px;
    flex: 0 0 auto;
    color: var(--ir-ok);
}

.ir-btn-outline {
    background: #fff;
    color: var(--ir-ink);
    border: 1px solid var(--ir-line);
}

.ir-to-form { margin-top: 4px; }

/* Footer note -------------------------------------------------------- */
.ir-foot-note {
    font-size: .86rem;
    color: var(--ir-muted);
    margin-top: 18px;
}

/* Customer form ------------------------------------------------------ */
.ir-form-title { margin: 4px 0 16px; font-size: 1.2rem; font-weight: 800; }

.ir-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.ir-grid .ir-field { margin-bottom: 0; }
.ir-grid .ir-col-2 { grid-column: 1 / -1; }

.ir-grid label {
    display: block;
    font-size: .8rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--ir-muted-2);
}

.ir-grid input {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--ir-box-border);
    background: var(--ir-box);
    border-radius: 9px;
    font: inherit;
    color: var(--ir-ink);
}

.ir-grid input:focus {
    outline: none;
    border-color: var(--ir-red);
    box-shadow: 0 0 0 2px rgba(193, 18, 46, .12);
}

.ir-check {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    margin-top: 14px;
    font-size: .88rem;
}

.ir-check input { accent-color: var(--ir-red); margin-top: 2px; }

.ir-form-error {
    color: var(--ir-red-dark);
    margin-top: 14px;
    font-weight: 700;
}

.ir-form-error.ir-info { color: var(--ir-ok); }

.ir-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.ir-form-actions .ir-back { width: auto; flex: 0 0 auto; }
.ir-form-actions .ir-submit { flex: 1; }

/* Flatpickr calendar — sober: green filled square = available -------- */
.iter-rental-widget .flatpickr-calendar {
    box-shadow: none;
    border: 0;
    width: 100%;
    max-width: 100%;
}

.iter-rental-widget .flatpickr-calendar.inline { margin: 0; }
.iter-rental-widget .flatpickr-days,
.iter-rental-widget .flatpickr-rContainer { width: 100%; max-width: 100%; }

/* 7-column grid so weekday labels and day circles line up perfectly */
.iter-rental-widget .flatpickr-weekdaycontainer,
.iter-rental-widget .dayContainer {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    justify-items: center;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
}

/* Month header + weekday labels */
.iter-rental-widget .flatpickr-months { margin-bottom: 6px; }
.iter-rental-widget .flatpickr-current-month,
.iter-rental-widget .flatpickr-current-month .cur-month {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--ir-ink);
}
.iter-rental-widget .flatpickr-weekday {
    color: var(--ir-ink);
    font-weight: 700;
}
.iter-rental-widget .flatpickr-prev-month svg,
.iter-rental-widget .flatpickr-next-month svg { fill: var(--ir-ink); }

/* Base day cell — fixed square so border-radius:50% yields a true circle */
.iter-rental-widget .flatpickr-day {
    border: 0;
    border-radius: 50%;
    color: var(--ir-ink);
    font-weight: 600;
    width: 40px;
    height: 40px;
    line-height: 40px;
    max-width: 40px;
    margin: 5px 0 0;
    background: transparent;
}

/* Available: solid green filled square */
.iter-rental-widget .flatpickr-day.ir-day-available {
    background: var(--ir-avail);
    color: #16351f;
}
.iter-rental-widget .flatpickr-day.ir-day-available:hover {
    background: var(--ir-avail-hover);
}

/* Selected: stronger green, white text */
.iter-rental-widget .flatpickr-day.selected,
.iter-rental-widget .flatpickr-day.selected:hover {
    background: var(--ir-avail-strong);
    color: #fff;
}

/* Not available / disabled: plain light gray, no decoration */
.iter-rental-widget .flatpickr-day.ir-day-unavailable,
.iter-rental-widget .flatpickr-day.flatpickr-disabled,
.iter-rental-widget .flatpickr-day.prevMonthDay,
.iter-rental-widget .flatpickr-day.nextMonthDay {
    color: var(--ir-day-off);
    background: transparent;
    text-decoration: none;
    cursor: default;
}

/* Remove flatpickr's default "today" ring for a clean look */
.iter-rental-widget .flatpickr-day.today:not(.selected):not(.ir-day-available) {
    border: 0;
}

/* Confirmation ------------------------------------------------------- */
.iter-rental-confirmation { max-width: 560px; margin: 40px auto; }

.ir-confirm-state { text-align: center; padding: 24px 0; }

.ir-confirm-icon { font-size: 42px; line-height: 1; margin-bottom: 12px; }
.ir-confirm-icon-ok { color: var(--ir-ok); }
.ir-confirm-icon-fail { color: var(--ir-red-dark); }

.ir-confirm-code { font-size: 1.3rem; letter-spacing: .03em; color: var(--ir-navy); }
.ir-confirm-code-line { margin: 14px 0 20px; }

/* Enquiry ------------------------------------------------------------ */
.ir-enquiry-title { margin: 0 0 8px; font-size: 1.3rem; font-weight: 800; }
.ir-enquiry-intro { margin-bottom: 18px; color: var(--ir-muted-2); }

/* Responsive --------------------------------------------------------- */
@media (max-width: 480px) {
    .iter-rental-widget .ir-card,
    .iter-rental-confirmation .ir-card,
    .iter-rental-enquiry .ir-card { padding: 20px; }
    .ir-grid { grid-template-columns: 1fr; }
    .ir-total-amount { font-size: 2rem; }
}
