/* ═══════════════════════════════════════════════════════════════════
   Auto Turnero Pro — Frontend CSS
   Aesthetic: Clean Light — White + Blue
   Fonts: Inter (sistema) — sin Google Fonts para performance
═══════════════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────────── */
.at-widget {
    --at-bg:          #f8fafc;
    --at-surface:     #ffffff;
    --at-surface-2:   #f1f5f9;
    --at-border:      #e2e8f0;
    --at-border-2:    #cbd5e1;
    --at-blue:        #2563eb;
    --at-blue-light:  #3b82f6;
    --at-blue-bg:     #eff6ff;
    --at-blue-glow:   rgba(37,99,235,.15);
    --at-green:       #059669;
    --at-green-bg:    #ecfdf5;
    --at-yellow:      #d97706;
    --at-yellow-bg:   #fffbeb;
    --at-red:         #dc2626;
    --at-red-bg:      #fef2f2;
    --at-text:        #0f172a;
    --at-text-2:      #334155;
    --at-text-muted:  #64748b;
    --at-radius:      12px;
    --at-radius-lg:   16px;
    --at-shadow:      0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
    --at-shadow-card: 0 1px 3px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.05);
    --at-shadow-blue: 0 4px 16px rgba(37,99,235,.2);
    --at-transition:  .18s cubic-bezier(.4,0,.2,1);
    --at-font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

    font-family: var(--at-font);
    background: var(--at-bg);
    color: var(--at-text);
    border-radius: var(--at-radius-lg);
    box-shadow: var(--at-shadow);
    overflow: hidden;
    max-width: 960px;
    margin: 0 auto 40px;
    border: 1px solid var(--at-border);
    position: relative;
}

/* Línea de acento superior */
.at-widget::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #2563eb, #7c3aed 50%, #0891b2);
    z-index: 1;
}

/* ── Progress Bar ───────────────────────────────────────────────── */
.at-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 28px 32px 0;
    position: relative;
    background: var(--at-surface);
    border-bottom: 1px solid var(--at-border);
    padding-bottom: 20px;
}
.at-progress::before {
    content: '';
    position: absolute;
    top: 50px;
    left: 18%;
    right: 18%;
    height: 1px;
    background: var(--at-border);
    z-index: 0;
}
.at-step-dot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1;
    position: relative;
    z-index: 1;
    opacity: .4;
    transition: opacity var(--at-transition);
}
.at-step-dot.active, .at-step-dot.done { opacity: 1; }
.at-step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--at-surface-2);
    border: 2px solid var(--at-border-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    transition: all var(--at-transition);
    color: var(--at-text-muted);
}
.at-step-dot.active .at-step-num {
    background: var(--at-blue);
    border-color: var(--at-blue);
    color: #fff;
    box-shadow: var(--at-shadow-blue);
}
.at-step-dot.done .at-step-num {
    background: var(--at-green);
    border-color: var(--at-green);
    color: #fff;
    font-size: 0;
}
.at-step-dot.done .at-step-num::after {
    content: '✓';
    font-size: 14px;
}
.at-step-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--at-text-muted);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.at-step-dot.active .at-step-label { color: var(--at-blue); }
.at-step-dot.done  .at-step-label  { color: var(--at-green); }

/* ── Steps wrap ─────────────────────────────────────────────────── */
.at-steps-wrap { padding: 32px; }

.at-step { display: none; animation: atFadeIn .25s ease; }
.at-step.active { display: block; }

@keyframes atFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Títulos ────────────────────────────────────────────────────── */
.at-step-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--at-text);
    margin: 0 0 4px;
    letter-spacing: -.02em;
}
.at-step-icon { margin-right: 6px; }
.at-step-sub {
    color: var(--at-text-muted);
    font-size: 15px;
    margin: 0 0 24px;
}

/* ── Back button ────────────────────────────────────────────────── */
.at-back {
    background: none;
    border: none;
    color: var(--at-text-muted);
    font-size: 13px;
    font-family: var(--at-font);
    cursor: pointer;
    padding: 0;
    margin-bottom: 20px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color var(--at-transition);
    font-weight: 500;
}
.at-back:hover { color: var(--at-blue); }

