/* Estilos para el Panel de Pacientes - Telemedicina Pro */
/* Sincronizado con el diseño del Panel de Médicos */

.telemedicina-panel-pacientes {
    max-width: 1400px;
    margin: 20px auto;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    border: 1px solid #e2e8f0;
}

/* Contenedor principal */
.panel-container {
    display: flex;
    min-height: 700px;
    background: #ffffff;
}

/* Sidebar Navigation */
.panel-sidebar {
    width: 320px;
    background: linear-gradient(135deg, var(--tele-color-sidebar-start, #1e3a8a) 0%, var(--tele-color-sidebar-end, #1e40af) 100%);
    color: white;
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 32px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

.panel-header h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 700;
    color: white;
    letter-spacing: -0.025em;
}

.panel-header .paciente-name {
    margin: 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

/* Navigation */
.panel-nav {
    flex: 1;
    padding: 0;
}

.panel-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.panel-nav li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-nav li:last-child {
    border-bottom: none;
}

.panel-nav a {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.3s ease;
    position: relative;
}

.panel-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    transform: translateX(4px);
}

.panel-nav li.active a {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-weight: 600;
}

.panel-nav li.active a::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--tele-color-accent, #fbbf24);
    border-radius: 2px 0 0 2px;
}

.panel-nav .dashicons {
    margin-right: 12px;
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Main Content */
.panel-content {
    flex: 1;
    padding: 40px;
    background: var(--tele-color-surface, #ffffff);
    overflow-y: auto;
}

/* Toggle de menú (visible en móviles) */
.panel-toggle {
    display: none;
    position: relative;
    margin: -6px 12px 14px 12px;
    padding: 10px 14px;
    border: none;
    border-radius: 10px;
    background: var(--tele-color-primary);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition, all .3s ease);
    box-shadow: 0 4px 16px rgba(var(--tele-primary-rgb), 0.25);
}
.panel-toggle .dashicons { margin-right: 8px; }
.panel-toggle:active { transform: scale(0.98); }

/* WooCommerce endpoints embebidos (Mi Cuenta) */
.telemedicina-panel-pacientes .panel-section.mi-cuenta .woocommerce,
.telemedicina-panel-pacientes .panel-section.mi-cuenta form,
.telemedicina-panel-pacientes .panel-section.mi-cuenta .woocommerce form {
    background: #ffffff;
    border: 1px solid var(--tele-color-border, #e2e8f0);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.telemedicina-panel-pacientes .panel-section.mi-cuenta .woocommerce .form-row,
.telemedicina-panel-pacientes .panel-section.mi-cuenta .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 0 0 16px 0;
}

.telemedicina-panel-pacientes .panel-section.mi-cuenta .form-row-first,
.telemedicina-panel-pacientes .panel-section.mi-cuenta .form-row-last {
    grid-column: span 1;
}

.telemedicina-panel-pacientes .panel-section.mi-cuenta .form-row-wide {
    grid-column: 1 / -1;
}

.telemedicina-panel-pacientes .panel-section.mi-cuenta label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--tele-color-text, #1e293b);
    font-size: 14px;
}

.telemedicina-panel-pacientes .panel-section.mi-cuenta input[type=text],
.telemedicina-panel-pacientes .panel-section.mi-cuenta input[type=email],
.telemedicina-panel-pacientes .panel-section.mi-cuenta input[type=password],
.telemedicina-panel-pacientes .panel-section.mi-cuenta select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--tele-color-border, #e5e7eb);
    border-radius: 8px;
    background: #ffffff;
    color: var(--tele-color-text, #1e293b);
    transition: var(--transition, all .3s ease);
}

.telemedicina-panel-pacientes .panel-section.mi-cuenta input:focus,
.telemedicina-panel-pacientes .panel-section.mi-cuenta select:focus {
    outline: none;
    border-color: var(--tele-color-primary, #3b82f6);
    box-shadow: 0 0 0 3px rgba(var(--tele-primary-rgb, 59,130,246), .1);
}

.telemedicina-panel-pacientes .panel-section.mi-cuenta .button,
.telemedicina-panel-pacientes .panel-section.mi-cuenta button,
.telemedicina-panel-pacientes .panel-section.mi-cuenta .woocommerce button.button {
    background: var(--tele-color-primary, #3b82f6);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition, all .3s ease);
}

.telemedicina-panel-pacientes .panel-section.mi-cuenta .button:hover,
.telemedicina-panel-pacientes .panel-section.mi-cuenta button:hover,
.telemedicina-panel-pacientes .panel-section.mi-cuenta .woocommerce button.button:hover {
    background: var(--tele-color-primary-hover, #2563eb);
}

.telemedicina-panel-pacientes .panel-section.mi-cuenta .woocommerce-message,
.telemedicina-panel-pacientes .panel-section.mi-cuenta .woocommerce-error,
.telemedicina-panel-pacientes .panel-section.mi-cuenta .woocommerce-info {
    border-radius: 8px;
}

/* Secciones de contenido */
.content-section {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

.content-section h3 {
    margin: 0 0 32px 0;
    color: var(--tele-color-text, #1e293b);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.025em;
    border-bottom: 3px solid var(--tele-color-accent, #3b82f6);
    padding-bottom: 12px;
}

/* Cards y contenedores */
.datos-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin-bottom: 32px;
}

.datos-personales,
.datos-ubicacion,
.datos-medicos {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.card-header {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
}

.card-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    border: none;
    padding: 0;
}

.card-content {
    padding: 24px;
}

/* Formularios (scoped) */
.telemedicina-panel-pacientes .form-group {
    margin-bottom: 24px;
}

.telemedicina-panel-pacientes .form-group:last-child {
    margin-bottom: 0;
}

.telemedicina-panel-pacientes .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
    letter-spacing: 0.025em;
}

.telemedicina-panel-pacientes .form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #f8fafc;
}

.telemedicina-panel-pacientes .form-control:focus {
    outline: none;
    border-color: var(--tele-color-primary, #3b82f6);
    box-shadow: 0 0 0 3px rgba(var(--tele-primary-rgb, 59, 130, 246), 0.1);
    background: #ffffff;
}

.telemedicina-panel-pacientes .dato-valor {
    display: block;
    padding: 12px 16px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    color: #1e293b;
    font-size: 15px;
    font-weight: 500;
    min-height: 20px;
}

.telemedicina-panel-pacientes .form-row {
    display: flex;
    gap: 20px;
}

.telemedicina-panel-pacientes .form-col {
    flex: 1;
}

/* Botones */
.telemedicina-panel-pacientes .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    letter-spacing: 0.025em;
}

.telemedicina-panel-pacientes .btn-primary {
    background: linear-gradient(135deg, var(--tele-color-primary) 0%, var(--tele-color-primary-hover) 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(var(--tele-primary-rgb), 0.3);
}

.telemedicina-panel-pacientes .btn-primary:hover {
    background: linear-gradient(135deg, var(--tele-color-primary-hover) 0%, var(--tele-color-primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(var(--tele-primary-rgb), 0.4);
    text-decoration: none;
    color: white;
}

.telemedicina-panel-pacientes .btn-secondary {
    background: var(--tele-secondary-bg);
    color: var(--tele-secondary-text);
    box-shadow: 0 4px 16px rgba(107, 114, 128, 0.2);
}

.telemedicina-panel-pacientes .btn-secondary:hover {
    background: var(--tele-secondary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(107, 114, 128, 0.3);
}

/* Citas */
.citas-container {
    display: grid;
    gap: 20px;
}

.cita-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.cita-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.cita-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.cita-fecha {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}

.cita-estado {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.estado-confirmada {
    background: #dcfce7;
    color: #166534;
}

.estado-pendiente {
    background: #fef3c7;
    color: #92400e;
}

.estado-completada {
    background: #dbeafe;
    color: #1e40af;
}

.cita-medico h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

.cita-medico p {
    margin: 0 0 4px 0;
    font-size: 14px;
    color: #6b7280;
}

/* Exámenes */
.examenes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Tablas responsive (Historial de Consultas) */
.tabla-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.citas-table {
    width: 100%;
    border-collapse: collapse;
}
.citas-table th,
.citas-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--tele-color-text, #1e293b);
}
.citas-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
    font-size: 13px;
}

@media (max-width: 768px) {
    .citas-table thead {
        display: none;
    }
    .citas-table tbody tr {
        display: block;
        background: #fff;
        border: 1px solid var(--tele-color-border, #e2e8f0);
        border-radius: 12px;
        margin-bottom: 12px;
        box-shadow: 0 4px 16px rgba(0,0,0,0.05);
        overflow: hidden;
    }
    .citas-table tbody td {
        display: grid;
        grid-template-columns: 140px 1fr;
        gap: 8px;
        align-items: center;
        padding: 12px 16px;
    }
    .citas-table tbody td::before {
        content: attr(data-label);
        color: var(--tele-color-muted, #64748b);
        font-weight: 600;
        font-size: 13px;
        text-transform: uppercase;
        letter-spacing: 0.02em;
    }
    .citas-table tbody td:last-child {
        padding-bottom: 16px;
    }
    .citas-table .estado {
        justify-self: start;
    }
    .btn-ver-informe-paciente {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-height: 44px;
        border-radius: 999px;
        background: var(--tele-color-primary, #3b82f6);
        color: #fff;
        font-weight: 700;
        border: none;
        transition: var(--transition, all .3s ease);
        pointer-events: auto;
        touch-action: manipulation;
        box-shadow: 0 4px 16px rgba(var(--tele-primary-rgb), 0.25);
        cursor: pointer;
        z-index: 2;
    }
    .btn-ver-informe-paciente:hover {
        background: var(--tele-color-primary-hover, #2563eb);
    }
}

.examen-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.examen-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.examen-titulo {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}

.examen-fecha {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 12px;
}

/* Alertas y mensajes */
.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
    border-left: 4px solid;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border-left-color: #22c55e;
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border-left-color: #f59e0b;
}

.alert-danger {
    background: #fef2f2;
    color: #dc2626;
    border-left-color: #ef4444;
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border-left-color: #3b82f6;
}

/* Estados de carga */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.loading i {
    font-size: 32px;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
    display: block;
}

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

/* Animaciones */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

/* Estados de error */
.panel-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 24px;
    border-radius: 8px;
    border: 1px solid #fecaca;
    text-align: center;
    font-weight: 500;
}

.telemedicina-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #fecaca;
    text-align: center;
    font-weight: 500;
    margin: 20px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .telemedicina-panel-pacientes {
        margin: 15px;
        border-radius: 12px;
    }
    
    .panel-toggle {
        display: inline-flex;
        align-items: center;
    }
    
    .panel-container {
        flex-direction: column;
        min-height: auto;
    }
    
    .panel-sidebar {
        width: 85%;
        max-width: 340px;
        background: linear-gradient(90deg, var(--tele-color-sidebar-start, #1e3a8a) 0%, var(--tele-color-sidebar-end, #1e40af) 100%);
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform .3s ease;
        z-index: 9999;
        box-shadow: 0 12px 30px rgba(0,0,0,.25);
    }
    .panel-sidebar.open { transform: translateX(0); }
    
    .panel-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.35);
        backdrop-filter: blur(1px);
        z-index: 9998;
    }
    .panel-backdrop[hidden] { display: none; }
    
    .panel-content {
        padding: 24px;
    }
    
    .datos-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .telemedicina-panel-pacientes .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .examenes-list {
        grid-template-columns: 1fr;
    }
    
    .panel-nav ul {
        display: block;
        overflow: visible;
        padding: 0;
    }
    
    .panel-nav li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        border-right: none;
        flex-shrink: initial;
    }
    
    .panel-nav li:last-child {
        border-right: none;
    }
    
    .panel-nav a {
        white-space: normal;
        padding: 16px 24px;
    }
    
    .panel-nav a:hover {
        transform: none;
    }
    
    .content-section h3 {
        font-size: 24px;
        margin-bottom: 24px;
    }
}

@media (max-width: 768px) {
    .panel-content {
        padding: 20px;
    }
    
    .card-content {
        padding: 20px;
    }
    
    .cita-header {
        flex-direction: column;
        gap: 12px;
    }
    
    .telemedicina-panel-pacientes .form-row {
        gap: 16px;
    }
    
    .telemedicina-panel-pacientes .form-actions {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    .telemedicina-panel-pacientes .form-actions .btn {
        width: 100%;
        min-height: 44px;
    }
}

/* Mejoras de 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 mejorados */
.telemedicina-panel-pacientes .panel-nav a:focus,
.telemedicina-panel-pacientes .btn:focus,
.telemedicina-panel-pacientes .form-control:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Hover states para elementos interactivos */
.cita-item:hover .cita-fecha {
    color: #3b82f6;
}

.examen-item:hover .examen-titulo {
    color: #3b82f6;
}

/* Bloquear scroll cuando el offcanvas está abierto */
body.tele-offcanvas-open {
    overflow: hidden;
}
