/* ===================================
   Estilos Modernos - Módulo Pacientes
   Sistema Odonto Ynga
   =================================== */

/* Variables CSS */
:root {
    --primary-color: #3b82f6;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    --dark-color: #1f2937;
    --light-bg: #f9fafb;
    --white: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

/* ===================================
   PÁGINA DE LISTA DE PACIENTES
   =================================== */

/* Contenedor principal */
.patients-container {
    padding: 20px;
    background: var(--light-bg);
    min-height: 100vh;
}

/* Header con estadísticas */
.patients-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    transition: var(--transition);
    border: 2px solid transparent;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 20px;
    font-size: 24px;
}

.stat-icon.patients {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
}

.stat-icon.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary-color);
}

.stat-icon.treatments {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.stat-content h3 {
    font-size: 32px;
    font-weight: 700;
    color: var(--dark-color);
    margin: 0;
}

.stat-content p {
    color: #6b7280;
    margin: 5px 0 0 0;
    font-size: 14px;
}

/* Barra de herramientas */
.patients-toolbar {
    background: var(--white);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.search-box {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-box i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

/* Botones modernos */
.btn-modern {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-modern:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary-modern {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary-modern:hover {
    background: #2563eb;
    color: var(--white);
}

/* Tabla moderna */
.patients-table-container {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.patients-table {
    width: 100%;
    border-collapse: collapse;
}

.patients-table thead {
    background: var(--light-bg);
}

.patients-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 14px;
    border-bottom: 2px solid #e5e7eb;
}

.patients-table tbody tr {
    border-bottom: 1px solid #f3f4f6;
    transition: var(--transition);
}

.patients-table tbody tr:hover {
    background: #f9fafb;
}

.patients-table td {
    padding: 16px;
    vertical-align: middle;
}

/* Avatar del paciente en la tabla */
.patient-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.patient-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.patient-info {
    display: flex;
    flex-direction: column;
}

.patient-name {
    font-weight: 600;
    color: var(--dark-color);
}

.patient-dni {
    font-size: 12px;
    color: #6b7280;
}

/* Badges para edad y sexo */
.badge-age {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: #e0e7ff;
    color: #4338ca;
}

.badge-gender-m {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: #dbeafe;
    color: #1e40af;
}

.badge-gender-f {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: #fce7f3;
    color: #a21caf;
}

/* Acciones */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-action {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: var(--white);
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-action:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(59, 130, 246, 0.05);
}

.btn-action.view:hover {
    border-color: var(--info-color);
    color: var(--info-color);
    background: rgba(6, 182, 212, 0.05);
}

.btn-action.edit:hover {
    border-color: var(--warning-color);
    color: var(--warning-color);
    background: rgba(245, 158, 11, 0.05);
}

.btn-action.delete:hover {
    border-color: var(--danger-color);
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.05);
}

/* ===================================
   FORMULARIO AGREGAR/EDITAR PACIENTE
   =================================== */

.patient-form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.form-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    padding: 30px;
}

.form-header {
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.form-header h2 {
    color: var(--dark-color);
    font-size: 24px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-header h2 i {
    color: var(--primary-color);
}

/* Grupos de formulario */
.form-section {
    margin-bottom: 30px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title i {
    color: var(--primary-color);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-group-modern {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark-color);
    font-size: 14px;
}

.form-label .required {
    color: var(--danger-color);
}

.form-control-modern {
    width: 100%;
    padding: 10px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: var(--transition);
    background: var(--white);
}

.form-control-modern:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Selector de teléfono con país */
.phone-input-group {
    display: flex;
    gap: 10px;
}

.country-selector {
    width: 220px;
    position: relative;
}

.country-selector select {
    width: 100%;
    padding: 10px 40px 10px 45px;
    appearance: none;
    background: var(--white);
    cursor: pointer;
}

.country-flag {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 18px;
    border-radius: 2px;
    object-fit: cover;
}

.phone-input {
    flex: 1;
}

/* Selector de fecha mejorado */
.date-input-group {
    position: relative;
}

.date-input-group i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}

/* Botón búsqueda RENIEC */
.search-reniec {
    display: flex;
    gap: 10px;
}

.btn-reniec {
    background: var(--info-color);
    color: var(--white);
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-reniec:hover {
    background: #0891b2;
    transform: translateY(-1px);
}

/* ===================================
   VISTA DE PACIENTE
   =================================== */

.patient-view-container {
    padding: 20px;
}

/* Header del paciente */
.patient-header-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    padding: 30px;
    margin-bottom: 30px;
}

.patient-header-content {
    display: flex;
    align-items: center;
    gap: 30px;
    background-color: #3855db1c;
    border-radius: 15px;
}

.patient-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 600;
}

.patient-details h1 {
    color: var(--dark-color);
    margin: 0 0 10px 0;
    font-size: 28px;
}

.patient-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6b7280;
    font-size: 14px;
}

.meta-item i {
    color: var(--primary-color);
}

/* Tabs de navegación */
.patient-tabs {
    background: #b1c3ef;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 30px;
    display: flex;
    overflow-x: auto;
}

.tab-item {
    flex: 1;
    padding: 16px 24px;
    text-align: center;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 500;
    color: #000000;
    transition: var(--transition);
    position: relative;
    white-space: nowrap;
}

.tab-item:hover {
    color: var(--primary-color);
    background: rgba(59, 130, 246, 0.05);
}

.tab-item.active {
    color: var(--primary-color);
}

.tab-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
}

/* Sección de radiografías */
.radiography-section {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 25px;
    margin-bottom: 30px;
}

.radiography-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.radiography-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.radiography-card {
    border: 2px solid #e5e7eb;
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
}

.radiography-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.radiography-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #f3f4f6;
}

.radiography-info {
    padding: 15px;
}

.radiography-date {
    font-size: 12px;
    color: #6b7280;
}

.radiography-description {
    font-size: 14px;
    color: var(--dark-color);
    margin: 8px 0;
}

.radiography-actions {
    display: flex;
    gap: 8px;
}

/* Timeline de tratamientos */
.treatment-timeline {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 25px;
}

.timeline-item {
    display: flex;
    gap: 20px;
    padding: 20px 0;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}

.timeline-item:last-child {
    border-bottom: none;
}

.timeline-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.timeline-content {
    flex: 1;
}

.timeline-date {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
}

.timeline-title {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 4px;
}

.timeline-details {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: #6b7280;
}

/* Odontograma mejorado */
.odontogram-container {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 25px;
    margin-top: 30px;
}

.teeth-chart-modern {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .patients-stats {
        grid-template-columns: 1fr;
    }
    
    .patients-toolbar {
        flex-direction: column;
    }
    
    .search-box {
        max-width: 100%;
    }
    
    .patients-table {
        font-size: 13px;
    }
    
    .patients-table th,
    .patients-table td {
        padding: 12px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 4px;
    }
    
    .btn-action {
        width: 32px;
        height: 32px;
    }
    
    .patient-header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .phone-input-group {
        flex-direction: column;
    }
    
    .country-selector {
        width: 100%;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease-out;
}

/* Loading states */
.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Tooltips */
.tooltip-modern {
    position: relative;
}

.tooltip-modern::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark-color);
    color: var(--white);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.tooltip-modern:hover::after {
    opacity: 1;
}

/* Estados vacíos */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 64px;
    color: #e5e7eb;
    margin-bottom: 20px;
}

