/* ============================================
   APPOINTMENT BOOKING - PUBLIC STYLES
   ============================================ */

/* === VARIABILI CSS === */
:root {
    --ab-primary: #2563eb;
    --ab-primary-dark: #1d4ed8;
    --ab-secondary: #64748b;
    --ab-success: #059669;
    --ab-success-dark: #047857;
    --ab-danger: #dc2626;
    --ab-warning: #d97706;
    --ab-light: #f8fafc;
    --ab-white: #ffffff;
    --ab-gray-100: #f1f5f9;
    --ab-gray-200: #e2e8f0;
    --ab-gray-300: #cbd5e1;
    --ab-gray-400: #94a3b8;
    --ab-gray-500: #64748b;
    --ab-gray-600: #475569;
    --ab-gray-700: #334155;
    --ab-gray-800: #1e293b;
    --ab-gray-900: #0f172a;
    --ab-border-radius: 8px;
    --ab-box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --ab-box-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --ab-transition: all 0.3s ease;
}

/* === CONTAINER PRINCIPALE === */
.ab-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--ab-white);
    border-radius: var(--ab-border-radius);
    box-shadow: var(--ab-box-shadow-lg);
}

.ab-title {
    text-align: center;
    color: var(--ab-gray-800);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    line-height: 1.2;
}

/* === INDICATORI STEP === */
.ab-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3rem;
    padding: 0 1rem;
}

.ab-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
    opacity: 0.5;
    transition: var(--ab-transition);
}

.ab-step.active {
    opacity: 1;
}

.ab-step.completed {
    opacity: 1;
}

.ab-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 16px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--ab-gray-200);
    z-index: 1;
}

.ab-step.completed:not(:last-child)::after {
    background: var(--ab-primary);
}

.ab-step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ab-gray-200);
    color: var(--ab-gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 2;
    transition: var(--ab-transition);
}

.ab-step.active .ab-step-number {
    background: #ff1949;
    color: var(--ab-white);
}

.ab-step.completed .ab-step-number {
    background: var(--ab-success);
    color: var(--ab-white);
}

.ab-step-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--ab-gray-600);
    text-align: center;
    line-height: 1.2;
}

.ab-step.active .ab-step-label {
    color: var(--ab-primary);
    font-weight: 600;
}

/* === FORM === */
.ab-form {
    position: relative;
}

.ab-form-step {
    display: none;
    animation: fadeInUp 0.4s ease;
}

.ab-form-step.active {
    display: block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ab-form-step h3 {
    color: var(--ab-gray-800);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-align: center;
}

.ab-form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.ab-form-group {
    flex: 1;
    margin-bottom: 1.5rem;
}

.ab-form-group.ab-half {
    flex: 0 0 calc(50% - 0.5rem);
}

.ab-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--ab-gray-700);
    font-weight: 500;
    font-size: 0.875rem;
}

.ab-form-group input,
.ab-form-group textarea {
    width: 100%;
    padding: 0.89rem 0.0rem 0.50rem .50rem;
    border: 2px solid var(--ab-gray-200);
    border-radius: var(--ab-border-radius);
    font-size: 1rem;
    transition: var(--ab-transition);
    background: var(--ab-white);
}

.ab-form-group input:focus,
.ab-form-group textarea:focus {
    outline: none;
    border-color: var(--ab-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.ab-form-group input.error,
.ab-form-group textarea.error {
    border-color: var(--ab-danger);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.ab-field-error {
    display: block;
    color: var(--ab-danger);
    font-size: 0.75rem;
    margin-top: 0.25rem;
    min-height: 1rem;
}

/* === TIPOS DE CITA === */
.ab-appointment-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.ab-appointment-type input[type="radio"] {
    display: none;
}

.ab-type-card {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    border: 2px solid var(--ab-gray-200);
    border-radius: var(--ab-border-radius);
    cursor: pointer;
    transition: var(--ab-transition);
    background: var(--ab-white);
    text-decoration: none;
    color: inherit;
}

.ab-type-card:hover {
    border-color: var(--ab-primary);
    box-shadow: var(--ab-box-shadow);
    transform: translateY(-2px);
}

.ab-appointment-type input[type="radio"]:checked + .ab-type-card {
    border-color: var(--ab-primary);
    background: rgba(37, 99, 235, 0.05);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.ab-type-icon {
    margin-right: 1rem;
    color: var(--ab-gray-500);
    transition: var(--ab-transition);
}

.ab-appointment-type input[type="radio"]:checked + .ab-type-card .ab-type-icon {
    color: var(--ab-primary);
}

.ab-type-content h4 {
    margin: 0 0 0.25rem 0;
    color: var(--ab-gray-800);
    font-size: 1.125rem;
    font-weight: 600;
}

.ab-type-content p {
    margin: 0;
    color: var(--ab-gray-600);
    font-size: 0.875rem;
    line-height: 1.4;
}

/* === DATA E ORARIO === */
.ab-datetime-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.ab-date-section h4,
.ab-time-section h4 {
    margin: 0 0 1rem 0;
    color: var(--ab-gray-700);
    font-size: 1rem;
    font-weight: 600;
}

/* === CALENDARIO === */
.ab-calendar {
    border: 1px solid var(--ab-gray-200);
    border-radius: var(--ab-border-radius);
    background: var(--ab-white);
    overflow: hidden;
}

.ab-calendar-loading {
    padding: 2rem;
    text-align: center;
    color: var(--ab-gray-500);
    font-size: 0.875rem;
}

.ab-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--ab-gray-50);
    border-bottom: 1px solid var(--ab-gray-200);
}

.ab-calendar-nav {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--ab-gray-600);
    border-radius: 4px;
    transition: var(--ab-transition);
}

.ab-calendar-nav:hover {
    background: var(--ab-gray-100);
    color: var(--ab-gray-800);
}

.ab-calendar-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ab-calendar-title {
    font-weight: 600;
    color: var(--ab-gray-800);
    margin: 0;
}

.ab-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.ab-calendar-day-header {
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ab-gray-600);
    background: var(--ab-gray-50);
    border-bottom: 1px solid var(--ab-gray-200);
}