/* ── Location cards ─────────────────────────────────────────────── */
.at-location-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.at-location-card {
    background: var(--at-surface);
    border: 1.5px solid var(--at-border);
    border-radius: var(--at-radius);
    padding: 20px 18px;
    text-align: left;
    cursor: pointer;
    color: var(--at-text);
    font-family: var(--at-font);
    display: flex;
    flex-direction: column;
    gap: 5px;
    transition: all var(--at-transition);
    box-shadow: var(--at-shadow-card);
}
.at-location-card:hover, .at-location-card.selected {
    border-color: var(--at-blue);
    background: var(--at-blue-bg);
    box-shadow: var(--at-shadow-blue);
    transform: translateY(-2px);
}
.at-loc-icon  { font-size: 24px; margin-bottom: 4px; }
.at-loc-name  { font-size: 16px; font-weight: 700; color: var(--at-text); }
.at-loc-addr, .at-loc-phone { font-size: 12px; color: var(--at-text-muted); }

/* ── Service cards ──────────────────────────────────────────────── */
.at-service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.at-service-card {
    background: var(--at-surface);
    border: 1.5px solid var(--at-border);
    border-radius: var(--at-radius);
    padding: 22px 18px;
    text-align: left;
    cursor: pointer;
    color: var(--at-text);
    font-family: var(--at-font);
    display: flex;
    flex-direction: column;
    gap: 5px;
    transition: all var(--at-transition);
    position: relative;
    overflow: hidden;
    box-shadow: var(--at-shadow-card);
}
.at-service-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--svc-color, var(--at-blue));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--at-transition);
}
.at-service-card:hover::before,
.at-service-card.selected::before { transform: scaleX(1); }
.at-service-card:hover, .at-service-card.selected {
    border-color: var(--svc-color, var(--at-blue));
    background: var(--at-blue-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
}
.at-svc-icon     { font-size: 28px; margin-bottom: 6px; }
.at-svc-name     { font-size: 16px; font-weight: 700; color: var(--at-text); }
.at-svc-desc     { font-size: 12px; color: var(--at-text-muted); line-height: 1.5; }
.at-svc-duration { font-size: 12px; color: var(--at-text-muted); margin-top: 6px; }
.at-svc-deposit  {
    font-size: 12px;
    color: var(--at-yellow);
    background: var(--at-yellow-bg);
    border-radius: 4px;
    padding: 2px 6px;
    display: inline-block;
    margin-top: 4px;
    font-weight: 600;
}

/* ── Staff ──────────────────────────────────────────────────────── */
.at-staff-section {
    margin-top: 24px;
    border-top: 1px solid var(--at-border);
    padding-top: 20px;
}
.at-section-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--at-text-muted);
    margin: 0 0 12px;
}
.at-staff-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.at-staff-card {
    background: var(--at-surface);
    border: 1.5px solid var(--at-border);
    border-radius: 40px;
    padding: 7px 16px;
    cursor: pointer;
    color: var(--at-text-2);
    font-family: var(--at-font);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: all var(--at-transition);
    box-shadow: var(--at-shadow-card);
}
.at-staff-card:hover, .at-staff-card.active {
    border-color: var(--at-blue);
    background: var(--at-blue-bg);
    color: var(--at-blue);
}
.at-staff-avatar { font-size: 17px; }

/* ── Calendar ───────────────────────────────────────────────────── */
.at-datetime-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 620px) { .at-datetime-wrap { grid-template-columns: 1fr; } }

.at-calendar-wrap {
    background: var(--at-surface);
    border: 1px solid var(--at-border);
    border-radius: var(--at-radius);
    padding: 20px;
    box-shadow: var(--at-shadow-card);
}
.at-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.at-cal-month-label {
    font-size: 16px;
    font-weight: 700;
    text-transform: capitalize;
    color: var(--at-text);
}
.at-cal-prev, .at-cal-next {
    background: var(--at-surface-2);
    border: 1px solid var(--at-border);
    border-radius: 8px;
    color: var(--at-text-2);
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--at-transition);
}
.at-cal-prev:hover, .at-cal-next:hover {
    border-color: var(--at-blue);
    background: var(--at-blue-bg);
    color: var(--at-blue);
}
.at-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    text-align: center;
}
.at-cal-day-name {
    font-size: 11px;
    font-weight: 700;
    color: var(--at-text-muted);
    text-transform: uppercase;
    padding: 4px 0 8px;
    letter-spacing: .04em;
}
.at-cal-day {
    aspect-ratio: 1;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    cursor: default;
    transition: all var(--at-transition);
    position: relative;
    color: var(--at-text-muted);
}
.at-cal-day.available {
    cursor: pointer;
    background: var(--at-blue-bg);
    color: var(--at-blue);
    font-weight: 600;
}
.at-cal-day.available:hover {
    background: var(--at-blue);
    color: #fff;
    transform: scale(1.05);
}
.at-cal-day.selected {
    background: var(--at-blue) !important;
    color: #fff !important;
    box-shadow: var(--at-shadow-blue);
    font-weight: 700;
}
.at-cal-day.today { font-weight: 700; color: var(--at-text-2); }
.at-cal-day.today::after {
    content: '';
    position: absolute;
    bottom: 3px;
    width: 4px; height: 4px;
    background: var(--at-blue);
    border-radius: 50%;
}
.at-cal-day.empty, .at-cal-day.past { opacity: .25; pointer-events: none; }
.at-cal-loading {
    grid-column: 1/-1;
    text-align: center;
    padding: 24px;
    color: var(--at-text-muted);
    font-size: 13px;
}

