/* citas_disponibles.css - Clean & Modern Design */
/* Colores corporativos cargados dinámicamente desde configuracion_estilos */

:root {
    /* Variables por defecto (sobrescritas por JS desde BD) */
    --primary-color: #2cbfae;
    --primary-dark: #249d8f;
    --primary-light: #e6fcf5;
    --text-color: #333333;
    --text-muted: #666666;
    --success-color: #2cbfae;
    --warning-color: #F59E0B;
    --error-color: #e03131;
    --background-color: #f4f6f9;
    --card-bg: #ffffff;
    --border-light: #e9ecef;
}

body {
    background-color: var(--background-color);
}

/* --- Tarjeta Flotante Principal --- */
.main-container {
    max-width: 640px;
    margin: 1.5rem auto;
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* --- Cabecera (Alineada Izquierda) --- */
.header-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 1.25rem;
}

.header-section h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-section h1 i {
    font-size: 1.2rem;
    color: var(--primary-color);
}

.section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.75rem;
}

/* --- Profesionales (Tarjetas con Estado) --- */
.profesionales-section {
    margin-bottom: 1.25rem;
}

.profesionales-scroll {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0.25rem 0;
    -webkit-overflow-scrolling: touch;
}

.profesionales-scroll::-webkit-scrollbar {
    height: 4px;
}

.profesionales-scroll::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

.profesional-card {
    flex-shrink: 0;
    width: 75px;
    text-align: center;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 10px;
    border: none;
    background: transparent;
    transition: all 0.2s ease;
}

.profesional-card:hover .profesional-avatar {
    border-color: var(--primary-color);
}

.profesional-card:hover .profesional-name {
    color: var(--primary-color);
}

.profesional-card.selected .profesional-name {
    font-weight: 700;
    color: var(--primary-color);
}

.profesional-card.selected .profesional-avatar {
    border-color: var(--primary-color);
}

.profesional-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 0.4rem;
    border: 2px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: white;
    background: var(--text-muted);
}

.profesional-card.selected .profesional-avatar {
    border-color: var(--primary-color);
}

.profesional-name {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    line-height: 1.2;
}

/* --- Filtros (Inputs Limpios) --- */
.filtros-section {
    margin-bottom: 1.25rem;
}

.service-row {
    position: relative;
    /* User request: "Un poco mas de espacio entre los inputs... estan pegados" */
    margin-bottom: 1.5rem;
}

.filtros-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Ajuste para evitar solapamiento con el botón de eliminar */
.service-row.has-delete .filtros-grid {
    padding-right: 2.5rem;
    /* Deja espacio para el icono */
}

/* User request: "reducir un poco el ancho de los inputs" - Grid padding right does this effectively */

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.4rem;
}

.filter-select {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-select:disabled {
    background: #fafafa;
    cursor: not-allowed;
    color: var(--text-muted);
}

.filter-select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(44, 191, 174, 0.15);
}

/* Botón Añadir Servicio (Corporativo) */
.btn-add-service {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 50px;
    /* Rounded consistent with modern look */
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.btn-add-service:hover {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(44, 191, 174, 0.2);
}

.btn-add-service i {
    font-size: 0.85rem;
}

/* Botón Eliminar Servicio (Moderno) */
.btn-remove-service {
    position: absolute;
    right: 0;
    top: 31px;
    /* Alineado visualmente con el input (approx label height + margin + padding) */
    background: transparent;
    border: none;
    color: var(--error-color);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
}

.btn-remove-service:hover {
    transform: scale(1.1);
    color: #c92a2a;
    /* Darker red */
}


/* --- Calendario (Minimalista) --- */
.calendario-section {
    margin-bottom: 1rem;
}

.calendario-section .calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    background: transparent !important;
    color: var(--text-color) !important;
    padding: 0 !important;
}

.calendario-section .month-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.calendario-section .nav-btn {
    background: var(--card-bg) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: 6px !important;
    padding: 0.4rem 0.6rem !important;
    cursor: pointer;
    color: var(--text-muted) !important;
    transition: all 0.15s;
}

