/* ==========================================================================
   Lite Medic - Sistema de Estilos Premium (style.css)
   ========================================================================== */

/* 1. Definición de Variables y Tokens de Diseño */
:root {
    /* Colores Principales */
    --color-primary: #0077b6;          /* Azul Médico Premium */
    --color-primary-hover: #0096c7;    /* Azul Claro al pasar el mouse */
    --color-primary-bg: #e0f2fe;       /* Fondo azul muy suave */
    --color-accent: #0d9488;           /* Verde azulado / Turquesa */
    --color-accent-hover: #0f766e;
    --color-accent-bg: #ccfbf1;        /* Fondo turquesa suave */
    
    /* Colores de Estado */
    --color-error: #ef4444;            /* Rojo alerta */
    --color-error-bg: #fef2f2;         /* Fondo rojo alerta */
    --color-error-border: #fca5a5;     /* Borde rojo alerta */
    --color-success: #10b981;          /* Verde éxito */
    --color-success-bg: #ecfdf5;
    
    /* Colores de Fondo y Textos */
    --color-bg-gradient: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    --color-left-gradient: linear-gradient(135deg, #03045e 0%, #0077b6 100%);
    --text-main: #0f172a;              /* Slate 900 */
    --text-muted: #64748b;             /* Slate 500 */
    --border-color: #e2e8f0;           /* Borde sutil */
    
    /* Efectos y Transiciones */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    
    /* Bordes y Sombras */
    --border-radius-lg: 16px;
    --border-radius-md: 10px;
    --border-radius-sm: 8px;
    
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 40px -15px rgba(15, 23, 42, 0.15);
}

/* 2. Reseteo y Estilos Generales */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    background-color: #ffffff;
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
}

/* 3. Layout de la Página de Inicio de Sesión (Login) */
.login-container {
    display: flex;
    min-height: 100vh;
    width: 100vw;
    background-color: #ffffff;
}

/* Panel Izquierdo: Branding */
.left-panel {
    flex: 1.2;
    background: linear-gradient(135deg, #e0f2fe 0%, #f1f5f9 100%);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 60px 40px;
    position: relative;
    overflow: hidden;
}

/* Efecto de fondo sutil en panel izquierdo */
.left-panel::before {
    content: '';
    position: absolute;
    top: -20%;
    right: -20%;
    width: 60%;
    height: 60%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.6) 0%, transparent 70%);
    pointer-events: none;
}

.left-panel::after {
    content: '';
    position: absolute;
    bottom: -10%;
    left: -10%;
    width: 50%;
    height: 50%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 0%, transparent 70%);
    pointer-events: none;
}

.brand-wrapper {
    margin: auto;
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 40px;
    border-radius: 24px;
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: center;
    align-items: center;
    animation: floatingBrand 6s ease-in-out infinite;
}

.brand-logo-img {
    max-width: 260px;
    height: auto;
    display: block;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.15));
}

.developer-credit {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.5px;
    z-index: 10;
}

.developer-credit span {
    color: var(--color-primary);
    font-weight: 600;
    position: relative;
}

/* Panel Derecho: Formulario */
.right-panel {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    background-color: #fafafa;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: #ffffff;
    border-radius: 20px;
    padding: 48px 40px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(15, 23, 42, 0.04);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.doctor-welcome {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.auth-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* 4. Estilos de Inputs y Formularios */
.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-group .input-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: color var(--transition-fast);
    pointer-events: none;
}

.input-group input {
    width: 100%;
    padding: 15px 18px 15px 50px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius-md);
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text-main);
    background-color: #f8fafc;
    outline: none;
    transition: all var(--transition-fast);
}

.input-group input::placeholder {
    color: var(--text-muted);
    opacity: 0.8;
}

