/* ============================================================
   TicketPress Public Wizard — CSS v3.0
   ============================================================ */

/* ── Wrap principal ─────────────────────────────────────────── */
.tp-wrap {
    font-family: var(--tp-font, 'Sora', system-ui, sans-serif);
    font-size: var(--tp-font-size, 15px);
    color: var(--tp-text, #1F2937);
    background: var(--tp-bg, #fff);
    border-radius: var(--tp-radius, 12px);
    max-width: 700px;
    margin: 0 auto;
    padding: 0;
    box-shadow: 0 2px 16px rgba(0,0,0,.08);
    overflow: hidden;
    /* Altura gestionada por la clase de tamaño */
}

/* Tamaño estándar — altura automática */
.tp-wrap .tp-step {
    min-height: 0;
}

/* Cuando hay clase de tamaño, todos los steps tienen la misma altura y scroll interno */
.tp-wrap--compact,
.tp-wrap--medium {
    display: flex;
    flex-direction: column;
}
.tp-wrap--compact .tp-progress,
.tp-wrap--medium .tp-progress {
    flex-shrink: 0;
}
.tp-wrap--compact .tp-step {
    height: calc(480px - 120px);
    overflow-y: auto;
    overscroll-behavior: contain;
}
.tp-wrap--medium .tp-step {
    height: calc(560px - 120px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Scrollbar discreta en los steps con scroll */
.tp-wrap--compact .tp-step::-webkit-scrollbar,
.tp-wrap--medium .tp-step::-webkit-scrollbar {
    width: 4px;
}
.tp-wrap--compact .tp-step::-webkit-scrollbar-track,
.tp-wrap--medium .tp-step::-webkit-scrollbar-track {
    background: transparent;
}
.tp-wrap--compact .tp-step::-webkit-scrollbar-thumb,
.tp-wrap--medium .tp-step::-webkit-scrollbar-thumb {
    background: #E5E7EB;
    border-radius: 2px;
}

/* ── Progress indicator ─────────────────────────────────────── */
.tp-progress {
    padding: 28px 32px 20px;
    background: #fff;
    border-bottom: 1px solid #F3F4F6;
    position: relative;
}

.tp-progress__steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

.tp-progress__step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    cursor: default;
}

.tp-progress__dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #F3F4F6;
    border: 2px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #9CA3AF;
    transition: all .25s ease;
    position: relative;
    z-index: 2;
}

.tp-progress__label {
    font-size: 11px;
    font-weight: 600;
    color: #9CA3AF;
    text-align: center;
    white-space: nowrap;
    transition: color .25s;
    letter-spacing: .02em;
}

/* Paso activo */
.tp-progress__step.active .tp-progress__dot {
    background: var(--tp-primary, #2563EB);
    border-color: var(--tp-primary, #2563EB);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(37,99,235,.15);
    transform: scale(1.1);
}
.tp-progress__step.active .tp-progress__label {
    color: var(--tp-primary, #2563EB);
    font-weight: 700;
}

/* Paso completado */
.tp-progress__step.completed .tp-progress__dot {
    background: var(--tp-accent, #10B981);
    border-color: var(--tp-accent, #10B981);
    color: #fff;
}
.tp-progress__step.completed .tp-progress__dot span { display: none; }
.tp-progress__step.completed .tp-progress__dot::after {
    content: '';
    font-size: 14px;
    font-weight: 800;
}
.tp-progress__step.completed .tp-progress__label {
    color: var(--tp-accent, #10B981);
}

/* Línea de conexión */
.tp-progress__bar {
    position: absolute;
    top: 44px; /* centrado con el dot */
    left: calc(10% + 18px);
    right: calc(10% + 18px);
    height: 3px;
    background: #E5E7EB;
    border-radius: 2px;
    z-index: 0;
}
.tp-progress__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--tp-accent, #10B981), var(--tp-primary, #2563EB));
    border-radius: 2px;
    transition: width .4s ease;
    width: 0%;
}

/* ── Steps ──────────────────────────────────────────────────── */
.tp-step {
    padding: 28px 32px 32px;
}

.tp-step__title {
    font-size: 20px;
    font-weight: 800;
    color: var(--tp-text, #1F2937);
    margin: 0 0 6px;
    line-height: 1.2;
}

.tp-step__sub {
    font-size: 14px;
    color: var(--tp-muted, #6B7280);
    margin: 0 0 24px;
}

/* ── Calendario ─────────────────────────────────────────────── */
.tp-calendar {
    background: #FAFAFA;
    border: 1.5px solid #E5E7EB;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 24px;
}

.tp-calendar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--tp-primary, #2563EB);
    color: #fff;
}

.tp-calendar__month-label {
    font-weight: 700;
    font-size: 15px;
}

.tp-cal-prev, .tp-cal-next {
    background: rgba(255,255,255,.2);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.tp-cal-prev:hover, .tp-cal-next:hover { background: rgba(255,255,255,.35); }

.tp-calendar__weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    padding: 10px 10px 6px;
    gap: 2px;
}
.tp-calendar__weekday {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #9CA3AF;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.tp-calendar__days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    padding: 4px 10px 12px;
    gap: 4px;
}

.tp-calendar__day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: default;
    transition: all .15s;
    color: #D1D5DB;
}
.tp-calendar__day--empty { pointer-events: none; }

.tp-calendar__day--available {
    color: var(--tp-text, #1F2937);
    background: #fff;
    border: 1.5px solid #E5E7EB;
    cursor: pointer;
    font-weight: 600;
}
.tp-calendar__day--available:hover {
    background: var(--tp-primary, #2563EB);
    border-color: var(--tp-primary, #2563EB);
    color: #fff;
    transform: scale(1.05);
}
.tp-calendar__day--selected {
    background: var(--tp-primary, #2563EB) !important;
    border-color: var(--tp-primary, #2563EB) !important;
    color: #fff !important;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(37,99,235,.3);
}
.tp-calendar__day--disabled { color: #E5E7EB; }

/* ── Slots de horario ───────────────────────────────────────── */
.tp-slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 24px;
}

.tp-slot {
    padding: 14px 10px;
    border: 2px solid #E5E7EB;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    text-align: center;
    transition: all .18s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.tp-slot:hover { border-color: var(--tp-primary, #2563EB); background: #EFF6FF; }
.tp-slot--active, .tp-slot.tp-slot--active {
    border-color: var(--tp-primary, #2563EB);
    background: var(--tp-primary, #2563EB);
    color: #fff;
}
.tp-slot--full { opacity: .5; cursor: not-allowed; }
.tp-slot--full:hover { border-color: #E5E7EB; background: #fff; }

.tp-slot__time {
    font-weight: 700;
    font-size: 16px;
    line-height: 1.2;
}
.tp-slot__avail {
    font-size: 11px;
    color: #EF4444;
    font-weight: 600;
}

/* ── Tipos de entrada ───────────────────────────────────────── */
.tp-ticket-type {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border: 1.5px solid #E5E7EB;
    border-radius: 10px;
    background: #fff;
    margin-bottom: 10px;
    transition: border-color .15s;
}
.tp-ticket-type:hover { border-color: var(--tp-primary, #2563EB); }

.tp-ticket-type__info { flex: 1; }

.tp-ticket-type__name {
    font-weight: 700;
    font-size: 15px;
    display: block;
    margin-bottom: 4px;
    color: var(--tp-text, #1F2937);
}

.tp-ticket-type__price {
    font-size: 14px;
    color: var(--tp-primary, #2563EB);
    font-weight: 600;
}

.tp-tt-notes { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0; }
.tp-tt-note { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; background: #EFF6FF; color: #1D4ED8; }
.tp-tt-note--req { background: #FEF3C7; color: #92400E; }

.tp-ticket-type__counter {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.tp-counter-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid #E5E7EB;
    background: #F9FAFB;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
    line-height: 1;
    color: var(--tp-text, #1F2937);
}
.tp-counter-btn:hover { border-color: var(--tp-primary, #2563EB); background: var(--tp-primary, #2563EB); color: #fff; }
.tp-counter-minus:hover { border-color: #EF4444; background: #EF4444; color: #fff; }

.tp-counter-qty {
    font-size: 18px;
    font-weight: 800;
    min-width: 24px;
    text-align: center;
    color: var(--tp-text, #1F2937);
}

/* ── Cupón ──────────────────────────────────────────────────── */
.tp-coupon-wrap { margin-top: 24px; }
.tp-coupon-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.tp-coupon-input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.tp-coupon-input:focus { outline: none; border-color: var(--tp-primary, #2563EB); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.tp-coupon-input[readonly] { background: #F0FDF4; border-color: #10B981; color: #065F46; font-weight: 700; }
.tp-coupon-msg { margin-top: 8px; padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.tp-apply-coupon[data-applied="1"] { background: #FEE2E2; color: #991B1B; border-color: #FCA5A5; }
.tp-apply-coupon[data-applied="1"]:hover { background: #EF4444; color: #fff; border-color: #EF4444; }

/* ── Subtotal ───────────────────────────────────────────────── */
.tp-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0 0;
    margin-top: 16px;
    border-top: 2px solid #F3F4F6;
    font-size: 16px;
    font-weight: 600;
    color: var(--tp-text, #1F2937);
}
.tp-subtotal__value { font-size: 20px; font-weight: 800; color: var(--tp-primary, #2563EB); }

/* ── Formulario datos cliente ───────────────────────────────── */
.tp-customer-form { display: flex; flex-direction: column; gap: 16px; }

.tp-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media(max-width:540px){ .tp-field-row { grid-template-columns: 1fr; } }

.tp-field { display: flex; flex-direction: column; gap: 6px; }

.tp-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--tp-text, #1F2937);
}

.tp-input, .tp-select, .tp-textarea {
    padding: 11px 14px;
    border: 1.5px solid #E5E7EB;
    border-radius: var(--tp-radius, 10px);
    font-size: 14px;
    font-family: inherit;
    color: var(--tp-text, #1F2937);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}
.tp-input:focus, .tp-select:focus, .tp-textarea:focus {
    outline: none;
    border-color: var(--tp-primary, #2563EB);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

/* ── Bloque factura ─────────────────────────────────────────── */
.tp-invoice-block {
    margin-top: 20px;
    background: #F9FAFB;
    border: 1.5px solid #E5E7EB;
    border-radius: 10px;
    padding: 18px 20px;
}
#tp-invoice-fields { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }

.tp-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}
.tp-checkbox-label input[type="checkbox"] { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--tp-primary, #2563EB); }

.tp-legal { margin-top: 8px; }
.tp-legal .tp-checkbox-label { font-weight: 500; font-size: 13px; }
.tp-legal a { color: var(--tp-primary, #2563EB); }

/* ── Resumen ────────────────────────────────────────────────── */
.tp-summary-content { margin-bottom: 24px; }
.tp-summary__section { border: 1.5px solid #E5E7EB; border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
.tp-summary__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    border-bottom: 1px solid #F3F4F6;
    font-size: 14px;
    gap: 12px;
}
.tp-summary__row:last-child { border-bottom: none; }
.tp-summary__row span { color: var(--tp-muted, #6B7280); }
.tp-summary__row strong { font-weight: 700; color: var(--tp-text, #1F2937); text-align: right; }
.tp-summary__row--total { background: #F9FAFB; font-size: 16px; }
.tp-summary__row--total span { font-weight: 700; color: var(--tp-text, #1F2937); }
.tp-summary__row--total strong { font-size: 20px; color: var(--tp-primary, #2563EB); }
.tp-summary__row--discount strong { color: #059669; }

/* ── Nav botones ────────────────────────────────────────────── */
.tp-step-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #F3F4F6;
    gap: 12px;
}

/* ── Botones ────────────────────────────────────────────────── */
.tp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 24px;
    border-radius: var(--tp-radius, 10px);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all .18s;
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}
.tp-btn:disabled { opacity: .4; cursor: not-allowed; }
.tp-btn--primary { background: var(--tp-primary, #2563EB); color: #fff; border-color: var(--tp-primary, #2563EB); }
.tp-btn--primary:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(37,99,235,.3); }
.tp-btn--secondary { background: #fff; color: var(--tp-text, #1F2937); border-color: #E5E7EB; }
.tp-btn--secondary:hover { border-color: var(--tp-primary, #2563EB); color: var(--tp-primary, #2563EB); }
.tp-btn--ghost { background: transparent; color: var(--tp-muted, #6B7280); border-color: transparent; padding-left: 0; }
.tp-btn--ghost:hover { color: var(--tp-primary, #2563EB); }
.tp-btn--sm { padding: 7px 16px; font-size: 13px; }

/* ── Pay button ─────────────────────────────────────────────── */
.tp-pay-btn {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: .02em;
}

/* ── Overlay / loading ──────────────────────────────────────── */
.tp-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.85);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 14px;
    z-index: 10;
    border-radius: var(--tp-radius, 12px);
    backdrop-filter: blur(2px);
}
.tp-spinner {
    width: 36px; height: 36px;
    border: 3px solid #E5E7EB;
    border-top-color: var(--tp-primary, #2563EB);
    border-radius: 50%;
    animation: tp-spin .7s linear infinite;
}
@keyframes tp-spin { to { transform: rotate(360deg); } }

/* ── Alertas ────────────────────────────────────────────────── */
.tp-alert { padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; line-height: 1.5; }
.tp-alert--error   { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }
.tp-alert--success { background: #D1FAE5; color: #065F46; border: 1px solid #6EE7B7; }
.tp-alert--info    { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }
.tp-alert--warning { background: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; }

.tp-loading { text-align: center; padding: 24px; color: var(--tp-muted, #6B7280); font-size: 14px; }

/* ── Pay error ──────────────────────────────────────────────── */
.tp-pay-error { margin-top: 12px; }

/* ── Responsive ─────────────────────────────────────────────── */
@media(max-width:600px) {
    .tp-step { padding: 20px 18px 24px; }
    .tp-progress { padding: 20px 16px 16px; }
    .tp-progress__label { display: none; }
    .tp-progress__dot { width: 30px; height: 30px; font-size: 12px; }
    .tp-progress__bar { top: 37px; }
    .tp-slots-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}


/* ── Widget de eventos con pestañas ── */
.tp-el {
    background: var(--tp-widget-bg, #fff);
    border-radius: var(--tp-radius, 12px);
    overflow: hidden;
    box-shadow: var(--tp-shadow-md, 0 4px 16px rgba(0,0,0,.10));
}
.tp-el__tabs {
    background: var(--tp-tab-bg, #F3F4F6);
}
.tp-el__tab {
    color: var(--tp-tab-text, #6B7280);
}
.tp-el__tab:hover { color: var(--tp-primary, #2563EB); }
.tp-el__tab--active {
    color: var(--tp-primary, #2563EB);
    border-bottom-color: var(--tp-primary, #2563EB);
    background: var(--tp-widget-bg, #fff);
}
.tp-el__panel { padding: 24px; }