/* ── Slots ──────────────────────────────────────────────────────── */
.at-slots-wrap {
    background: var(--at-surface);
    border: 1px solid var(--at-border);
    border-radius: var(--at-radius);
    padding: 20px;
    box-shadow: var(--at-shadow-card);
}
.at-slots-date-label {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 14px;
    color: var(--at-text-muted);
}
.at-slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
    gap: 7px;
}
.at-slot {
    background: var(--at-surface-2);
    border: 1.5px solid var(--at-border);
    border-radius: 8px;
    padding: 9px 6px;
    text-align: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--at-text-2);
    transition: all var(--at-transition);
}
.at-slot:hover {
    border-color: var(--at-blue);
    background: var(--at-blue-bg);
    color: var(--at-blue);
    transform: translateY(-1px);
}
.at-slot.selected {
    background: var(--at-blue);
    border-color: var(--at-blue);
    color: #fff;
    box-shadow: var(--at-shadow-blue);
}
.at-slots-empty {
    color: var(--at-text-muted);
    font-size: 14px;
    text-align: center;
    padding: 24px 0;
}

/* ── Spinner ────────────────────────────────────────────────────── */
.at-spinner {
    width: 22px; height: 22px;
    border: 3px solid var(--at-border);
    border-top-color: var(--at-blue);
    border-radius: 50%;
    animation: atSpin .7s linear infinite;
    display: inline-block;
}
.at-slots-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--at-text-muted);
    font-size: 14px;
    padding: 20px 0;
}

/* ── Summary bar ────────────────────────────────────────────────── */
.at-summary-bar {
    background: var(--at-blue-bg);
    border: 1px solid #bfdbfe;
    border-radius: var(--at-radius);
    padding: 12px 18px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 22px;
    font-size: 14px;
    color: var(--at-text-2);
}
.at-summary-service  { font-weight: 700; color: var(--at-blue); }
.at-summary-datetime { color: var(--at-text-muted); }

/* ── Form ───────────────────────────────────────────────────────── */
.at-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 18px;
}
@media (max-width: 540px) { .at-form-grid { grid-template-columns: 1fr; } }
.at-col-2 { grid-column: 1 / -1; }