.input-group input:focus {
    border-color: var(--color-primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(0, 119, 182, 0.1);
}

.input-group input:focus ~ .input-icon {
    color: var(--color-primary);
}

/* Botón de contraseña visible */
.toggle-password-btn {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
}

.toggle-password-btn:hover {
    color: var(--color-primary);
}

/* Botón Primario */
.btn-primary {
    width: 100%;
    background-color: var(--color-primary);
    color: #ffffff;
    border: none;
    border-radius: var(--border-radius-md);
    padding: 16px;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 119, 182, 0.2);
    transition: all var(--transition-fast);
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 119, 182, 0.3);
}

.btn-primary:active {
    transform: translateY(1px);
}

/* 5. Alertas de Error y Éxito */
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 24px;
    font-size: 0.9rem;
    font-weight: 500;
    animation: alertSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.alert.error {
    background-color: var(--color-error-bg);
    border: 1px solid var(--color-error-border);
    color: var(--color-error);
}

.alert.error i {
    font-size: 1.1rem;
}

/* 6. Animaciones keyframes */
@keyframes floatingBrand {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-12px);
    }
    100% {
        transform: translateY(0px);
    }
}

@keyframes alertSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 7. Soporte Responsivo */
@media (max-width: 992px) {
    .left-panel {
        padding: 40px 20px;
    }
    .brand-wrapper {
        padding: 30px;
    }
    .brand-logo-img {
        max-width: 200px;
    }
}

@media (max-width: 768px) {
    .login-container {
        flex-direction: column;
    }
    
    .left-panel {
        flex: none;
        height: 280px;
        padding: 30px;
    }
    
    .brand-wrapper {
        margin: auto;
        padding: 20px 30px;
        border-radius: 18px;
    }
    
    .brand-logo-img {
        max-width: 160px;
    }
    
    .developer-credit {
        display: none; /* Se oculta de la vista móvil o se reubica */
    }
    
    .right-panel {
        flex: 1;
        padding: 30px 20px;
        background-color: #f8fafc;
        align-items: flex-start;
    }
    .auth-card {
        padding: 32px 24px;
        margin-top: -40px; /* Traslape elegante */
        z-index: 10;
        position: relative;
    }
}

/* ==========================================================================
   Sección Especial: Panel de Control (dashboard.html)
   ========================================================================== */
.dashboard-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    height: 45px;
    width: auto;
    mix-blend-mode: multiply;
}

.doctor-info-bar {
    display: flex;
    align-items: center;
    gap: 20px;
}

.doctor-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-main);
}

.doctor-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.9rem;
}

.btn-logout-header {
    background: transparent;
    border: 1px solid #e2e8f0;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
}

.btn-logout-header:hover {
    border-color: var(--color-error);
    color: var(--color-error);
    background-color: var(--color-error-bg);
}

.dashboard-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.welcome-section {
    margin-bottom: 40px;
}

.doctor-greeting {
    font-size: 1.25rem;
    font-weight: 300;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.6;
    border-left: 3px solid var(--color-primary);
    padding-left: 20px;
    margin: 10px 0;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 28px;
}

.grid-item-card {
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.05);
    border-radius: 16px;
    padding: 32px 26px;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.02);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.grid-item-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.06);
    border-color: rgba(15, 23, 42, 0.12);
}

.card-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background-color: #f8fafc;
    color: var(--color-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4rem;
    margin-bottom: 22px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(15, 23, 42, 0.02);
}

.grid-item-card:hover .card-icon {
    background-color: var(--color-accent);
    color: #ffffff;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
    line-height: 1.4;
}

.card-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 20px;
}

.card-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    transition: color var(--transition-fast);
}

.grid-item-card:hover .card-link {
    color: var(--color-accent);
}

@media (max-width: 768px) {
    .dashboard-header {
        padding: 16px 20px;
    }
    .doctor-profile span {
        display: none;
    }
    .dashboard-container {
        margin: 24px auto;
    }
}

/* ==========================================================================
   Sección Especial: Nueva Consulta (nueva_consulta.html)
   ========================================================================== */