.empty-state h3 {
    color: var(--dark-color);
    margin-bottom: 10px;
}

.empty-state p {
    color: #6b7280;
    margin-bottom: 20px;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .patients-container {
        background: white;
    }
    
    .form-card,
    .patient-header-card,
    .radiography-section,
    .treatment-timeline {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
}


/* Estilos adicionales para el historial mejorado  */
.treatment-timeline.enhanced {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.timeline-header h3 {
    font-size: 20px;
    color: var(--dark-color);
    margin: 0;
}

.timeline-filters {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

.filter-group .form-control-modern {
    width: auto;
    min-width: 150px;
    height: 38px;
    font-size: 14px;
}

/* Grupo de fecha */
.date-group {
    margin-bottom: 30px;
    background: #f9fafb;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.date-group:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.date-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: white;
    cursor: pointer;
    user-select: none;
}

.date-header:hover {
    background: #f9fafb;
}

.date-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.date-icon {
    width: 50px;
    height: 50px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.date-text h4 {
    margin: 0;
    color: var(--dark-color);
    font-size: 18px;
}

.date-text p {
    margin: 4px 0 0 0;
    color: #6b7280;
    font-size: 14px;
}

.date-summary {
    text-align: right;
}

.date-total {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark-color);
}

.date-count {
    font-size: 14px;
    color: #6b7280;
}

.toggle-icon {
    font-size: 20px;
    color: #9ca3af;
    transition: transform 0.3s ease;
}

.date-group.expanded .toggle-icon {
    transform: rotate(180deg);
}

/* Tratamientos del día */
.date-treatments {
    display: none;
    padding: 0 20px 20px;
}

.date-group.expanded .date-treatments {
    display: block;
}

.treatment-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.treatment-card:hover {
    border-color: var(--primary-color);
    transform: translateX(5px);
}

.treatment-card:last-child {
    margin-bottom: 0;
}

.treatment-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.treatment-icon {
    width: 40px;
    height: 40px;
    background: #f3f4f6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
}

.treatment-details h5 {
    margin: 0;
    color: var(--dark-color);
    font-size: 16px;
    font-weight: 600;
}

.treatment-meta {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

.meta-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #6b7280;
}

.meta-chip i {
    font-size: 12px;
}

.treatment-price {
    text-align: right;
}

.price-amount {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark-color);
}

.price-label {
    font-size: 12px;
    color: #6b7280;
}

/* Estados de tratamiento */
.treatment-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 10px;
}

.status-completed {
    background: #d1fae5;
    color: #065f46;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

/* Paginación mejorada */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
}

.pagination-info {
    font-size: 14px;
    color: #6b7280;
}

.pagination-controls {
    display: flex;
    gap: 8px;
}

.page-btn {
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    background: white;
    color: #374151;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.page-btn:hover:not(.active):not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.page-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Estado vacío */
.empty-history {
    text-align: center;
    padding: 60px 20px;
}

.empty-history i {
    font-size: 64px;
    color: #e5e7eb;
    margin-bottom: 20px;
}

.empty-history h4 {
    color: var(--dark-color);
    margin-bottom: 10px;
}

.empty-history p {
    color: #6b7280;
}

/* Loading */
.history-loading {
    text-align: center;
    padding: 40px;
}

.history-loading i {
    font-size: 32px;
    color: var(--primary-color);
    animation: spin 1s linear infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .timeline-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .timeline-filters {
        flex-direction: column;
        width: 100%;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-group .form-control-modern {
        width: 100%;
    }
    
    .date-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .treatment-card {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .treatment-left {
        flex-direction: column;
    }
    
    .treatment-meta {
        justify-content: center;
    }
    
    .pagination-container {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}

/* Estilos para las tabs */
    .tab-content {
        display: none;
        animation: fadeIn 0.3s ease;
    }

    .tab-content.active {
        display: block;
    }

    /* Grid de resumen */
    .summary-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
        margin-bottom: 30px;
    }

    .summary-card {
        background: white;
        border-radius: 12px;
        padding: 25px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
        display: flex;
        align-items: center;
        gap: 20px;
    }

    .summary-icon {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
    }

    .summary-icon.visits {
        background: rgba(59, 130, 246, 0.1);
        color: #3b82f6;
    }

    .summary-icon.treatments {
        background: rgba(16, 185, 129, 0.1);
        color: #10b981;
    }

    .summary-icon.spent {
        background: rgba(245, 158, 11, 0.1);
        color: #f59e0b;
    }

    .summary-icon.files {
        background: rgba(139, 92, 246, 0.1);
        color: #8b5cf6;
    }

    .summary-content h3 {
        font-size: 14px;
        color: #6b7280;
        margin: 0;
    }

    .summary-number {
        font-size: 28px;
        font-weight: 700;
        color: #1f2937;
        margin: 5px 0 0 0;
    }

    /* Tratamientos recientes */
    .recent-treatments {
        background: white;
        border-radius: 12px;
        padding: 25px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    }

    .recent-treatments h3 {
        font-size: 18px;
        margin-bottom: 20px;
        color: #1f2937;
    }

    .treatments-list {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .treatment-item {
        display: flex;
        gap: 20px;
        padding: 15px;
        background: #f9fafb;
        border-radius: 8px;
        transition: all 0.2s;
    }

    .treatment-item:hover {
        background: #f3f4f6;
    }

    .treatment-date {
        font-weight: 600;
        color: #6b7280;
        min-width: 80px;
    }

    .treatment-name {
        font-weight: 600;
        color: #1f2937;
    }

    .treatment-details {
        font-size: 14px;
        color: #6b7280;
    }

    /* Vista previa de archivos */
    .file-preview {
        width: 100%;
        height: 200px;
        background: #f3f4f6;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .file-icon-large {
        font-size: 64px;
        color: #9ca3af;
        margin-bottom: 10px;
    }

    .file-extension {
        font-size: 18px;
        font-weight: 600;
        color: #6b7280;
        text-transform: uppercase;
    }

    /* Modal de imagen */
    .image-modal {
        display: none;
        position: fixed;
        z-index: 9999;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.9);
        cursor: pointer;
    }

    .image-modal .modal-content {
        margin: auto;
        display: block;
        max-width: 90%;
        max-height: 90%;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    .close-modal {
        position: absolute;
        top: 20px;
        right: 35px;
        color: #f1f1f1;
        font-size: 40px;
        font-weight: bold;
        cursor: pointer;
    }

    .close-modal:hover {
        color: #bbb;
    }

    /* Tabla de pagos */
    .payments-section {
        background: white;
        border-radius: 12px;
        padding: 25px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    }

    .payments-summary {
        display: flex;
        gap: 40px;
        padding: 20px;
        background: #f9fafb;
        border-radius: 8px;
        margin-bottom: 25px;
    }

    .payment-stat {
        display: flex;
        flex-direction: column;
    }

    .payment-label {
        font-size: 14px;
        color: #002673;
    }

    .payment-value {
        font-size: 24px;
        font-weight: 700;
        color: #1f2937;
    }

    .payments-table {
        width: 100%;
        border-collapse: collapse;
    }

    .payments-table th {
        background: #f9fafb;
        padding: 12px;
        text-align: left;
        font-weight: 600;
        color: #374151;
        font-size: 14px;
        border-bottom: 2px solid #e5e7eb;
    }

    .payments-table td {
        padding: 12px;
        border-bottom: 1px solid #f3f4f6;
    }

    .badge {
        display: inline-block;
        padding: 4px 12px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 600;
    }

    .badge-success {
        background: #d1fae5;
        color: #065f46;
    }

    .badge-warning {
        background: #fef3c7;
        color: #92400e;
    }

    /* Responsive */
    @media (max-width: 768px) {
        .patient-header-content {
            flex-direction: column;
            text-align: center;
        }

        .patient-meta {
            justify-content: center;
        }

        .patient-tabs {
            overflow-x: auto;
        }

        .summary-grid {
            grid-template-columns: 1fr;
        }

        .payments-summary {
            flex-direction: column;
            gap: 15px;
        }
    }

/* Estilos adicionales para pagos */

.payments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 20px;
}

.payments-filters {
    display: flex;
    gap: 15px;
    align-items: center;
}

.payments-filters .form-control-modern {
    width: auto;
    min-width: 120px;
    height: 36px;
    font-size: 14px;
}

/* Mejorar el resumen */
.payments-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 25px;
    background: #b1c3ef;
    border-radius: 12px;
    margin-bottom: 25px;
}

.payment-stat {
    text-align: center;
    color: white;
}

.payment-label {
    font-size: 14px;
    opacity: 0.9;
    display: block;
    margin-bottom: 8px;
}

.payment-value {
    font-size: 28px;
    font-weight: 700;
    display: block;
}

.payment-value.text-success {
    color: #12a561d0;
}

.payment-value.text-danger {
    color: #dd2222;
}

/* Mejorar tabla */
.payments-table {
    width: 100%;
    border-collapse: collapse;
}

.payments-table thead {
    background: #f9fafb;
}

.payments-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
    border-bottom: 2px solid #e5e7eb;
}

.payments-table tbody tr {
    border-bottom: 1px solid #f3f4f6;
    transition: all 0.2s ease;
}

.payments-table tbody tr:hover {
    background: #f9fafb;
}

.payments-table td {
    padding: 12px;
    vertical-align: middle;
}

/* Servicios en la factura */
.invoice-services {
    font-size: 13px;
    color: #6b7280;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.invoice-services:hover {
    overflow: visible;
    white-space: normal;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 8px;
    border-radius: 6px;
    position: relative;
    z-index: 10;
}

/* Botones de acción */
.action-buttons {
    display: flex;
    gap: 6px;
}

.btn-action {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    background: white;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.btn-action:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(59, 130, 246, 0.05);
}

.btn-action.print:hover {
    border-color: #10b981;
    color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}

.btn-action.pay:hover {
    border-color: #f59e0b;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.05);
}

/* Loading para pagos */
.payments-loading {
    text-align: center;
    padding: 40px;
}

.payments-loading i {
    font-size: 32px;
    color: var(--primary-color);
    animation: spin 1s linear infinite;
}

/* Estado vacío */
.empty-payments {
    text-align: center;
    padding: 60px 20px;
}

.empty-payments i {
    font-size: 64px;
    color: #e5e7eb;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .payments-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .payments-filters {
        flex-direction: column;
        width: 100%;
    }
    
    .payments-summary {
        grid-template-columns: 1fr;
    }
    
    .payments-table {
        font-size: 12px;
    }
    
    .payments-table th:nth-child(3),
    .payments-table td:nth-child(3) {
        display: none; /* Ocultar columna servicios en móvil */
    }
}

/* Header mejorado */
.radiography-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.files-count {
    background: #e5e7eb;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    color: #6b7280;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.radiography-filters {
    display: flex;
    gap: 10px;
}

.radiography-filters .form-control-modern {
    width: auto;
    min-width: 140px;
    height: 38px;
    font-size: 14px;
}

/* Grid mejorado */
.radiography-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Cards mejoradas */
.radiography-card {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    background: white;
    position: relative;
}

.radiography-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    transform: translateY(-4px);
}