.ab-calendar-day {
    padding: 0.75rem 0.5rem;
    text-align: center;
    cursor: pointer;
    border-bottom: 1px solid var(--ab-gray-100);
    border-right: 1px solid var(--ab-gray-100);
    transition: var(--ab-transition);
    position: relative;
    font-size: 0.875rem;
}

.ab-calendar-day:hover {
    background: var(--ab-gray-50);
}

.ab-calendar-day.other-month {
    color: var(--ab-gray-300);
    cursor: not-allowed;
}

.ab-calendar-day.disabled {
    color: var(--ab-gray-300);
    cursor: not-allowed;
    background: var(--ab-gray-50);
}

.ab-calendar-day.available {
    color: var(--ab-gray-800);
    font-weight: 500;
}

.ab-calendar-day.available:hover {
    background: rgba(37, 99, 235, 0.1);
    color: var(--ab-primary);
}

.ab-calendar-day.selected {
    background: var(--ab-primary);
    color: var(--ab-white);
    font-weight: 600;
}

/* === SLOT ORARI === */
.ab-time-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 1rem;
    border: 1px solid var(--ab-gray-200);
    border-radius: var(--ab-border-radius);
    background: var(--ab-white);
}

.ab-time-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--ab-gray-500);
    font-size: 0.875rem;
    padding: 2rem 1rem;
}

.ab-time-slot {
    padding: 0.5rem;
    text-align: center;
    color:#424242;
    border: 1px solid var(--ab-gray-200);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--ab-transition);
    font-size: 0.875rem;
    font-weight: 500;
    background: var(--ab-white);
}

.ab-time-slot:hover {
    border-color: var(--ab-primary);
    background: rgba(37, 99, 235, 0.05);
    color: var(--ab-primary);
}

.ab-time-slot.selected {
    background: var(--ab-primary);
    border-color: var(--ab-primary);
    color: var(--ab-white);
}

.ab-time-slot.disabled {
    background: var(--ab-gray-100);
    color: var(--ab-gray-400);
    cursor: not-allowed;
    border-color: var(--ab-gray-200);
}

/* === RIEPILOGO === */
.ab-summary {
    background: var(--ab-gray-50);
    border-radius: var(--ab-border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.ab-summary-section {
    margin-bottom: 1.5rem;
}

#notes{
    width: 100%;
    height: 150px;
    
    
}

.ab-summary-section:last-child {
    margin-bottom: 0;
}

.ab-summary-section h4 {
    margin: 0 0 1rem 0;
    color: var(--ab-gray-800);
    font-size: 1rem;
    font-weight: 600;
    border-bottom: 1px solid var(--ab-gray-200);
    padding-bottom: 0.5rem;
}

.ab-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.ab-summary-label {
    color: var(--ab-gray-600);
    font-weight: 500;
}

.ab-summary-value {
    color: var(--ab-gray-800);
    font-weight: 600;
}

/* === BOTONES === */
.ab-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    gap: 1rem;
}

.ab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--ab-border-radius);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--ab-transition);
    position: relative;
    line-height: 1;
    min-height: 44px;
}

.ab-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.ab-btn-primary {
    background: #ff1949;
    color: var(--ab-white);
}

.ab-btn-primary:hover:not(:disabled) {
    background: var(--ab-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--ab-box-shadow);
}

.ab-btn-secondary {
    background: var(--ab-gray-500);
    color: var(--ab-white);
}

.ab-btn-secondary:hover:not(:disabled) {
    background: var(--ab-gray-600);
    transform: translateY(-1px);
    box-shadow: var(--ab-box-shadow);
}

.ab-btn-success {
    background: var(--ab-success);
    color: var(--ab-white);
}

.ab-btn-success:hover:not(:disabled) {
    background: var(--ab-success-dark);
    transform: translateY(-1px);
    box-shadow: var(--ab-box-shadow);
}

.ab-btn-icon {
    margin-left: 0.5rem;
    font-size: 1rem;
}