/* Botón Regresar en Encabezado */
.btn-back-header {
    background: transparent;
    border: 1px solid #e2e8f0;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-back-header:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background-color: var(--color-primary-bg);
}

/* Layout Principal de Consulta */
.consultation-layout {
    max-width: 900px;
    margin: 0 auto;
}

/* Contenedor de Pestañas (Tabs) */
.tabs-container {
    display: flex;
    gap: 8px;
    margin-bottom: 28px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    background: none;
    border: none;
    padding: 14px 28px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 8px 8px 0 0;
}

.tab-btn::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: transparent;
    border-radius: 3px 3px 0 0;
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    color: var(--color-primary);
    background-color: rgba(0, 119, 182, 0.03);
}

.tab-btn.active {
    color: var(--color-primary);
}

.tab-btn.active::after {
    background-color: var(--color-primary);
}

/* Contenidos de Pestaña */
.tab-content {
    display: none;
    animation: tabFadeIn var(--transition-normal);
}

.tab-content.active {
    display: block;
}

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

/* Contenedores Tipo Tarjeta (Paneles) */
.panel-card {
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.05);
    border-radius: 16px;
    padding: 28px;
    box-shadow: var(--shadow-sm);
}

.panel-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1.5px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-title i {
    color: var(--color-primary);
}

/* Rejilla interna de campos de formulario */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 20px;
}

.col-span-2 {
    grid-column: span 2;
}

/* Inputs y Selects dentro del panel de consulta */
.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.2px;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-main);
    background-color: #f8fafc;
    outline: none;
    transition: all var(--transition-fast);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: var(--color-primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.08);
}

.form-field textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
}

.btn-secondary-outline {
    flex: 0.5;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: var(--border-radius-sm);
    padding: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
}

.btn-secondary-outline:hover {
    background-color: #f1f5f9;
    color: var(--text-main);
    border-color: #cbd5e1;
}

.btn-submit-consultation {
    flex: 1;
    background-color: var(--color-primary);
    color: #ffffff;
    border: none;
    border-radius: var(--border-radius-sm);
    padding: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0, 119, 182, 0.15);
    transition: all var(--transition-fast);
}

.btn-submit-consultation:hover {
    background-color: var(--color-primary-hover);
    box-shadow: 0 4px 12px rgba(0, 119, 182, 0.25);
    transform: translateY(-1px);
}

/* Panel de Directorio y Barra de Búsqueda */
.search-container {
    position: relative;
    margin-bottom: 18px;
}

.search-container .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.95rem;
    pointer-events: none;
}

.search-container input {
    width: 100%;
    padding: 11px 14px 11px 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    background-color: #f8fafc;
    outline: none;
    transition: all var(--transition-fast);
}

.search-container input:focus {
    background-color: #ffffff;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.08);
}

/* Tabla del Directorio Médico */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background-color: #ffffff;
    max-height: 500px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

/* Evitar doble scroll: el panel de la base de datos crece dinámicamente y el scroll se maneja en el table-wrapper */
#tab-database .panel-card {
    max-height: none;
    overflow-y: visible;
}

/* Personalización global de la barra de scroll para todo el sistema (tablas, paneles, etc.) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
    transition: background-color var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

.patient-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.88rem;
}

.patient-table th {
    background-color: #f8fafc;
    padding: 12px 14px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.patient-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    vertical-align: middle;
}

.patient-table tr:last-child td {
    border-bottom: none;
}

.patient-table tr {
    transition: background-color var(--transition-fast);
}

.patient-table tr:hover {
    background-color: #f8fafc;
}

.table-empty-state {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
}

.table-empty-state i {
    font-size: 2.2rem;
    margin-bottom: 12px;
    color: #cbd5e1;
    display: block;
}

/* Badges de Tipo de Consulta */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge.particular {
    background-color: var(--color-primary-bg);
    color: var(--color-primary);
}