.at-form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.at-form-group label {
    font-size: 12px;
    font-weight: 700;
    color: var(--at-text-2);
    text-transform: uppercase;
    letter-spacing: .05em;
}
.at-req { color: var(--at-red); }
.at-input, .at-textarea {
    background: var(--at-surface);
    border: 1.5px solid var(--at-border);
    border-radius: 8px;
    color: var(--at-text);
    font-family: var(--at-font);
    font-size: 15px;
    padding: 10px 13px;
    transition: border-color var(--at-transition), box-shadow var(--at-transition);
    outline: none;
    width: 100%;
    box-sizing: border-box;
}
.at-input:focus, .at-textarea:focus {
    border-color: var(--at-blue);
    box-shadow: 0 0 0 3px var(--at-blue-glow);
}
.at-input::placeholder, .at-textarea::placeholder { color: #94a3b8; }
.at-textarea { resize: vertical; min-height: 80px; }
.at-form-section-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--at-text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    border-top: 1px solid var(--at-border);
    padding-top: 16px;
    margin-top: 4px;
}
.at-optional { text-transform: none; font-weight: 400; font-size: 12px; opacity: .7; }
.at-privacy-note {
    font-size: 12px;
    color: var(--at-text-muted);
    margin-bottom: 20px;
    background: var(--at-surface-2);
    border-radius: 6px;
    padding: 8px 12px;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.at-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 28px;
    border-radius: 10px;
    font-family: var(--at-font);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .01em;
    cursor: pointer;
    border: none;
    transition: all var(--at-transition);
    text-decoration: none;
    white-space: nowrap;
}
.at-btn-confirm, .at-btn-next {
    background: var(--at-blue);
    color: #fff;
    width: 100%;
    box-shadow: var(--at-shadow-blue);
}
.at-btn-confirm:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37,99,235,.3);
}
.at-btn-confirm:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.at-btn-secondary {
    background: var(--at-surface);
    color: var(--at-text-2);
    border: 1.5px solid var(--at-border);
}
.at-btn-secondary:hover {
    border-color: var(--at-blue);
    color: var(--at-blue);
    background: var(--at-blue-bg);
}
.at-btn-mp {
    background: #009ee3;
    color: #fff;
    width: 100%;
    font-size: 14px;
    margin-bottom: 10px;
}
.at-btn-mp:hover { background: #0081bb; }
.at-btn-new { width: 100%; margin-top: 10px; }

/* ── Result step ────────────────────────────────────────────────── */
.at-booking-loading { text-align: center; padding: 60px 20px; }
.at-spinner-large {
    width: 48px; height: 48px;
    border: 4px solid var(--at-border);
    border-top-color: var(--at-blue);
    border-radius: 50%;
    animation: atSpin .8s linear infinite;
    margin: 0 auto 20px;
}
.at-booking-success, .at-booking-error {
    text-align: center;
    padding: 40px 20px;
    animation: atFadeIn .35s ease;
}
.at-success-icon, .at-error-icon { font-size: 52px; margin-bottom: 12px; }
.at-success-title {
    font-size: 26px;
    font-weight: 800;
    margin: 0 0 6px;
    color: var(--at-green);
}
.at-error-title {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 6px;
    color: var(--at-red);
}
.at-success-sub, .at-error-msg {
    color: var(--at-text-muted);
    font-size: 15px;
    margin: 0 0 28px;
}

/* ── Ticket ─────────────────────────────────────────────────────── */
.at-ticket {
    background: var(--at-surface);
    border: 1px solid var(--at-border);
    border-radius: var(--at-radius);
    padding: 4px 0;
    margin: 0 auto 22px;
    max-width: 420px;
    text-align: left;
    position: relative;
    overflow: hidden;
    box-shadow: var(--at-shadow-card);
}
.at-ticket::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: var(--at-green);
}
.at-ticket-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px 10px 22px;
    border-bottom: 1px solid var(--at-border);
    font-size: 14px;
}
.at-ticket-row:last-child { border-bottom: none; }
.at-ticket-row span:first-child { color: var(--at-text-muted); font-size: 13px; }
.at-ticket-number {
    font-size: 17px;
    font-weight: 800;
    color: var(--at-blue);
    letter-spacing: .02em;
}
.at-mp-section  { margin-bottom: 6px; }
.at-mp-label {
    font-size: 14px;
    color: var(--at-yellow);
    background: var(--at-yellow-bg);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 10px;
    font-weight: 500;
}

/* ── Error widget ───────────────────────────────────────────────── */
.at-widget-error {
    background: var(--at-red-bg);
    border: 1px solid #fecaca;
    color: #991b1b;
    border-radius: 8px;
    padding: 14px 18px;
    font-size: 14px;
}

@keyframes atSpin { to { transform: rotate(360deg); } }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .at-steps-wrap { padding: 20px 16px; }
    .at-progress   { padding: 18px 16px 16px; }
    .at-step-label { display: none; }
    .at-step-title { font-size: 20px; }
    .at-service-grid  { grid-template-columns: 1fr 1fr; }
    .at-location-grid { grid-template-columns: 1fr; }
}

/* ── Estados calendario adicionales ────────────────────────────── */
.at-cal-day.unavailable {
    opacity: .2;
    pointer-events: none;
    cursor: default;
}
.at-cal-btn-disabled {
    opacity: .25 !important;
    pointer-events: none !important;
    cursor: default !important;
}
.at-field-error {
    color: var(--at-red);
    font-size: 12px;
    margin-top: -8px;
    display: block;
}