.ab-btn-prev .ab-btn-icon {
    margin-left: 0;
    margin-right: 0.5rem;
}

/* === SPINNER === */
.ab-btn-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

.ab-btn.loading .ab-btn-spinner {
    display: inline-block;
}

.ab-btn.loading .ab-btn-icon {
    display: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === MENSAJES === */
.ab-messages {
    margin-top: 1rem;
}

.ab-message {
    padding: 1rem;
    border-radius: var(--ab-border-radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    line-height: 1.4;
}

.ab-message.success {
    background: rgba(5, 150, 105, 0.1);
    border: 1px solid var(--ab-success);
    color: var(--ab-success-dark);
}

.ab-message.error {
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid var(--ab-danger);
    color: var(--ab-danger);
}

.ab-message.warning {
    background: rgba(217, 119, 6, 0.1);
    border: 1px solid var(--ab-warning);
    color: var(--ab-warning);
}

/* === MODALES === */
.ab-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.ab-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ab-modal-content {
    background: var(--ab-white);
    border-radius: var(--ab-border-radius);
    box-shadow: var(--ab-box-shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideInUp 0.3s ease;
}

.ab-loading-content {
    padding: 2rem;
    text-align: center;
    max-width: 300px;
}

.ab-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.5rem 0 1.5rem;
}

.ab-modal-header h3 {
    margin: 0;
    color: var(--ab-gray-800);
    font-size: 1.25rem;
    font-weight: 600;
}

.ab-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--ab-gray-500);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--ab-transition);
}

.ab-modal-close:hover {
    background: var(--ab-gray-100);
    color: var(--ab-gray-700);
}

.ab-modal-body {
    padding: 1.5rem;
}

.ab-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 0 1.5rem 1.5rem 1.5rem;
}

/* === SPINNER DE CARGA === */
.ab-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--ab-gray-200);
    border-top: 4px solid var(--ab-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem auto;
}

/* === PÁGINA DE ÉXITO === */
.ab-success-container {
    text-align: center;
    padding: 3rem 2rem;
}

.ab-success-icon {
    color: var(--ab-success);
    margin-bottom: 1.5rem;
}

.ab-success-message h2 {
    color: var(--ab-gray-800);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.ab-success-message p {
    color: var(--ab-gray-600);
    font-size: 1.125rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.ab-success-details {
    background: var(--ab-gray-50);
    border-radius: var(--ab-border-radius);
    padding: 1.5rem;
    margin: 2rem 0;
    text-align: left;
}

.ab-success-details h3 {
    margin: 0 0 1rem 0;
    color: var(--ab-gray-800);
    font-size: 1.25rem;
    font-weight: 600;
}

.ab-success-details ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ab-success-details li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--ab-gray-200);
    font-size: 0.875rem;
    color:#2ab300;
}

.ab-success-details li:last-child {
    border-bottom: none;
}

.ab-success-actions {
    margin-top: 2rem;
}

/* === ANIMACIONES === */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .ab-container {
        padding: 1rem;
        margin: 1rem;
    }
    
    .ab-title {
        font-size: 1.5rem;
    }
    
    .ab-steps {
        padding: 0;
        margin-bottom: 2rem;
    }
    
    .ab-step-label {
        font-size: 0.625rem;
    }
    
    .ab-form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .ab-form-group.ab-half {
        flex: 1;
    }
    
    .ab-datetime-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .ab-appointment-types {
        grid-template-columns: 1fr;
    }
    
    .ab-form-actions {
        flex-direction: column-reverse;
    }
    
    .ab-form-actions .ab-btn {
        width: 100%;
        justify-content: center;
    }
    
    .ab-modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .ab-modal-footer {
        flex-direction: column;
    }
    
    .ab-modal-footer .ab-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .ab-container {
        margin: 0.5rem;
        padding: 0.75rem;
    }
    
    .ab-steps {
        justify-content: space-around;
    }
    
    .ab-step-number {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }
    
    .ab-time-slots {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 0.25rem;
        padding: 0.75rem;
    }
    
    .ab-time-slot {
        padding: 0.375rem 0.25rem;
        font-size: 0.75rem;
    }
}
/* ===== Luogo presenza ===== */
.ab-presence-location{margin:18px 0;padding:16px;border:1px solid #e2e8f0;border-radius:10px;background:#f8fafc;}
.ab-presence-location h4{margin:0 0 10px;font-size:15px;color:#424242;}
.ab-location-option{display:flex;align-items:center;gap:8px;padding:8px 0;cursor:pointer;font-size:15px;color:#424242;}
.ab-location-option input{width:18px;height:18px;}

/* ===== Campi personalizzati ===== */
.ab-type-fields{margin-top:8px;}
.ab-cf-conditional{margin-top:4px;}
.ab-cf-checkbox{display:flex;align-items:center;gap:8px;cursor:pointer;font-size:15px;}
.ab-cf-checkbox input{width:18px;height:18px;}
.ab-cf-field textarea{width:100%;}