.badge.seguro {
    background-color: var(--color-accent-bg);
    color: var(--color-accent);
}

/* Grupo de Botones de Acción de Fila */
.action-btn-group {
    display: flex;
    gap: 6px;
}

.action-btn {
    background: none;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}

.action-btn.view {
    color: var(--color-primary);
    background-color: #e0f2fe;
}

.action-btn.view:hover {
    background-color: var(--color-primary);
    color: #ffffff;
}

.action-btn.edit {
    color: var(--color-accent);
    background-color: var(--color-accent-bg);
}

.action-btn.edit:hover {
    background-color: var(--color-accent);
    color: #ffffff;
}

.action-btn.delete {
    color: var(--color-error);
    background-color: var(--color-error-bg);
}

.action-btn.delete:hover {
    background-color: var(--color-error);
    color: #ffffff;
}

/* ==========================================================================
   Estructura de Ventana Modal (Ficha del Paciente)
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

.modal-box {
    background: #ffffff;
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 580px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    transform: translateY(-20px);
    transition: transform var(--transition-normal);
}

.modal-backdrop.active .modal-box {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1.5px solid var(--border-color);
    padding-bottom: 12px;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-title i {
    color: var(--color-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background-color: #f1f5f9;
    color: var(--text-main);
}

.modal-body {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 4px;
}

.modal-item-full {
    grid-column: span 2;
}

.modal-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.modal-item-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-item-val {
    font-size: 0.95rem;
    color: var(--text-main);
    word-break: break-word;
}

/* Responsive para Consulta */
@media (max-width: 992px) {
    .consultation-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .col-span-2 {
        grid-column: span 1;
    }
    .modal-body {
        grid-template-columns: 1fr;
    }
    .modal-item-full {
        grid-column: span 1;
    }
}

/* =========================================================================
   Estilos de Barra de Búsqueda para Vistas de Historial
   ========================================================================= */
.view-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
    gap: 20px;
}

.view-header-row .view-header {
    margin-bottom: 0;
}

.search-bar-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 340px;
}

.search-bar-wrapper i {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 0.95rem;
    pointer-events: none;
}

.search-bar-wrapper input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-main);
    background-color: #ffffff;
    outline: none;
    transition: all var(--transition-fast);
}

.search-bar-wrapper input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.08);
}

/* =========================================================================
   ESTILOS DE VERIFICACIÓN QR PARA DOCUMENTOS PDF
   ========================================================================= */
.pdf-qr-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    border: 1px solid #000000;
    border-radius: 8px;
    padding: 8px 10px;
    max-width: 290px;
    box-sizing: border-box;
}

.pdf-qr-canvas {
    width: 88px;
    height: 88px;
    flex-shrink: 0;
    background: #ffffff;
    padding: 3px;
    border-radius: 4px;
    box-sizing: border-box;
}

.pdf-qr-canvas img, .pdf-qr-canvas canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    object-fit: contain;
}

.pdf-qr-meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}

.pdf-qr-meta .qr-tag {
    font-size: 6pt;
    font-weight: 800;
    color: #023e8a;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.pdf-qr-meta .qr-text-doc {
    font-size: 7.5pt;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.1;
}

.pdf-qr-meta .qr-text-dr {
    font-size: 6.5pt;
    color: #475569;
    font-weight: 600;
}

.pdf-qr-meta .qr-text-hint {
    font-size: 5.8pt;
    color: #0077b6;
    font-style: italic;
}

/* Layout flex para colocar QR a la izquierda y Firma a la derecha */
.pdf-footer-signatures-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 15px;
    margin-bottom: 10px;
    width: 100%;
}

/* =========================================================================
   ESTILOS DE SINCRONIZACIÓN BATCH Y BOTONES ONLINE/OFFLINE (MEJORADOS)
   ========================================================================= */
