/* ===================================
   BOOKING WIZARD COMPONENT
   Modern step-by-step booking interface
   =================================== */

.abs-booking-wizard {
    max-width: 100%;
    width: 100%;
    margin: 1rem auto;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Espaciador de navegación */
.abs-nav-spacer { flex: 1; }

@media (min-width: 768px) {
    .abs-booking-wizard {
        max-width: 960px;
        /*margin: 2rem auto;*/
    }
}

/* Progress Header */
.abs-wizard-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1.5rem;
    color: white;
}

/* New top row: progress bar on the left, auth links on the right */
.abs-header-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0.75rem;
    flex-direction: column-reverse;
    align-items: stretch;
}

.abs-header-top .abs-progress-bar {
    flex: 1 1 auto;
}

.abs-authbar {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    flex-wrap: wrap;
}

.abs-auth-text { opacity: 0.85; white-space: nowrap; }
.abs-auth-divider { opacity: 0.6; }
.abs-auth-link { color: #ffffff; text-decoration: underline; opacity: 0.95; }
.abs-auth-link:hover { opacity: 1; }

.abs-progress-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    position: relative;
}

.abs-progress-bar::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
    z-index: 1;
}

.abs-progress-line {
    position: absolute;
    top: 50%;
    left: 0;
    height: 2px;
    background: #ffffff;
    transition: width 0.3s ease;
    z-index: 2;
}

.abs-step-indicator {
    position: relative;
    z-index: 3;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.3s ease;
}

.abs-step-indicator.active {
    background: #ffffff;
    color: #667eea;
    transform: scale(1.1);
}

.abs-step-indicator.completed {
    background: #10b981;
    color: white;
    font-size: 0;
}

.abs-step-indicator.completed::before {
    content: '✓';
    font-size: 16px;
}

.abs-wizard-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    text-align: center;
    color: #ffffff;
}

@media (max-width: 640px) {
    .abs-header-top { flex-direction: column; align-items: flex-start; gap: 8px; flex-direction: column-reverse;}
    .abs-header-top .abs-progress-bar { width: 100%; }
}

/* Content Area */
.abs-wizard-content {
    padding: 1rem;
    min-height: 400px;
}

@media (min-width: 768px) {
    .abs-wizard-content {
        padding: 2rem;
    }
}