.calendario-section .nav-btn:hover:not(:disabled) {
    background: var(--primary-light) !important;
    border-color: var(--primary-color) !important;
    color: var(--primary-color) !important;
}

.calendario-section .nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    text-align: center;
}

.weekday-header {
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 0.3rem 0;
    font-weight: 600;
    text-transform: uppercase;
}

.cal-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 2px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
    font-size: 0.8rem;
    color: var(--text-color);
    gap: 2px;
}

.cal-day.empty {
    cursor: default;
}

.cal-day:not(.empty):not(.disabled):hover {
    background: var(--primary-light);
}

.cal-day.selected {
    background: var(--primary-color) !important;
    color: white !important;
    font-weight: 600;
}

.cal-day.disabled {
    opacity: 0.35;
    pointer-events: none;
}

/* Indicadores de disponibilidad */
.disponibilidad-indicator {
    width: 5px;
    height: 5px;
    border-radius: 50%;
}

.disponibilidad-indicator.disponible {
    background-color: var(--success-color);
}

.disponibilidad-indicator.pocos {
    background-color: var(--warning-color);
}

.disponibilidad-indicator.lleno {
    background-color: var(--error-color);
}

/* Leyenda del calendario */
.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.5rem;
    padding: 0.4rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.disponibilidad-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.disponibilidad-dot.disponible {
    background-color: var(--success-color);
}

.disponibilidad-dot.pocos {
    background-color: var(--warning-color);
}

.disponibilidad-dot.lleno {
    background-color: var(--error-color);
}

/* --- Horarios --- */
.horarios-section {
    margin-bottom: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-light);
}

.horarios-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
}

.slot-btn {
    padding: 0.5rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--card-bg);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-color);
}

.slot-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
}

.slot-btn.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* --- Formulario Reserva --- */
.form-section {
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.summary-box {
    background: var(--primary-light);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-color);
    border-left: 4px solid var(--primary-color);
}

.summary-box div {
    margin-bottom: 0.25rem;
}

.summary-box div:last-child {
    margin-bottom: 0;
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.35rem;
}

.form-input {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--card-bg);
    color: var(--text-color);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.form-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(44, 191, 174, 0.15);
}

/* Textarea específico */
textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

/* --- Botón Principal --- */
.btn-submit {
    display: block;
    width: 100%;
    padding: 0.85rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 0.5rem;
}

.btn-submit:hover {
    background: var(--primary-dark);
}

.btn-submit:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

/* --- Utilidades --- */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.p-5 {
    padding: 2rem;
}

.w-100 {
    width: 100%;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .main-container {
        margin: 0.75rem;
        padding: 1rem;
        border-radius: 12px;
    }

    .filtros-grid {
        grid-template-columns: 1fr;
    }

    .horarios-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .calendar-legend {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .header-section h1 {
        font-size: 1.2rem;
    }

    .profesional-card {
        width: 65px;
    }

    .profesional-avatar {
        width: 42px;
        height: 42px;
    }

    .profesional-name {
        font-size: 0.65rem;
    }

    .horarios-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* --- Modal de Reserva --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    /* Oculto por defecto */
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-overlay.show {
    display: flex !important;
    opacity: 1 !important;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    background: var(--primary-color);
    color: white;
    padding: 1rem 1.25rem;
    border-radius: 16px 16px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-body {
    padding: 1.25rem;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-action.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-action.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-action.btn-secondary {
    background: var(--primary-light);
    color: var(--primary-dark);
    border: 1px solid var(--primary-color);
}

.btn-action.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-action.btn-cancel {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-light);
}

.btn-action.btn-cancel:hover {
    background: var(--error-color);
    color: white;
    border-color: var(--error-color);
}

@media (max-width: 480px) {
    .modal-content {
        max-height: 95vh;
        border-radius: 12px;
    }

    .modal-header {
        border-radius: 12px 12px 0 0;
    }
}