/* Indicador de tipo de archivo */
.file-type-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.radiography-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: #f3f4f6;
}

.file-preview {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.file-icon-large {
    font-size: 56px;
    margin-bottom: 10px;
}

.file-icon-large.fa-file-pdf { color: #dc2626; }
.file-icon-large.fa-file-archive { color: #7c3aed; }
.file-icon-large.fa-cube { color: #059669; }

.radiography-info {
    padding: 15px;
}

.radiography-date {
    font-size: 12px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 5px;
}

.file-size {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
}

.radiography-description {
    font-size: 14px;
    color: var(--dark-color);
    margin: 8px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.radiography-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.btn-action {
    flex: 1;
    padding: 8px;
    border: 1px solid #e5e7eb;
    background: white;
    color: #6b7280;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    text-decoration: none;
}

.btn-action:hover {
    background: #f9fafb;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-action.download:hover {
    border-color: #10b981;
    color: #10b981;
}

.btn-action.delete:hover {
    border-color: #ef4444;
    color: #ef4444;
}

/* Botón cargar más */
.load-more-container {
    text-align: center;
    padding: 30px;
}

.btn-load-more {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-load-more:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-load-more.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.load-more-info {
    margin-top: 10px;
    color: #6b7280;
    font-size: 14px;
}

/* Modal mejorado */
.image-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.95);
    backdrop-filter: blur(10px);
}

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    font-size: 20px;
}

.modal-nav:hover {
    background: rgba(255,255,255,0.2);
}

.modal-nav.prev { left: 20px; }
.modal-nav.next { right: 20px; }

.modal-info {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
}

/* Loading */
.radiography-loading {
    text-align: center;
    padding: 60px;
    color: #6b7280;
}

.radiography-loading i {
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .radiography-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .header-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .radiography-filters {
        width: 100%;
        flex-direction: column;
    }
    
    .radiography-filters .form-control-modern {
        width: 100%;
    }
    
    .radiography-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .modal-nav {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

/* Animación de entrada */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.radiography-card {
    animation: fadeInUp 0.5s ease backwards;
}

.radiography-card:nth-child(n) {
    animation-delay: calc(0.05s * var(--card-index));
}