.abs-step {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.abs-step.active-step {
    display: block;
}

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

.abs-step-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.abs-step-subtitle {
    color: #6b7280;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

/* Form Elements */
.abs-form-group {
    margin-bottom: 1.5rem;
}

.abs-form-label {
    display: block;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.abs-form-input,
.abs-form-select,
.abs-form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: #ffffff;
}

.abs-form-input:focus,
.abs-form-select:focus,
.abs-form-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Invalid field styles */
.abs-form-input.abs-invalid,
.abs-form-select.abs-invalid,
.abs-form-textarea.abs-invalid {
    border-color: #ef4444;
    background: #fef2f2;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.abs-field-error {
    color: #b91c1c;
    font-size: 0.875rem;
    margin-top: 0.375rem;
    display: none;
}

.abs-form-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Checkbox simple (términos y condiciones) */
.abs-form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.abs-form-checkbox input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Service & Staff Grid */
.abs-service-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.abs-staff-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 columnas en móvil */
    gap: 1rem;
    margin-top: 1rem;
}

/* Cuando solo hay una tarjeta en el grid, centrar y limitar ancho */
.abs-service-grid.single-item,
.abs-staff-grid.single-item {
    grid-template-columns: 1fr;
    justify-items: center;
}

.abs-service-grid.single-item .abs-service-card,
.abs-staff-grid.single-item .abs-staff-card {
    width: 100%;
    max-width: 420px; /* evita que una única tarjeta se estire demasiado */
}

@media (min-width: 640px) {
    .abs-service-grid,
    .abs-staff-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .abs-service-grid,
    .abs-staff-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

.abs-service-card,
.abs-staff-card {
    padding: 1.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Mantener tamaño cuadrado por defecto también sin imagen */
.abs-staff-card { aspect-ratio: 1 / 1; }

.abs-service-card:hover,
.abs-staff-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.abs-service-card.selected,
.abs-staff-card.selected {
    border-color: #22c55e; /* verde más llamativo */
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25), 0 8px 28px rgba(34, 197, 94, 0.22);
}

.abs-service-card.selected:not(.has-image),
.abs-staff-card.selected:not(.has-image) {
    background: linear-gradient(135deg, #f8faff 0%, #f0f4ff 100%);
}

/* Indicador de selección (tick) */
.abs-service-card.selected::after,
.abs-staff-card.selected::after {
    content: '\2713';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #22c55e; /* verde más llamativo */
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    z-index: 2;
    box-shadow: 0 0 0 2px #ffffff, 0 2px 8px rgba(0,0,0,0.25);
}

.abs-service-name,
.abs-staff-name {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.abs-service-details {
    color: #6b7280;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto; /* empuja los detalles al fondo de la tarjeta */
}

.abs-service-description {
    display: none; /* ocultar descripción en las tarjetas */
}

.abs-service-price {
    font-weight: 700;
    color: #667eea;
    font-size: 1.1rem;
}

/* Cards con imagen de fondo */
.abs-service-card.has-image {
    color: #ffffff;
    position: relative;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    aspect-ratio: 1 / 1;
}

.abs-staff-card.has-image {
    color: #ffffff;
    position: relative;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    aspect-ratio: 1 / 1;
}

/* Placeholder sin imagen: gradiente corporativo */
.abs-staff-card.no-image {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
}

@media (max-width: 767px) {
    .abs-service-card.has-image,
    .abs-staff-card.has-image {
        aspect-ratio: 2.5 / 1;
    }
    /* Asegurar mismo ratio para tarjetas sin imagen en móvil */
    .abs-staff-card.no-image { aspect-ratio: 2.5 / 1; }
}

.abs-service-card.has-image::before,
.abs-staff-card.has-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0.75) 100%);
    z-index: 0;
}

.abs-service-card.has-image > *,
.abs-staff-card.has-image > * {
    position: relative;
    z-index: 1;
}

.abs-service-card.has-image .abs-service-name,
.abs-staff-card.has-image .abs-staff-name { color: #ffffff; }
.abs-service-card.has-image .abs-service-details { color: #e5e7eb; }
.abs-service-card.has-image .abs-service-description { color: #f3f4f6; }
.abs-service-card.has-image .abs-service-price { color: #ffffff; }

/* Pago (Stripe) */
.abs-payment-summary {
    background: #f9fafb;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.abs-card-element {
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    margin-bottom: 1rem;
}

.abs-card-errors {
    color: #ef4444;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Calendar Component */
.abs-calendar {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.abs-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 6px 6px 0px 0px;
}

.abs-calendar-nav {
    background: none;
    border: none;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
}

.abs-calendar-nav:hover {
    background: #e5e7eb;
    color: #374151;
}

.abs-calendar-title {
    font-weight: 600;
    color: #1f2937;
}

.abs-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.abs-calendar-weekday {
    padding: 0.75rem;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 500;
    color: #6b7280;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.abs-calendar-day {
    padding: 0.75rem;
    text-align: center;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    border-right: 1px solid #f3f4f6;
    transition: all 0.2s ease;
    position: relative;
}

.abs-calendar-day:hover {
    background: #f3f4f6;
}

.abs-calendar-day.available {
    color: #059669;
    font-weight: 500;
}

.abs-calendar-day.selected {
    background: #667eea;
    color: white;
    font-weight: 600;
}

.abs-calendar-day.disabled {
    color: #4b4b4d;
    cursor: not-allowed;
}

.abs-calendar-day.has-slots::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: #10b981;
    border-radius: 50%;
}

/* DateTime Container Layout */
.abs-datetime-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 1rem;
}

@media (min-width: 768px) {
    .abs-datetime-container {
        grid-template-columns: 2fr 1fr;
        gap: 2rem;
    }
}

.abs-calendar-section {
    background: #f9fafb;
    border-radius: 12px;
    padding: 0.5rem;
}

/* Ensure calendar fits container and avoids overflow */
.abs-calendar-section,
.abs-calendar-section * {
    box-sizing: border-box;
}

.abs-calendar-section { 
    width: 100%;
    overflow-x: hidden; /* prevent horizontal overflow */
}

/* Force inner calendar blocks to be centered and at 98% width */
.abs-calendar-section #abs-calendar-container,
.abs-calendar-section .abs-calendar-wrapper,
.abs-calendar-section .abs-calendar-header,
.abs-calendar-section .abs-calendar-body,
.abs-calendar-section .abs-calendar-weekdays,
.abs-calendar-section .abs-calendar-days,
.abs-calendar-section .abs-calendar-legend {
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* Align weekdays row with days grid */
.abs-calendar-section .abs-calendar-weekdays,
.abs-calendar-section .abs-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.abs-calendar-section .abs-calendar-weekdays > div {
    text-align: center;
}

/* Prevent day cells from causing overflow */
.abs-calendar-section .abs-calendar-days > * {
    min-width: 0;
}

.abs-timeslots-section {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem;
}

.abs-timeslots-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.abs-timeslots-header h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #374151;
}

.abs-selected-date-display {
    font-size: 0.9rem;
    font-weight: 400;
    color: #6b7280;
    display: block;
}

/* Time Slots Grid */
.abs-time-slots-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    max-height: 350px;
    overflow-y: auto;
}

@media (min-width: 640px) {
    .abs-time-slots-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) {
    .abs-time-slots-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
}

@media (min-width: 1024px) {
    .abs-time-slots-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Legacy time slots for backward compatibility */
.abs-time-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.abs-time-slot {
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
    font-weight: 500;
}

.abs-time-slot:hover {
    border-color: #667eea;
    background: #f8faff;
}

.abs-time-slot.selected {
    border-color: #667eea;
    background: #667eea;
    color: white;
    position: relative;
}

.abs-time-slot.selected::after {
    content: '✓';
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 0.8rem;
    font-weight: bold;
}

.abs-time-slot.unavailable {
    background: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
    border-color: #e5e7eb;
}

.abs-btn.disabled,
.abs-btn:disabled {
    background: #e5e7eb !important;
    color: #9ca3af !important;
    cursor: not-allowed !important;
    border-color: #e5e7eb !important;
    opacity: 0.6;
}

/* Navigation */
.abs-wizard-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

@media (min-width: 768px) {
    .abs-wizard-navigation {
        padding: 1.5rem 2rem;
    }
}

.abs-btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

/* Leave a small gap below when scrolling buttons into view */
#abs-next-step,
#abs-submit-booking,
#abs-pay-button {
    scroll-margin-bottom: 16px;
}

.abs-btn-secondary {
    background: #6b7280;
    color: white;
}

.abs-btn-secondary:hover {
    background: #4b5563;
}

.abs-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.abs-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.abs-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Loading States */
.abs-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.abs-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Messages */
.abs-message {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.abs-message-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.abs-message-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.abs-message-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Responsive Design */
@media (max-width: 768px) {
    .abs-booking-wizard {
        /*margin: 1rem;*/
        border-radius: 12px;
    }
    
    .abs-wizard-header,
    .abs-wizard-content,
    .abs-wizard-navigation {
        padding: 1.5rem;
    }
    
    .abs-wizard-navigation {
        flex-direction: column;
        gap: 1rem;
    }
    
    .abs-nav-spacer {
        display: none;
    }
    
    .abs-btn {
        width: 100%;
    }
    
    .abs-service-grid,
    .abs-staff-grid {
        grid-template-columns: 1fr;
    }
    
    .abs-time-slots {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.5rem;
    }
    
    .abs-step-indicator {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
}

/* Confirmation Step */
.abs-confirmation {
    text-align: center;
    /*padding: 2rem;*/
}

.abs-confirmation-icon {
    width: 80px;
    height: 80px;
    background: #10b981;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: white;
    font-size: 2rem;
}

.abs-confirmation-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.abs-confirmation-subtitle {
    color: #6b7280;
    margin-bottom: 2rem;
}

.abs-booking-summary {
    background: #f9fafb;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: left;
    margin: 1.5rem 0;
}

/* Step 4: Details two-column layout (1/3 - 2/3) */
.abs-details-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    align-items: start;
    margin-top: 1rem;
}

@media (min-width: 768px) {
    .abs-details-container {
        grid-template-columns: 1fr 2fr; /* 1/3 - 2/3 */
        gap: 2rem;
    }
    .abs-summary-col {
        position: sticky;
        top: 1rem;
    }
}

.abs-summary-col .abs-booking-summary {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
}

.abs-customer-col .abs-form-group:last-child {
    margin-bottom: 0;
}

/* Step 5: Ticket styling */
.abs-ticket {
    background: #ffffff;
    border: 2px dashed #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
    position: relative;
    overflow: hidden;
}

.abs-ticket-header {
    padding: 1rem 1.25rem;
    background: #f9fafb;
    border-bottom: 2px dashed #e5e7eb;
}

.abs-ticket-number {
    font-weight: 700;
    color: #111827;
}

.abs-ticket-body {
    padding: 1rem 1.25rem;
}

.abs-ticket .abs-summary-row {
    border-bottom: 1px dashed #e5e7eb;
}

.abs-ticket .abs-summary-row:last-child {
    border-bottom: none;
}

/* Decorative perforation circles */
.abs-ticket::before,
.abs-ticket::after {
    content: '';
    position: absolute;
    top: 56px; /* aligns with header/border */
    width: 12px;
    height: 12px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 50%;
}

.abs-ticket::before { left: -7px; }
.abs-ticket::after { right: -7px; }

.abs-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.abs-summary-row:last-child {
    border-bottom: none;
    font-weight: 600;
}

.abs-summary-label {
    color: #6b7280;
}

.abs-summary-value {
    color: #1f2937;
    font-weight: 500;
    text-align: right;
}
