/**
 * Estilos para el sistema de agendamiento público
 * Telemedicina Pro - Frontend Booking
 *
 * @package Telemedicina_Pro
 * @since 1.0.0
 */

/* Banner de promoción */
.telemedicina-banner {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.telemedicina-banner h3 {
    margin: 0 0 10px 0;
    font-size: 24px;
}

.telemedicina-banner p {
    margin: 0 0 15px 0;
    font-size: 16px;
    opacity: 0.9;
}

.telemedicina-banner .btn-banner {
    background: white;
    color: var(--primary-color);
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
    transition: var(--transition);
}

.telemedicina-banner .btn-banner:hover {
    background: var(--light-color);
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .telemedicina-banner {
        padding: 15px;
    }
    
    .telemedicina-banner h3 {
        font-size: 20px;
    }
}

/* Banner de servicio */
.telemedicina-banner-servicio {
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    margin-bottom: 30px;
    position: relative;
    min-height: 200px;
    transition: var(--transition);
    cursor: pointer;
}

.telemedicina-banner-servicio:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.telemedicina-banner-imagen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0.2;
    z-index: 1;
    transition: opacity 0.3s ease;
}

.telemedicina-banner-servicio:hover .telemedicina-banner-imagen {
    opacity: 0.3;
}

.telemedicina-banner-contenido {
    padding: 30px;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.telemedicina-banner-titulo {
    font-size: 28px;
    font-weight: bold;
    margin: 0 0 15px 0;
    color: var(--primary-color);
}

.telemedicina-banner-descripcion {
    font-size: 16px;
    color: var(--text-color);
    margin: 0 0 15px 0;
    line-height: 1.5;
}

.telemedicina-banner-precio {
    font-size: 20px;
    font-weight: bold;
    color: var(--success-color);
    margin: 0 0 20px 0;
}

.telemedicina-banner-boton {
    background: var(--primary-color);
    color: white;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: bold;
    transition: var(--transition);
    display: inline-block;
}

.telemedicina-banner-boton:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    color: white;
    text-decoration: none;
}

/* Estilos para el flujo inteligente */
.telemedicina-smart-flow-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--success-color);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    z-index: 3;
}

.telemedicina-redirect-message {
    background: var(--info-color);
    color: white;
    padding: 15px;
    border-radius: var(--border-radius);
    margin: 20px 0;
    text-align: center;
    animation: fadeIn 0.5s ease-in;
}

.telemedicina-redirect-message .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
}

/* Indicador de autenticación requerida */
.telemedicina-auth-required {
    background: var(--warning-color);
    color: white;
    padding: 15px;
    border-radius: var(--border-radius);
    margin: 20px 0;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.telemedicina-auth-required .icon {
    font-size: 18px;
}

/* Animaciones para el flujo inteligente */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.telemedicina-banner-descripcion {
    font-size: 16px;
    margin: 0 0 20px 0;
    color: var(--dark-color);
    max-width: 600px;
}

.telemedicina-banner-precio {
    font-size: 24px;
    font-weight: bold;
    margin: 0 0 20px 0;
    color: var(--success-color);
}

.telemedicina-banner-boton {
    display: inline-block;
    padding: 12px 25px;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: bold;
    transition: var(--transition);
}

.telemedicina-banner-boton:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    .telemedicina-banner-servicio {
        min-height: 180px;
    }
    
    .telemedicina-banner-contenido {
        padding: 20px;
    }
    
    .telemedicina-banner-titulo {
        font-size: 22px;
    }
    
    .telemedicina-banner-descripcion {
        font-size: 14px;
    }
    
    .telemedicina-banner-precio {
        font-size: 20px;
    }
}

/* Reset y variables CSS */
.telemedicina-booking-wrapper {
    --secondary-color: #6c757d;
    --danger-color: #dc3545;
    --border-color: #dee2e6;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Contenedor principal */
.telemedicina-booking-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--dark-color);
}

.telemedicina-booking-wrapper * {
    box-sizing: border-box;
}

/* Indicador de progreso */
.telemedicina-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    padding: 20px 0;
    position: relative;
}

.telemedicina-progress::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border-color);
    z-index: 1;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    flex: 1;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--light-color);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-bottom: 8px;
    transition: var(--transition);
}

.step-label {
    font-size: 12px;
    text-align: center;
    color: var(--secondary-color);
    transition: var(--transition);
}