.sync-bar-container {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(241, 245, 249, 0.7);
    padding: 5px 10px;
    border-radius: 25px;
    border: 1px solid #e2e8f0;
    backdrop-filter: blur(8px);
}

/* Indicador de Estado (Apartado Online/Offline) */
.sync-status-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.sync-status-badge.is-online {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%) !important;
    color: #047857 !important;
    border: 1.5px solid #6ee7b7 !important;
}

.sync-status-badge.is-offline {
    background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%) !important;
    color: #be123c !important;
    border: 1.5px solid #fca5a5 !important;
}

/* Punto pulsante de estado */
.sync-status-badge .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    position: relative;
    flex-shrink: 0;
}

.sync-status-badge.is-online .status-dot {
    background-color: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse-green 2s infinite;
}

.sync-status-badge.is-offline .status-dot {
    background-color: #ef4444;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    animation: pulse-red 2s infinite;
}

@keyframes pulse-green {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

@keyframes pulse-red {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Botón base de sincronización */
.btn-sync-download, 
.btn-sync-upload {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none !important;
    border: none;
    padding: 7px 16px;
    border-radius: 20px;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    text-decoration: none;
    white-space: nowrap;
}

/* Botón Descargar Datos */
.btn-sync-download {
    background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%) !important;
    border: 1.5px solid #7dd3fc !important;
    color: #0369a1 !important;
    box-shadow: 0 2px 5px rgba(2, 132, 199, 0.08);
}

.btn-sync-download i {
    color: #0284c7;
    font-size: 0.9rem;
    transition: transform 0.2s ease;
}

.btn-sync-download:hover:not(:disabled) {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%) !important;
    border-color: #38bdf8 !important;
    color: #0284c7 !important;
    transform: translateY(-1.5px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.2);
}

.btn-sync-download:hover:not(:disabled) i {
    transform: translateY(1px);
}

.btn-sync-download:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(2, 132, 199, 0.12);
}

/* Botón Subir a la Nube */
.btn-sync-upload {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
    border: 1.5px solid #0284c7 !important;
    color: #ffffff !important;
    box-shadow: 0 3px 8px rgba(2, 132, 199, 0.28);
}

.btn-sync-upload i {
    color: #ffffff;
    font-size: 0.9rem;
    transition: transform 0.2s ease;
}

.btn-sync-upload:hover:not(:disabled) {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%) !important;
    border-color: #0369a1 !important;
    color: #ffffff !important;
    transform: translateY(-1.5px);
    box-shadow: 0 5px 15px rgba(2, 132, 199, 0.38);
}

.btn-sync-upload:hover:not(:disabled) i {
    transform: translateY(-1px);
}

.btn-sync-upload:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(2, 132, 199, 0.2);
}

/* Insignia de registros pendientes */
.btn-sync-upload .pending-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: #0369a1;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 12px;
    margin-left: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    min-width: 18px;
}

.btn-sync-upload .pending-count:empty {
    display: none;
}

/* Estado Deshabilitado */
.btn-sync-download:disabled,
.btn-sync-upload:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* =========================================================================
   ESTILOS DE AGENDA MÉDICA Y CALENDARIO MENSUAL
   ========================================================================= */
.agenda-section {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.agenda-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.agenda-title-group h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.agenda-subtitle {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
}

.btn-agenda-primary {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border: none;
    padding: 9px 18px;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s ease;
    box-shadow: 0 3px 10px rgba(2, 132, 199, 0.25);
}

.btn-agenda-primary:hover {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
    transform: translateY(-1.5px);
    box-shadow: 0 5px 15px rgba(2, 132, 199, 0.35);
}

.agenda-container-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 24px;
}

@media (max-width: 900px) {
    .agenda-container-grid {
        grid-template-columns: 1fr;
    }
}

/* Columna Izquierda: Calendario Mensual */
.calendar-card {
    background: #f8fafc;
    border-radius: 14px;
    padding: 18px;
    border: 1px solid #e2e8f0;
}

