/* Timeline */

.timeline {
    position: relative;
}

.time-slot {
    display: flex;
    min-height: 32px;
    border-bottom: 1px solid var(--gray-200);
    position: relative;
}

.time-label {
    width: 60px;
    padding: 0.25rem 0.5rem;
    font-weight: 500;
    color: var(--gray-600);
    font-size: 0.75rem;
}

.time-label.bloqueado {
    opacity: 0.3;
}

.time-label.hour-marker {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gray-700);
}

.slot-content {
    flex: 1;
    padding: 0.5rem;
    position: relative;
}

.appointment {
    background: white;
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.2s;
}

.appointment:hover {
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
    transform: translateX(2px);
}

.appointment.confirmed {
    border-left-color: var(--success);
    background: #f0fdf4;
}

.appointment.pending {
    border-left-color: var(--warning);
    background: #fffbeb;
}

.appointment-patient {
    font-weight: 500;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.appointment-service {
    font-size: 0.875rem;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.appointment-badge {
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.cita {
    background: white;
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.2s;
}

.cita-paciente {
    font-weight: 500;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.cita-servicio {
    font-size: 0.875rem;
    color: var(--gray-600);
}

.cita-detalle {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-top: 0.5rem;
}

.appointments {
    flex: 1;
    padding: 0.25rem;
    position: relative;
}

.empty-slot {
    min-height: 25px;
    height: 25px;
    border: 1px dashed #d1d5db;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.empty-slot:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-lighter);
}

.cita-slot {
    transition: all 0.2s ease;
}

.cita-slot:hover {
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
    transform: translateY(-1px);
    background: #fafafa !important;
}

.cita-slot:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cita-slot button:hover {
    opacity: 0.85;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.cita-slot button:active {
    transform: translateY(0);
    opacity: 0.75;
}

.cita-slot select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(32, 178, 170, 0.2);
    background: #ffffff;
}

.cita-slot select:hover {
    background: #ffffff;
    border-color: #9ca3af;
}

.cita-acciones {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.calendar-month {
    font-weight: 500;
    color: var(--gray-800);
}

.calendar-nav {
    display: flex;
    gap: 0.5rem;
}

.calendar-nav button {
    background: none;
    border: none;
    color: var(--gray-600);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.25rem;
}

.calendar-nav button:hover {
    color: var(--primary);
}

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

.calendar-day-label {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-600);
    padding: 0.5rem;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
    position: relative;
}

.calendar-day:hover {
    background: var(--gray-100);
}

.calendar-day.other-month {
    color: var(--gray-400);
}

.calendar-day.today {
    background: var(--primary);
    color: white;
    font-weight: 700;
}

.calendar-day.selected {
    background: var(--accent);
    color: white;
    font-weight: 700;
}

.calendar-day.has-appointments {
    background: #fff5e6;
    font-weight: 600;
    color: var(--primary);
    position: relative;
}

.calendar-day.has-appointments:hover {
    background: #ffe4b3;
}

.appointment-dot {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
}

.appointment-count {
    position: absolute;
    bottom: 0px;
    right: 0px;
    background: var(--primary);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0px 4px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
    line-height: 1.4;
}

.calendar-day.has-appointments.selected {
    background: var(--accent);
    color: white;
}

.calendar-day.has-appointments.selected .appointment-dot {
    background: white;
}

.calendar-day.has-appointments.selected .appointment-count {
    background: white;
    color: var(--accent);
}

.calendar-day.has-appointments.today {
    background: var(--primary);
    color: white;
}

.calendar-day.has-appointments.today .appointment-dot {
    background: white;
}

.calendar-day.has-appointments.today .appointment-count {
    background: white;
    color: var(--primary);
}

.calendar-day.disabled {
    color: var(--gray-400);
    cursor: not-allowed;
    background: #f8fafc;
    opacity: 0.7;
}

.calendar-day.disabled:hover {
    background: #f8fafc;
}

.calendar-day.non-working {
    background: #f3f4f6;
    color: #9ca3af;
}

.calendar-day.non-working:hover {
    background: #e5e7eb;
}

.cita-cancelada {
    background: #fff5f5;
    border-left: 4px solid var(--danger);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    opacity: 0.85;
}

.cita-cancelada-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.cita-cancelada-paciente {
    font-weight: 600;
    color: var(--gray-800);
}

.cita-cancelada-hora {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
}

.cita-cancelada-info {
    font-size: 0.875rem;
    color: var(--gray-600);
    display: flex;
    gap: 1rem;
    margin-bottom: 0.25rem;
}

.cita-cancelada-motivo {
    font-size: 0.75rem;
    color: var(--danger);
    font-style: italic;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #fee;
}

/* Calendario médico */

.calendar-grid-medico {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
}

.calendar-day-medico {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
    position: relative;
    font-weight: 500;
}

.calendar-day-medico:hover {
    background: var(--gray-100);
}

.calendar-day-medico.other-month {
    color: var(--gray-400);
}

.calendar-day-medico.today {
    background: var(--primary);
    color: white;
    font-weight: 700;
}

.calendar-day-medico.selected {
    background: var(--accent);
    color: white;
    font-weight: 700;
}

.calendar-day-medico.has-citas {
    background: #fff5e6;
    font-weight: 600;
    color: var(--primary);
    position: relative;
}

.calendar-day-medico.has-citas:hover {
    background: #ffe4b3;
}

.calendar-day-medico.has-citas.selected {
    background: var(--accent);
    color: white;
}

.calendar-day-medico.has-citas.today {
    background: var(--primary);
    color: white;
}

.appointment-dot-medico {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
}

.appointment-count-medico {
    position: absolute;
    bottom: 0px;
    right: 0px;
    background: var(--primary);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0px 4px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
    line-height: 1.4;
}

.calendar-day-medico.has-citas.selected .appointment-dot-medico,

.calendar-day-medico.has-citas.today .appointment-dot-medico {
    background: white;
}

.calendar-day-medico.has-citas.selected .appointment-count-medico {
    background: white;
    color: var(--accent);
}

.calendar-day-medico.has-citas.today .appointment-count-medico {
    background: white;
    color: var(--primary);
}

/* Timeline de agenda médico */

.timeline-medico {
    position: relative;
}

.time-slot-medico {
    display: flex;
    height: 32px;
    min-height: 32px;
    border-bottom: 1px solid var(--gray-200);
    position: relative;
}

.time-label-medico {
    width: 50px;
    padding: 0.25rem 0.5rem;
    font-weight: 500;
    color: var(--gray-600);
    font-size: 0.7rem;
    min-width: 50px;
}

.time-label-medico.bloqueado {
    opacity: 0.35;
}

.time-label-medico.hour-marker {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gray-700);
}

.empty-slot-medico.bloqueado {
    background: #f8fafc;
    opacity: 0.7;
}

.slot-content-medico {
    flex: 1;
    padding: 0.25rem;
    position: relative;
}

.time-slot-medico.conflicto {
    background: #fef2f2;
}

.timeline-medico-grid {
    position: relative;
    z-index: 1;
}

.timeline-medico-citas {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.timeline-medico-cita {
    position: absolute;
    left: 60px;
    right: 8px;
    pointer-events: auto;
}

.time-slot-medico.ocupado {
    opacity: 0.4;
    pointer-events: none;
}

.cita-medico-item.conflicto {
    border-color: #ef4444 !important;
    border-width: 2px !important;
    background: #fef2f2 !important;
}

.cita-medico-item {
    background: white;
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.2s;
}

.cita-medico-item:hover {
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
    transform: translateX(2px);
}

.cita-medico-item.confirmada {
    border-left-color: var(--success);
    background: #f0fdf4;
}

.cita-medico-item.pendiente {
    border-left-color: var(--warning);
    background: #fffbeb;
}

.cita-medico-item.completada {
    border-left-color: var(--primary);
    background: var(--primary-lighter);
}

.cita-cancelada-medico {
    opacity: 0.6;
    background: #f9fafb;
    border-left: 4px solid #ef4444;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: all 0.2s;
}

.cita-cancelada-medico:hover {
    opacity: 0.8;
    background: #f3f4f6;
    transform: translateX(2px);
}

.timeline-historial {
    position: relative;
    padding-left: 3rem;
    margin-top: 2rem;
}

.timeline-historial::before {
    content: '';
    position: absolute;
    left: 1rem;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.timeline-item {
    position: relative;
    padding-bottom: 2rem;
    padding-left: 1rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -2.25rem;
    top: 0.5rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: white;
    border: 3px solid;
    z-index: 1;
}

.timeline-item.creada::before { border-color: #9ca3af; }

.timeline-item.pendiente::before { border-color: #f59e0b; }

.timeline-item.confirmada::before { border-color: var(--primary); }

.timeline-item.reagendada::before { border-color: var(--primary-light); }

.timeline-item.en_sala_espera::before { border-color: var(--primary-light); }

.timeline-item.en_consulta::before { border-color: var(--primary-dark); }

.timeline-item.completada::before { border-color: #059669; }

.timeline-item.no_asistio::before { border-color: #f97316; }

.timeline-item.cancelada::before { border-color: #ef4444; }

.timeline-fecha {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
    font-weight: 500;
    user-select: none;
    cursor: default;
}

.timeline-evento {
    font-size: 1rem;
    color: #111827;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.timeline-notas {
    font-size: 0.875rem;
    color: #6b7280;
    font-style: italic;
}

.cita.creada,

.cita.pendiente,

.cita.confirmada,

.cita.reagendada,

.cita.en_sala_espera,

.cita.en_consulta,

.cita.completada,

.cita.no_asistio,

.cita.cancelada,

/* Timeline visual del historial */

.historial-timeline {
    position: relative;
    padding-left: 3rem;
    margin-top: 2rem;
}

.historial-timeline::before {
    content: '';
    position: absolute;
    left: 1rem;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.historial-item {
    position: relative;
    padding-bottom: 2rem;
    padding-left: 1rem;
}

.historial-item:last-child {
    padding-bottom: 0;
}

.historial-item::before {
    content: '';
    position: absolute;
    left: -2.25rem;
    top: 0.5rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: white;
    border: 3px solid;
    z-index: 1;
}

.historial-item.creada::before { border-color: #9ca3af; }

.historial-item.pendiente::before { border-color: #f59e0b; }

.historial-item.confirmada::before { border-color: var(--primary); }

.historial-item.reagendada::before { border-color: var(--primary-light); }

.historial-item.en_sala_espera::before { border-color: var(--primary-light); }

.historial-item.en_consulta::before { border-color: var(--primary-dark); }

.historial-item.completada::before { border-color: #059669; }

.historial-item.no_asistio::before { border-color: #f97316; }

.historial-item.cancelada::before { border-color: #ef4444; }

/* Historial Timeline */

.historial-timeline {
    position: relative;
    padding-left: 30px;
}

.timeline-item {
    position: relative;
    padding-bottom: 25px;
    border-left: 2px solid #e2e8f0;
    margin-left: 10px;
}

.timeline-item:last-child {
    border-left: 2px solid transparent;
}

.timeline-dot {
    position: absolute;
    left: -11px;
    top: 5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.timeline-content {
    padding-left: 20px;
    background: white;
    border-radius: 8px;
    padding: 12px 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s;
}

.timeline-content:hover {
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.timeline-estado {
    font-weight: 600;
    font-size: 15px;
}

.timeline-fecha {
    font-size: 12px;
    color: #64748b;
    background: #f1f5f9;
    padding: 3px 8px;
    border-radius: 4px;
}

.timeline-transicion {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 6px;
}

.timeline-usuario {
    font-size: 13px;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.timeline-motivo {
    font-size: 12px;
    color: #64748b;
    font-style: italic;
    margin-top: 6px;
    padding: 6px 10px;
    background: #fef3c7;
    border-left: 3px solid #fbbf24;
    border-radius: 4px;
}

.timeline-notas {
    font-size: 12px;
    color: #475569;
    margin-top: 6px;
    padding: 6px 10px;
    background: #f1f5f9;
    border-radius: 4px;
}