.progress-step.active .step-number {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.progress-step.active .step-label {
    color: var(--primary-color);
    font-weight: 600;
}

.progress-step.completed .step-number {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.progress-step.completed .step-number::after {
    content: '✓';
}

/* Contenedor de contenido */
#telemedicina-booking-content {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 30px;
    margin-bottom: 20px;
}

.telemedicina-step h2 {
    margin: 0 0 30px 0;
    color: var(--primary-color);
    font-size: 28px;
    font-weight: 600;
    text-align: center;
}

/* Paso 1: Selección de servicio */
.service-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.service-card {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0;
    transition: var(--transition);
    cursor: pointer;
    overflow: hidden;
    background: white;
}

.service-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--box-shadow);
}

.service-card.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
}

.card-header {
    background: var(--light-color);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    margin: 0;
    font-size: 20px;
    color: var(--primary-color);
}

.price {
    font-size: 24px;
    font-weight: bold;
    color: var(--success-color);
}

.card-body {
    padding: 20px;
}

.description {
    margin: 0 0 15px 0;
    color: var(--secondary-color);
    line-height: 1.5;
}

.duration {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--info-color);
    font-size: 14px;
}

.icon-clock::before {
    content: '🕐';
}

.card-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background: var(--light-color);
}

.btn-select-service {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-select-service:hover {
    background: var(--primary-hover);
}

/* Formularios */
.telemedicina-booking-wrapper .form-group {
    margin-bottom: 20px;
}

.telemedicina-booking-wrapper .form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.telemedicina-booking-wrapper .form-row .form-group {
    margin-bottom: 0;
    flex: 1;
}

.telemedicina-booking-wrapper .col-md-4 {
    flex: 0 0 33.333333%;
}

.telemedicina-booking-wrapper .col-md-6 {
    flex: 0 0 50%;
}

.telemedicina-booking-wrapper label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--dark-color);
}

.telemedicina-booking-wrapper .form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: var(--transition);
    background: white;
}

.telemedicina-booking-wrapper .form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
}

.telemedicina-booking-wrapper .form-control.is-invalid {
    border-color: var(--danger-color);
}

.telemedicina-booking-wrapper .form-control[readonly] {
    background: var(--light-color);
    color: var(--secondary-color);
}

/* Mensajes de validación */
.validation-message {
    margin-top: 5px;
    font-size: 14px;
    color: var(--danger-color);
    display: none;
}

.validation-message.show {
    display: block;
}

/* Estado de usuario */
.user-status {
    padding: 20px;
    border-radius: var(--border-radius);
    margin: 20px 0;
    text-align: center;
}

.user-status.exists {
    background: var(--info-color);
    color: white;
}

.user-status.available {
    background: var(--success-color);
    color: white;
}

/* Calendario */
.calendar-container {
    margin: 20px 0;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--light-color);
    border-radius: var(--border-radius);
}

.btn-nav {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: var(--transition);
}

.btn-nav:hover {
    background: var(--primary-hover);
}

#calendar-title {
    margin: 0;
    color: var(--primary-color);
    font-size: 20px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.calendar-day {
    background: white;
    padding: 8px 4px;
    text-align: center;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    position: relative;
    border: 1px solid transparent;
    transition: var(--transition);
}

.calendar-day.header {
    background: var(--primary-color);
    color: white;
    font-weight: bold;
    min-height: auto;
    padding: 10px;
}

.calendar-day.empty {
    background: var(--light-color);
    opacity: 0.3;
}

.calendar-day.past {
    background: #f5f5f5;
    color: var(--secondary-color);
    opacity: 0.6;
}

.calendar-day.weekend {
    background: #fff3cd;
    color: #856404;
}

.calendar-day.today {
    border: 2px solid var(--primary-color);
    background: #e3f2fd;
}

.calendar-day.has-slots {
    background: #f0fff4;
    border-color: var(--success-color);
}

.calendar-day.has-slots:hover {
    background: #e8f5e8;
    transform: translateY(-2px);
    box-shadow: var(--box-shadow);
}

.day-number {
    font-weight: bold;
    margin-bottom: 5px;
}