.calendar-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.calendar-month-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    text-transform: capitalize;
}

.btn-cal-nav, .btn-day-nav {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #475569;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
}

.btn-cal-nav:hover, .btn-day-nav:hover {
    background: #e0f2fe;
    border-color: #0284c7;
    color: #0284c7;
}

.calendar-weekdays-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 8px;
}

.calendar-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cal-day-cell {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    color: #334155;
    background: #ffffff;
    border: 1px solid #f1f5f9;
    transition: all 0.2s ease;
}

.cal-day-cell:hover {
    background: #f0f9ff;
    border-color: #7dd3fc;
    color: #0284c7;
}

.cal-day-cell.other-month {
    color: #cbd5e1;
    background: transparent;
    border-color: transparent;
    cursor: default;
}

.cal-day-cell.is-today {
    border: 1.5px solid #0284c7;
    color: #0284c7;
    font-weight: 800;
}

.cal-day-cell.is-selected {
    background: #0284c7 !important;
    color: #ffffff !important;
    border-color: #0284c7 !important;
    box-shadow: 0 3px 8px rgba(2, 132, 199, 0.3);
}

.cal-day-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: #0284c7;
    position: absolute;
    bottom: 3px;
}

.cal-day-cell.is-selected .cal-day-dot {
    background-color: #ffffff;
}

/* Columna Derecha: Citas del Día */
.day-schedule-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 18px;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
}

.day-schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 14px;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.day-nav-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.selected-day-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
}

.btn-today-quick {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-today-quick:hover {
    background: #e0f2fe;
    color: #0284c7;
    border-color: #7dd3fc;
}

.appointments-list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 4px;
}

.empty-schedule-state {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

.empty-schedule-state i {
    font-size: 2.5rem;
    margin-bottom: 12px;
    color: #cbd5e1;
}

.empty-schedule-state p {
    font-size: 0.9rem;
    margin: 0;
}

/* Tarjeta de Cita Individual */
.appointment-item-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #0284c7;
    border-radius: 10px;
    padding: 12px 16px;
    gap: 14px;
    transition: all 0.2s ease;
}

.appointment-item-card:hover {
    background: #ffffff;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
    border-left-color: #0284c7;
}

.appointment-item-card.is-completed {
    border-left-color: #10b981;
    opacity: 0.75;
    background: #f0fdf4;
}

.appt-time-badge {
    background: #e0f2fe;
    color: #0369a1;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 8px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.appt-patient-info {
    flex: 1;
}

.appt-patient-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 2px 0;
}

.appt-patient-meta {
    font-size: 0.78rem;
    color: #64748b;
    margin: 0;
}

.appt-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-appt-act {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #475569;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.btn-appt-act:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.btn-appt-act.btn-complete {
    color: #059669;
    border-color: #a7f3d0;
}
.btn-appt-act.btn-complete:hover {
    background: #ecfdf5;
}

.btn-appt-act.btn-delete {
    color: #dc2626;
    border-color: #fecdd3;
}
.btn-appt-act.btn-delete:hover {
    background: #fff1f2;
}

.btn-appt-act.btn-consult {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}
.btn-appt-act.btn-consult:hover {
    background: #0369a1;
}

/* Modal Agendar Nueva Cita */
.agenda-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.agenda-modal-card {
    background: #ffffff;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    animation: modalSlideUp 0.25s ease-out;
}

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

.agenda-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.agenda-modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.agenda-modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
}

.agenda-modal-close:hover {
    color: #0f172a;
}

.agenda-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.agenda-form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 14px;
}

.agenda-form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #334155;
}

.agenda-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.88rem;
    color: #1e293b;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.agenda-input:focus {
    outline: none;
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.agenda-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.btn-agenda-cancel {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-agenda-save {
    background: #0284c7;
    color: #ffffff;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-agenda-save:hover {
    background: #0369a1;
}