.time-slots {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.time-slot {
    padding: 3px 4px;
    font-size: 10px;
    border-radius: 3px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    margin: 1px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.time-slot.available {
    background: var(--success-color);
    color: white;
}

.time-slot.available:hover {
    background: #1e7e34;
}

.time-slot.occupied {
    background: var(--secondary-color);
    color: white;
    cursor: not-allowed;
}

.time-slot.selected {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 0 0 2px rgba(44, 90, 160, 0.3);
    font-weight: bold;
}

.no-slots {
    font-size: 9px;
    color: var(--secondary-color);
    font-style: italic;
    margin-top: auto;
    padding: 2px;
}

/* Información del slot seleccionado */
.selected-slot-info {
    background: var(--light-color);
    padding: 20px;
    border-radius: var(--border-radius);
    margin: 20px 0;
    border-left: 4px solid var(--primary-color);
}

.selected-slot-info h4 {
    margin: 0 0 15px 0;
    color: var(--primary-color);
}

.slot-details p {
    margin: 5px 0;
}

/* Confirmación */
.confirmation-summary {
    display: grid;
    gap: 25px;
    margin: 30px 0;
}

.summary-section {
    background: var(--light-color);
    padding: 20px;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.summary-section h3 {
    margin: 0 0 15px 0;
    color: var(--primary-color);
    font-size: 18px;
}

.summary-section p {
    margin: 5px 0;
}

.total-section {
    background: var(--primary-color);
    color: white;
    text-align: center;
    border-left: none;
}

.total-section h3 {
    color: white;
}

.total-amount {
    font-size: 36px;
    font-weight: bold;
    margin: 10px 0;
}

/* Botones */
.form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    flex-wrap: wrap;
}

.telemedicina-booking-wrapper .btn-primary,
.telemedicina-booking-wrapper .btn-secondary {
    padding: 12px 30px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
    text-align: center;
    min-width: 120px;
}

.telemedicina-booking-wrapper .btn-primary {
    background: var(--primary-color) !important;
    color: white;
}

.telemedicina-booking-wrapper .btn-primary:hover:not(:disabled) {
    background: var(--primary-hover) !important;
}

.telemedicina-booking-wrapper .btn-primary:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.telemedicina-booking-wrapper .btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.telemedicina-booking-wrapper .btn-secondary:hover {
    background: #545b62;
}

.telemedicina-booking-wrapper .btn-large {
    padding: 15px 40px;
    font-size: 18px;
    min-width: 200px;
}

/* Loading */
.telemedicina-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: white;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

/* Animaciones */
.telemedicina-step {
    animation: fadeInUp 0.5s ease;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .telemedicina-booking-wrapper {
        padding: 15px;
    }
    
    #telemedicina-booking-content {
        padding: 20px;
    }
    
    .telemedicina-progress {
        margin-bottom: 30px;
    }
    
    .step-label {
        font-size: 10px;
    }
    
    .service-cards {
        grid-template-columns: 1fr;
    }
    
    .telemedicina-booking-wrapper .form-row {
        flex-direction: column;
        gap: 0;
    }

    .telemedicina-booking-wrapper .form-row .form-group {
        margin-bottom: 20px;
    }
    
    .calendar-grid {
        grid-template-columns: 1fr;
    }
    
    .calendar-day {
        min-height: auto;
        padding: 10px;
    }
    
    .time-slots {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .time-slot {
        flex: 0 0 auto;
        min-width: 60px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .telemedicina-step h2 {
        font-size: 24px;
    }
    
    .card-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .price {
        font-size: 20px;
    }
    
    .total-amount {
        font-size: 28px;
    }
    
    .step-number {
        width: 35px;
        height: 35px;
    }
    
    .telemedicina-progress::before {
        display: none;
    }
}

/* Temas alternativos */
.theme-medical {
    --primary-color: #0d7377;
    --primary-hover: #0a5d61;
}

.theme-modern {
    --primary-color: #6f42c1;
    --primary-hover: #5a359a;
}

.theme-professional {
    --primary-color: #495057;
    --primary-hover: #343a40;
}

/* Estados de error */
.error-message {
    background: var(--danger-color);
    color: white;
    padding: 15px;
    border-radius: var(--border-radius);
    margin: 15px 0;
    text-align: center;
}

.success-message {
    background: var(--success-color);
    color: white;
    padding: 15px;
    border-radius: var(--border-radius);
    margin: 15px 0;
    text-align: center;
}

/* Accesibilidad */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus states para accesibilidad */
.telemedicina-booking-wrapper .btn-primary:focus,
.telemedicina-booking-wrapper .btn-secondary:focus,
.telemedicina-booking-wrapper .form-control:focus,
.telemedicina-booking-wrapper .service-card:focus,
.telemedicina-booking-wrapper .time-slot:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .telemedicina-progress,
    .form-actions,
    .btn-nav {
        display: none;
    }
    
    .telemedicina-booking-wrapper {
        box-shadow: none;
        max-width: none;
    }
    
    #telemedicina-booking-content {
        box-shadow: none;
        border: 1px solid #000;
    }
}
