/**
 * public/css/main.css
 * Sistema de Diseño y Estilos del Portal Dental.
 * Implementa Glassmorphism, Temas Dinámicos y Responsive Design.
 */

/* ─── REGION: DESIGN SYSTEM VARIABLES & THEMES ─── */

/* 1. VARIABLES GLOBALES (TOKENS) */

:root {
    /* Main Accents */
    --primary: #2563eb;
    --primary-dim: #dbeafe;
    --accent: #f59e0b;
    
    /* Backgrounds & Surfaces */
    --bg-body: #f8fafc;      
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%); /* Nuevo para profundidad */
    --bg-card: rgba(255, 255, 255, 0.85); 
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: rgba(226, 232, 240, 0.8);

    /* Semantic Status Tokens (Light Default) */
    --bg-success: rgba(16, 185, 129, 0.12);
    --text-success: #065f46;
    --border-success: rgba(16, 185, 129, 0.3);
    
    --bg-warning: rgba(245, 158, 11, 0.10);
    --text-warning: #92400e;
    --border-warning: rgba(245, 158, 11, 0.3);
    
    --bg-info: rgba(37, 99, 235, 0.10);
    --text-info: #1e3a8a;
    --border-info: rgba(37, 99, 235, 0.3);
}

/* 2. ATMÓSFERAS (TEMAS DINÁMICOS) */

/* 1. DEFAULT (Azul Clínico) - Fallback & Explícito */
:root, [data-theme="default"] {
    --primary: #2563eb;
    --primary-dim: #eff6ff;
    --bg-body: #f0f9ff;
    --bg-gradient: radial-gradient(circle at top left, #eff6ff, #f8fafc);
    --bg-card: rgba(255, 255, 255, 0.85);
    --text-main: #0f172a;
    --border-color: rgba(226, 232, 240, 0.6);
}

/* FIX: Agregamos 'body.dark-mode' solo para que aplique cuando no hay data-theme */
body.dark-mode, 
[data-theme="default"] body.dark-mode {
    --primary: #60a5fa;
    --primary-dim: #1e3a8a;
    --bg-body: #0f172a;       /* Azul profundo */
    --bg-gradient: radial-gradient(circle at bottom right, #1e293b, #0f172a);
    --bg-card: rgba(30, 41, 59, 0.70); /* Oscuro translúcido para el Glass */
    --text-main: #f8fafc;
    --border-color: rgba(96, 165, 250, 0.3); /* Un borde azulado sutil */

    /* Semantic Status Tokens (Dark) */
    --bg-success: rgba(52, 211, 153, 0.15);
    --text-success: #34d399;
    --border-success: rgba(52, 211, 153, 0.4);
    
    --bg-warning: rgba(251, 191, 36, 0.15);
    --text-warning: #fbbf24;
    --border-warning: rgba(251, 191, 36, 0.4);
    
    --bg-info: rgba(96, 165, 250, 0.15);
    --text-info: #93c5fd;
    --border-info: rgba(147, 197, 253, 0.4);
}

/* 2. NATURA (Verde Orgánico) */
[data-theme="natura"] {
    --primary: #059669;
    --primary-dim: #ecfdf5;
    --bg-body: #f0fdf4;
    --bg-gradient: linear-gradient(120deg, #dcfce7 0%, #f0fdf4 100%);
    --bg-card: rgba(255, 255, 255, 0.85);
    --text-main: #064e3b;
    --border-color: rgba(187, 247, 208, 0.6);
}
[data-theme="natura"] body.dark-mode {
    --primary: #34d399;
    --primary-dim: #064e3b;
    --bg-body: #022c22;
    --bg-gradient: linear-gradient(to bottom, #064e3b, #022c22);
    --bg-card: rgba(6, 95, 70, 0.6); 
    --text-main: #ecfdf5;
    --border-color: rgba(4, 120, 87, 0.5);
}

/* 3. OCEAN (Aqua Fresco) */
[data-theme="ocean"] {
    --primary: #0891b2;
    --primary-dim: #ecfeff;
    --bg-body: #f0f9ff;
    --bg-gradient: linear-gradient(to top right, #cffafe, #f0f9ff);
    --bg-card: rgba(255, 255, 255, 0.85);
    --text-main: #164e63;
    --border-color: rgba(186, 230, 253, 0.6);
}
[data-theme="ocean"] body.dark-mode {
    --primary: #22d3ee;
    --primary-dim: #155e75;
    --bg-body: #083344;
    --bg-gradient: linear-gradient(to bottom right, #164e63, #083344);
    --bg-card: rgba(22, 78, 99, 0.7);
    --text-main: #ecfeff;
    --border-color: rgba(21, 94, 117, 0.5);
}

/* 4. NEON (Cyber Vibrante) */
[data-theme="neon"] {
    --primary: #7c3aed;
    --primary-dim: #f5f3ff;
    --bg-body: #faf5ff;
    --bg-gradient: linear-gradient(45deg, #f3e8ff, #faf5ff);
    --bg-card: rgba(255, 255, 255, 0.9);
    --text-main: #4c1d95;
    --border-color: rgba(221, 214, 254, 0.8);
}
[data-theme="neon"] body.dark-mode {
    --primary: #a78bfa;
    --primary-dim: #4c1d95;
    --bg-body: #09090b; /* Casi negro */
    --bg-gradient: radial-gradient(circle at 50% 0%, #2e1065, #000000);
    --bg-card: rgba(17, 17, 17, 0.7);
    --text-main: #e9d5ff;
    --border-color: rgba(76, 29, 149, 0.4);
}

/* 5. PASTEL (Soft Pink) */
[data-theme="pastel"] {
    --primary: #db2777;
    --primary-dim: #fdf2f8;
    --bg-body: #fff1f2;
    --bg-gradient: linear-gradient(to bottom, #ffe4e6, #fff1f2);
    --bg-card: rgba(255, 255, 255, 0.85);
    --text-main: #881337;
    --border-color: rgba(251, 207, 232, 0.6);
}
[data-theme="pastel"] body.dark-mode {
    --primary: #f472b6;
    --primary-dim: #831843;
    --bg-body: #4a044e;
    --bg-gradient: linear-gradient(to top, #4a044e, #701a75);
    --bg-card: rgba(112, 26, 117, 0.6);
    --text-main: #fce7f3;
    --border-color: rgba(157, 23, 77, 0.5);
}

/* 6. COFFEE (Madera Elegante) */
[data-theme="coffee"] {
    --primary: #78350f;
    --primary-dim: #fffbeb;
    --bg-body: #fffbf0;
    --bg-gradient: linear-gradient(to right, #fef3c7, #fffbf0);
    --bg-card: rgba(255, 255, 255, 0.85);
    --text-main: #451a03;
    --border-color: rgba(253, 230, 138, 0.6);
}
[data-theme="coffee"] body.dark-mode {
    --primary: #fbbf24;
    --primary-dim: #451a03;
    --bg-body: #291508;
    --bg-gradient: radial-gradient(circle, #451a03, #291508);
    --bg-card: rgba(69, 26, 3, 0.65);
    --text-main: #fef3c7;
    --border-color: rgba(120, 53, 15, 0.5);
}


/* ─── REGION: GLOBAL RESETS & TYPOGRAPHY ─── */
html, body {
    overflow-x: hidden; /* Vital: Evita el deslizamiento lateral del menú móvil */
    width: 100%;
    position: relative;
}

body {
    font-family: 'Inter', sans-serif;
    /* Usamos el gradiente como fondo */
    background: var(--bg-gradient);
    background-attachment: fixed; /* Mantiene el gradiente fijo al hacer scroll */
    color: var(--text-main);
    margin: 0;
    min-height: 100vh;
    transition: color 0.5s ease;
}

/* ─── REGION: UTILITIES & HELPERS ─── */
.hidden { display: none !important; }
.mobile-only { display: none !important; }
.hidden-mobile { display: block; } /* Por defecto visible en desktop */
.active-view { display: block; animation: fadeIn 0.5s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ─── REGION: CORE LAYOUT & GLASSMORPHISM ─── */
.glass-effect {
    background: var(--bg-card);
    backdrop-filter: blur(12px); /* Aquí está la magia de la difuminación */
    -webkit-backdrop-filter: blur(12px); /* Soporte Safari */
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05);
}

/* ─── REGION: NAVIGATION & MODALS ─── */
/* 1. Navbar & Encabezado */
nav {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 2rem;
    position: sticky; top: 0; z-index: 100;
    /* Aplicamos Glass */
    background: var(--bg-card);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    transition: all 0.5s ease;
}

.logo { font-weight: 700; font-size: 1.2rem; color: var(--primary); text-shadow: 0 0 1px rgba(0,0,0,0.1); }

/* 2. Tarjetas y Modales Base */
.user-card, .login-card, .modal-content, .theme-name {
    /* Aplicamos Glass */
    background: var(--bg-card);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    
    border-radius: 16px; /* Más redondeado para look moderno */
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: transform 0.2s ease, background-color 0.5s ease, border-color 0.5s ease;
}

.login-card { max-width: 400px; margin: 80px auto; text-align: center; }

/* ─── REGION: BUTTONS & INPUTS ─── */
/* 1. Formularios (Inputs y Selects) */
input, select {
    width: 100%; padding: 12px; margin: 8px 0 16px;
    border: 1px solid var(--border-color); border-radius: 8px;
    background: rgba(255, 255, 255, 0.5); /* Semi transparente */
    color: var(--text-main);
    box-sizing: border-box;
    transition: all 0.3s;
}
input:focus, select:focus {
    outline: none; border-color: var(--primary);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 3px var(--primary-dim);
}
body.dark-mode input, body.dark-mode select {
    background: rgba(0, 0, 0, 0.3);
}
body.dark-mode input:focus { background: rgba(0, 0, 0, 0.6); }

/* 2. Botones Globales */
button { cursor: pointer; transition: all 0.2s; font-weight: 600; border-radius: 8px; letter-spacing: 0.5px; }
.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    padding: 10px 24px; border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-2px); box-shadow: 0 6px 12px rgba(var(--primary), 0.3); }

.btn-secondary, .btn-outline {
    background: transparent;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}
.btn-outline { border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #ffffff; }

/* Grid de Temas */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 1rem; }
.theme-card { padding: 0 !important; cursor: pointer; overflow: hidden; text-align: center; }
.theme-card:hover { transform: scale(1.05); border-color: var(--primary); }
.theme-preview { height: 70px; display: flex; align-items: center; justify-content: center; color: white; font-weight: bold; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.theme-name { padding: 10px; font-size: 0.85rem; background: var(--bg-card); border: none; border-top: 1px solid var(--border-color); border-radius: 0; }

/* Badges y Utiles */
.role-badge { padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; background-color: var(--primary-dim); color: var(--primary); }

.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem; }
.dashboard-actions { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.grid-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }

/* Modal Backdrop Corregido */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5); 
    backdrop-filter: blur(5px);
    z-index: 9999; /* Asegura que esté por encima de FullCalendar */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ocultar el modal correctamente cuando tiene la clase hidden */
.modal.hidden {
    display: none !important;
}

/* Botón Tema */
.btn-icon {
    background: rgba(255,255,255,0.1); border: 1px solid var(--border-color);
    color: var(--text-main); border-radius: 50%; width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
}
.btn-icon:hover { background: var(--primary-dim); color: var(--primary); border-color: var(--primary); }

/* --- TIMELINE / FEED DE ARCHIVOS --- */
.timeline-feed {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 500px;
    overflow-y: auto; /* Scroll vertical si hay muchos archivos */
    padding-right: 10px; /* Espacio para el scrollbar */
}

/* Estilo del Scrollbar para que se vea moderno */
.timeline-feed::-webkit-scrollbar { width: 6px; }
.timeline-feed::-webkit-scrollbar-thumb { background-color: var(--border-color); border-radius: 4px; }

.file-bubble {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card); /* Usa el fondo glass/card del tema */
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    position: relative;
    transition: all 0.2s ease;
    /* Borde izquierdo de color para destacar */
    border-left: 4px solid var(--primary); 
}

.file-bubble:hover {
    transform: translateX(4px); /* Efecto de movimiento al pasar el mouse */
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-icon {
    font-size: 1.8rem;
    background: var(--primary-dim);
    width: 45px; height: 45px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
}

.file-meta h4 { margin: 0; font-size: 0.95rem; font-weight: 600; color: var(--text-main); }
.file-meta span { font-size: 0.75rem; color: var(--text-muted); display: block; margin-top: 2px; }

.file-actions {
    display: flex;
    gap: 8px;
}


/* --- BARRA DE FILTROS --- */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 1.5rem;
    overflow-x: auto; /* Scroll horizontal en móviles */
    padding-bottom: 5px;
}

.filter-btn {
    background: var(--bg-card); /* Fondo glass */
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 16px;
    border-radius: 20px; /* Forma de píldora */
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-btn:hover {
    background: var(--primary-dim);
    color: var(--primary);
    border-color: var(--primary);
}

.filter-btn.active {
    background: var(--primary);
    color: #ffffff; /* Texto blanco para contraste */
    border-color: var(--primary);
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Ajuste oscuro para el texto activo */
body.dark-mode .filter-btn.active {
    color: var(--bg-card); /* O blanco, según preferencia */
}

/* --- BOTONES DE ACCIÓN UNIFICADOS (VERSION FINAL) --- */
.file-actions {
    display: flex;
    align-items: center; /* Alineación vertical perfecta */
    gap: 8px;            /* Espacio uniforme entre botones */
}

/* Base común para TODOS los botones de acción */
.btn-icon-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;       /* Ancho fijo cuadrado */
    height: 38px;      /* Alto fijo cuadrado */
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent; 
    text-decoration: none !important; /* Quita subrayado de enlaces */
    line-height: 1; /* Evita desplazamientos de iconos */
    box-sizing: border-box; /* Asegura que padding/borde no cambie tamaño total */
    margin: 0; /* Resetea margenes */
}

/* VARIANTE 1: VER (Secundario / Outline) */
.btn-icon-action.btn-secondary {
    border-color: var(--border-color);
    background: transparent;
    color: var(--text-muted);
}
.btn-icon-action.btn-secondary:hover {
    background: var(--bg-body);
    color: var(--text-main);
    border-color: var(--text-muted);
    transform: translateY(-2px);
}

/* VARIANTE 2: DESCARGAR (Primario / Soft) */
.btn-icon-action.btn-primary {
    background: var(--primary-dim); 
    color: var(--primary);          
}
.btn-icon-action.btn-primary:hover {
    background: var(--primary);
    color: white; /* Texto blanco al hover */
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(var(--primary), 0.2);
}

/* VARIANTE 3: BORRAR (Danger / Soft) */
.btn-icon-action.btn-danger {
    background: #fee2e2;
    color: #ef4444;
}
.btn-icon-action.btn-danger:hover {
    background: #ef4444;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(239, 68, 68, 0.2);
}

/* Modo Oscuro Ajustes */
body.dark-mode .btn-icon-action.btn-danger {
    background: rgba(127, 29, 29, 0.3); /* Rojo oscuro translúcido */
    color: #fca5a5;
}
body.dark-mode .btn-icon-action.btn-danger:hover {
    background: #dc2626;
    color: white;
}

/* --- BUSCADOR INTELIGENTE DE PACIENTES --- */
.search-bar-container {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-bar-container .search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    opacity: 0.6;
    pointer-events: none; /* Para que no interfiera con el clic en el input */
}

#search-patient-input {
    width: 100%;
    padding: 14px 15px 14px 45px; /* Espacio extra a la izquierda para la lupa */
    border-radius: 30px; /* Estilo píldora */
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

#search-patient-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-dim);
    background: var(--bg-body); /* Se vuelve opaco al escribir */
}

body.dark-mode #search-patient-input {
    background: rgba(30, 41, 59, 0.8);
}
body.dark-mode #search-patient-input:focus {
    background: rgba(15, 23, 42, 1);
}

/* --- NAVBAR AVATAR & DROPDOWN --- */
.relative { position: relative; }

.avatar-container {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 30px;
    transition: background 0.2s;
}
.avatar-container:hover {
    background: rgba(0, 0, 0, 0.05);
}
body.dark-mode .avatar-container:hover {
    background: rgba(255, 255, 255, 0.1);
}

.user-email-text {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

.avatar-img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Menú Flotante del Avatar */
.dropdown-menu {
    position: absolute;
    top: 130%;
    right: 0;
    background: var(--bg-card);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    width: 240px;
    display: flex;
    flex-direction: column;
    padding: 10px;
    z-index: 1050;
    transform-origin: top right;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animación de entrada cuando NO está oculto */
.dropdown-menu:not(.hidden) {
    animation: dropdownEntrance 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1) forwards;
}

@keyframes dropdownEntrance {
    from { opacity: 0; transform: scale(0.9) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.dropdown-item {
    background: transparent;
    border: none;
    padding: 12px 15px;
    text-align: left;
    font-size: 0.9rem;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 10px;
    transition: all 0.2s ease;
    width: 100%;
}

.dropdown-item:hover {
    background: var(--primary-dim);
    color: var(--primary);
    transform: translateX(5px);
}

.dropdown-item img {
    transition: transform 0.2s ease;
}

.dropdown-item:hover img {
    transform: scale(1.1);
}

/* Animación escalonada para los items del dropdown */
.dropdown-menu:not(.hidden) .dropdown-item {
    animation: itemSlideIn 0.4s ease forwards;
    opacity: 0;
}

@keyframes itemSlideIn {
    from { opacity: 0; transform: translateX(10px); }
    to { opacity: 1; transform: translateX(0); }
}

.dropdown-menu:not(.hidden) .dropdown-item:nth-child(1) { animation-delay: 0.05s; }
.dropdown-menu:not(.hidden) .dropdown-item:nth-child(2) { animation-delay: 0.1s; }
.dropdown-menu:not(.hidden) .dropdown-item:nth-child(3) { animation-delay: 0.15s; }
.dropdown-menu:not(.hidden) .dropdown-item:nth-child(4) { animation-delay: 0.2s; }
.dropdown-menu:not(.hidden) .dropdown-item:nth-child(5) { animation-delay: 0.25s; }
.dropdown-menu:not(.hidden) .dropdown-item:nth-child(6) { animation-delay: 0.3s; }
.dropdown-menu:not(.hidden) .dropdown-item:nth-child(7) { animation-delay: 0.35s; }

.text-danger { color: #ef4444 !important; }

.text-danger { color: #ef4444 !important; }
.text-danger:hover { background: #fee2e2 !important; color: #ef4444 !important; }
body.dark-mode .text-danger:hover { background: rgba(239, 68, 68, 0.2) !important; color: #fca5a5 !important; }

/* --- ESTILOS DE BRANDING DINÁMICO --- */
#nav-brand {
    transition: all 0.3s ease;
}

#nav-logo-img {
    transition: opacity 0.3s ease;
}

#nav-logo-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px; /* Evita que nombres muy largos rompan el header en móviles */
}

/* --- REDISEÑO DE AGENDA (LAYOUT LATERAL) --- */
.agenda-layout {
    display: grid;
    grid-template-columns: 320px 1fr; /* Tarjeta a la izquierda, lista a la derecha */
    gap: 2rem;
    align-items: start;
}

/* Hacerlo responsivo para celulares (una columna debajo de la otra) */
@media (max-width: 768px) {
    .agenda-layout { grid-template-columns: 1fr; }
}

/* --- INPUTS MINIMALISTAS --- */
.minimal-input-group {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1rem;
    padding: 10px;
    background: var(--bg-body); /* Fondo sutil para diferenciar de la tarjeta blanca */
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: hidden;
}

.minimal-input-group:hover, .minimal-input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-dim);
}

.minimal-icon-btn {
    font-size: 1.3rem;
    background: var(--primary-dim);
    color: var(--primary);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.minimal-text {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
    flex-grow: 1;
}

/* Magia negra: Input invisible pero funcional encima de todo */
.hidden-native-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0; /* Invisible */
    cursor: pointer;
    padding: 0;
    margin: 0;
    border: none;
}

/* Excepción para el input de texto del nombre (Admin) */
.minimal-text-input {
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    box-shadow: none !important;
    font-size: 0.95rem;
    color: var(--text-main);
    outline: none;
    flex-grow: 1;
    width: 100%;
}

/* --- ESTANDARIZACIÓN DE MÁRGENES Y TARJETAS GLOBALES --- */

/* 1. Evitar que el contenido choque contra las paredes de la pantalla */
.view-container {
    padding: 1rem 2.5rem; /* Margen a los lados de la pantalla */
    max-width: 1400px;
    margin: 0 auto;
}
@media (max-width: 768px) {
    .view-container { padding: 1rem; }
}

/* 2. Igualar las Tarjetas de la Agenda a las Tarjetas de Pacientes */
.event-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;       /* Mismo radio que las user-card */
    padding: 1.5rem;           /* Mismo relleno (padding) que user-card */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border-left: 6px solid var(--primary); /* Borde de color para status */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-bottom: 0;
}

.event-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.08);
}

/* --- REQ-EST-03 & REQ-EST-04: ESTANDARIZACIÓN Y EFECTOS --- */

/* 1. Más margen entre las burbujas de chat (Expediente) */
.timeline-feed {
    gap: 1.5rem !important; /* Separación ampliada */
    padding-right: 15px;    /* Espacio para que el scrollbar no muerda la tarjeta */
    padding-bottom: 1rem;
}

/* 2. Efecto de "Iluminación" (Glow) para los botones del Panel y Acciones */
.btn-primary:hover {
    opacity: 1;
    transform: translateY(-2px);
    /* Sombra base + Sombra de color brillante (Glow) */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1), 0 0 12px var(--primary); 
}

.btn-outline {
    transition: all 0.3s ease;
}

.btn-outline:hover {
    background: var(--primary) !important;
    color: #ffffff !important;
    border-color: var(--primary) !important;
    /* Mismo efecto Glow */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1), 0 0 12px var(--primary);
    transform: translateY(-2px);
}

/* 3. Margen de seguridad derecho para evitar colisiones con la pared */
.user-card, .event-card, .file-bubble {
    margin-right: 8px; /* Pequeño margen extra a la derecha */
}

.dashboard-actions {
    margin-right: 8px; /* Que los botones del panel no peguen a la derecha */
}

/* Asegurar que los botones de icono de los archivos mantengan su forma al iluminarse */
.file-actions a, .file-actions button {
    box-sizing: border-box;
}

/* --- REQ-UX-02: TARJETAS DE PACIENTES INTERACTIVAS --- */
.patient-card-interactive {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    /* Un pequeño indicador visual extra de que es cliqueable */
    border-left: 4px solid transparent; 
}

.patient-card-interactive:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: var(--primary);
    border-left: 4px solid var(--primary);
    /* Efecto Glow idéntico al del botón primario */
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1), 0 0 15px var(--primary);
    background: var(--bg-body);
}

/* --- REQ-FIX-01: CORRECCIÓN DE FONDOS GRISES EN MODALES --- */
/* --- FIX: CORRECCIÓN DE FONDOS GRISES EN MODALES --- */
.modal-content {
    /* Usamos el color base del tema (sólido) para que el fondo negro 
       del modal no "ensucie" ni agrise los colores pastel/claros */
    background: var(--bg-body) !important; 
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2); /* Sombra más fuerte para dar profundidad */
    color: var(--text-main);
}

/* --- REQ-AGENDA-02: FULLCALENDAR MINIMALISTA Y TOOLTIPS --- */

/* --- REQ-AGENDA-05: CONTORNO Y ESTILO PREMIUM --- */

/* 1. Contenedor Maestro: Bordes redondeados y color de tema */
.fc {
    border: 2px solid var(--primary);
    border-radius: 16px;
    background: var(--bg-card);
    overflow: hidden; /* Vital: Corta las esquinas rectas de la tabla interna */
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

/* 2. Ocultar los bordes externos nativos para que no choquen con nuestro nuevo borde */
.fc-scrollgrid {
    border: none !important;
}

/* 3. Estilizar la barra de cabecera (Lunes 4, Martes 5...) */
.fc-col-header-cell {
    background: var(--primary-dim); /* Fondo suave del color del tema */
    padding: 10px 0;
    text-transform: capitalize; /* "Miércoles" con M mayúscula */
    border-bottom: 2px solid var(--primary) !important;
}

.fc-col-header-cell-cushion {
    color: var(--primary) !important;
    font-weight: 700;
    font-size: 0.95rem;
}

/* 4. Estilizar la columna de horas (1:00 PM, 2:00 PM...) */
.fc-timegrid-slot-label-cushion {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* 1. Limpieza de Eventos (Píldoras) */
.fc-event {
    border: none !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer !important;
    overflow: hidden;
}

.fc-event:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    z-index: 5 !important;
}

/* Indicador sutil de color a la izquierda para mayor contraste */
.fc-timegrid-event .fc-event-main {
    border-left: 4px solid rgba(255, 255, 255, 0.6);
    padding: 2px 4px;
}

/* Ocultar texto amontonado en citas muy cortas (ej. 15 mins) */
.fc-timegrid-event-short .fc-event-time,
.fc-timegrid-event-short .fc-event-title {
    display: none !important;
}

/* Tipografía de las tarjetas de calendario */
.fc-event-time, .fc-event-title {
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 2. Tema personalizado para el Tooltip (Glassmorphism) */
.tippy-box[data-theme~='glass'] {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    padding: 0;
}

.tippy-box[data-theme~='glass'][data-placement^='top'] > .tippy-arrow::before {
    border-top-color: var(--border-color);
}
.tippy-box[data-theme~='glass'][data-placement^='bottom'] > .tippy-arrow::before {
    border-bottom-color: var(--border-color);
}

/* --- REQ-FIX-02: PULIDO DE CALENDARIO Y CELDAS --- */

/* 1. Forzar a que las celdas del calendario tengan una altura fija y no se estiren */
.fc-timegrid-slot-lane {
    height: 45px !important; /* Altura uniforme para cada franja de media hora */
}

/* 2. Evitar que el cuerpo del calendario intente rellenar el espacio vacío al final */
.fc .fc-timegrid-body {
    min-height: 0 !important;
}

/* 3. Ajuste sutil del borde final para que cierre limpio */
.fc-theme-standard .fc-scrollgrid {
    border-bottom: 1px solid var(--border-color) !important;
}

/* --- FIX: Evitar que los menús desplegables se escondan tras el calendario --- */
.agenda-layout .agenda-form {
    position: relative;
    z-index: 20;
}
.agenda-layout .agenda-events {
    position: relative;
    z-index: 10;
}



/* --- FIX: Solapamiento del calendario y dropdowns --- */
.agenda-form {
    position: relative;
    z-index: 999 !important; /* Fuerza el menú por encima del calendario */
}
.agenda-events {
    position: relative;
    z-index: 1; 
}

/* --- FIX: Interfaz y Header Responsivo (Móviles) --- */
@media (max-width: 768px) {
    #user-email-display {
        display: none !important; /* Oculta el correo/nombre en celular para dar espacio */
    }
    #nav-logo-text {
        font-size: 1.2rem !important; /* Texto del logo más discreto */
    }
    #nav-logo-img {
        height: 40px !important; /* Logo proporcionado en celular */
    }
    
    /* Arreglo de los modales en móviles */
    .modal-content {
        padding: 1.2rem !important;
        width: 95vw !important;
        max-width: 100% !important;
        max-height: 85vh !important;
        border-radius: 12px !important;
        overflow-y: auto;
    }
    .modal-actions {
        flex-direction: column;
    }
    .modal-actions button {
        width: 100%;
        margin-right: 0 !important;
        margin-bottom: 8px;
    }
}

/* --- ANIMACIÓN UX: Resaltar formulario al hacer clic en calendario --- */
@keyframes pulse-highlight {
    0% { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); transform: scale(1); }
    50% { box-shadow: 0 0 25px var(--primary); transform: scale(1.02); border-color: var(--primary); }
    100% { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); transform: scale(1); }
}

@keyframes slideRight {
    0% { transform: translateX(-100%); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

.highlight-pulse {
    animation: pulse-highlight 0.8s ease-in-out;
    border-color: var(--primary) !important;
}

/* --- ESTADO ACTIVO DEL NAVBAR GLOBAL --- */
.active-nav-btn {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1), 0 0 12px var(--primary);
}

/* ─── REGION: MODULE - HOMEPAGE & LANDING ─── */

.service-card {
    border-radius: 20px;
    padding: 2.5rem 1.5rem 1.5rem 1.5rem;
    text-align: center;
    position: relative;
    border-top: 4px solid var(--primary); /* Acento superior */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.service-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    border-color: var(--accent); /* Cambia de color al interactuar */
}

.service-icon {
    font-size: 2.5rem;
    background: var(--bg-body);
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin: 0 auto 1.5rem auto;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.08);
    border: 2px solid var(--primary-dim);
    /* Posicionamiento flotante */
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
}

.service-card h3 {
    font-size: 1.3rem;
    color: var(--text-main);
    margin-bottom: 1rem;
    font-weight: 700;
}

.service-card p {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* --- ESTILOS DEL FOOTER PÚBLICO --- */

footer a:hover {
    color: var(--primary) !important;
}

footer iframe {
    transition: opacity 0.3s ease;
}

footer iframe:hover {
    opacity: 0.85; /* Da un feedback visual de que el mapa es interactivo */
}

/* --- REQ-AGENDA-04: EFECTO DE CELDAS PASADAS --- */

/* 1. Teñimos el fondo del día con el color secundario del tema actual */
.fc-day-past {
    background-color: var(--primary-dim) !important;
}

/* 2. Aplicamos opacidad a toda la columna (esto afecta las celdas vacías Y las citas que estén adentro) */
td.fc-day-past {
    opacity: 0.55;
    /* Un ligero filtro para que los colores se vean más "apagados" (pasados) */
    filter: grayscale(40%);
    transition: all 0.3s ease;
}

/* 3. ¡Magia UX! Al pasar el mouse sobre un día pasado, le devolvemos la vida 
      por si el doctor quiere leer claramente una cita vieja. */
td.fc-day-past:hover {
    opacity: 0.95;
    filter: grayscale(0%);
}

/* --- FIX: CORRECCIÓN DE FONDOS GRISES Y SCROLL EN MODALES --- */
.modal-content {
    /* Usamos el color base del tema (sólido) para que el fondo negro 
       del modal no "ensucie" ni agrise los colores pastel/claros */
    background: var(--bg-body) !important; 
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    color: var(--text-main);
    
    /* 🚀 FIX: Habilitar Scroll Interno Responsivo */
    max-height: 90vh;  /* Nunca ocupará más del 90% del alto de la pantalla */
    overflow-y: auto;  /* Si el contenido es muy largo, activa el scroll */
}

/* Estilo del Scrollbar del modal para que se vea moderno y no rompa el diseño */
.modal-content::-webkit-scrollbar { width: 6px; }
.modal-content::-webkit-scrollbar-thumb { background-color: var(--border-color); border-radius: 4px; }

/* --- FR4: SISTEMA DE TOASTS (Notificaciones Efímeras) --- */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 999999; /* Siempre por encima de todo */
    pointer-events: none; /* Para no bloquear clics en la pantalla */
}

.toast-msg {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-main);
    border-left: 4px solid var(--primary);
    padding: 14px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto; /* El toast sí puede recibir clics si quisiéramos */
    
    /* Animación de entrada inicial (oculto a la derecha) */
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55); /* Efecto rebote */
}

.toast-msg.show {
    transform: translateX(0);
    opacity: 1;
}

/* Variantes de color según el tipo de aviso */
.toast-success { border-left-color: #10b981; } /* Verde */
.toast-error { border-left-color: #ef4444; }   /* Rojo */
.toast-info { border-left-color: #3b82f6; }    /* Azul */
.toast-warning { border-left-color: #f59e0b; } /* Naranja */

/* --- 🚀 FR6: HEADER RESPONSIVO Y MENÚ LATERAL MÓVIL --- */
#mobile-menu-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(3px);
    z-index: 990; opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
#mobile-menu-overlay.show {
    opacity: 1; pointer-events: auto;
}

@media (max-width: 768px) {
    .mobile-only { display: block !important; }
    .hidden-mobile { display: none !important; }
    
    /* Convertimos los botones centrales en un panel desplegable de altura dinámica */
    #nav-central-actions {
        position: fixed;
        top: 72px; right: -280px; /* Se renderiza justo debajo del header */
        width: 260px; 
        height: auto;
        max-height: calc(100vh - 90px); /* Evita que se salga de la pantalla */
        overflow-y: auto; /* Scroll interno si hay muchos items */
        background: var(--bg-card);
        backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
        border-left: 1px solid var(--border-color);
        border-bottom: 1px solid var(--border-color);
        border-bottom-left-radius: 24px; /* Estética Premium: redondeado inferior */
        flex-direction: column;
        padding: 20px; 
        gap: 12px !important;
        z-index: 995;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s;
        box-shadow: -10px 10px 30px rgba(0,0,0,0.1);
        visibility: hidden; 
        pointer-events: none;
    }
    
    #nav-central-actions.open {
        right: 0; 
        visibility: visible;
        pointer-events: auto;
    }

    /* Animación escalonada para los botones del menú lateral */
    #nav-central-actions button {
        opacity: 0;
        transform: translateX(20px);
        transition: all 0.4s ease;
    }

    #nav-central-actions.open button {
        opacity: 1;
        transform: translateX(0);
    }

    #nav-central-actions.open button:nth-child(1) { transition-delay: 0.1s; }
    #nav-central-actions.open button:nth-child(2) { transition-delay: 0.15s; }
    #nav-central-actions.open button:nth-child(3) { transition-delay: 0.2s; }
    #nav-central-actions.open button:nth-child(4) { transition-delay: 0.25s; }
    #nav-central-actions.open button:nth-child(5) { transition-delay: 0.3s; }
    #nav-central-actions.open button:nth-child(6) { transition-delay: 0.35s; }
    #nav-central-actions.open button:nth-child(7) { transition-delay: 0.4s; }
    
    #nav-central-actions button {
        width: 100%;
        text-align: left;
        padding: 14px 22px;
        font-size: 1rem;
        justify-content: flex-start;
        border-radius: 12px;
        margin-bottom: 8px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--border-color);
        display: flex;
        align-items: center;
        gap: 12px;
    }

    #nav-central-actions button img {
        width: 20px;
        height: 20px;
    }
}

/* --- 🚀 FR7 & FR8: OPTIMIZACIÓN MÓVIL EXTREMA --- */
@media (max-width: 768px) {
    /* 1. Tipografía Fluida (Evitar títulos gigantes que rompen la pantalla) */
    h1, #home-hero-title { font-size: clamp(1.8rem, 7vw, 2.5rem) !important; }
    h2 { font-size: clamp(1.4rem, 6vw, 1.8rem) !important; }
    h3 { font-size: clamp(1.1rem, 5vw, 1.4rem) !important; }

    /* Ajuste de alineación para el botón de menú móvil */
    #btn-mobile-menu {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        transition: transform 0.2s ease;
    }
    #btn-mobile-menu:active {
        transform: scale(0.9);
    }
    #btn-mobile-menu img {
        filter: var(--theme-icon-filter); /* Adaptable si existe */
    }

    /* 2. FullCalendar (Salvar la tabla y los botones) */
    .fc-toolbar-title { 
        font-size: 1.1rem !important; 
        white-space: normal !important; 
        text-align: center; 
        line-height: 1.2; 
    }
    .fc-header-toolbar { 
        flex-direction: column !important; 
        gap: 12px; 
    }
    .fc-toolbar-chunk { 
        display: flex; 
        justify-content: center; 
        width: 100%; 
        flex-wrap: wrap; 
        gap: 5px; 
    }
    .fc-col-header-cell-cushion { 
        font-size: 0.7rem !important; /* Días más pequeños */
        padding: 4px !important;
    }
    .fc .fc-button { 
        padding: 6px 10px !important; 
        font-size: 0.85rem !important; 
    }

    /* 3. Header y Campanita (Evitar que se amontone y se corte) */
    .user-info { gap: 8px !important; }
    #notification-dropdown { 
        width: 270px !important; 
        right: -60px !important; /* Centra el dropdown respecto a la campana */
    }

    /* 4. Filtros y Botones Generales */
    .filter-bar { 
        justify-content: flex-start; 
        padding-bottom: 10px; 
    }
    .filter-btn { 
        font-size: 0.8rem; 
        padding: 6px 12px; 
    }
}

/* --- 10. FIRMA DIGITAL (COFEPRIS) --- */
.signature-wrapper {
    border: 2px dashed var(--primary);
    border-radius: 12px;
    background: var(--bg-body);
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.02);
}

.signature-pad {
    width: 100%;
    height: 250px;
    cursor: crosshair;
    /* 🚀 MAGIA: Evita que el celular haga scroll al pasar el dedo por aquí */
    touch-action: none; 
}

.signature-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
}
/* =========================================
   FIX: TRANSPARENCIA EN MENÚS DESPLEGABLES (REFINADO)
   ========================================= */
.dropdown-menu,
#notification-list {
    z-index: 1050 !important;
}

/* Ajuste específico para el encabezado del dropdown de notificaciones */
#notification-dropdown > div:first-child {
    background-color: var(--bg-body) !important;
}

/* =========================================
   FIX: TRANSPARENCIA EN BOTONES DEL NAVBAR
   ========================================= */
#nav-central-actions .btn-outline {
    background-color: var(--bg-body); /* Fondo sólido */
    backdrop-filter: none;
    font-weight: 700;
}

#nav-central-actions .btn-outline:hover {
    background-color: var(--primary) !important;
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Adaptación de iconos en botones para modo oscuro y temas */
body.dark-mode .btn-outline img,
[data-theme="coffee"] .btn-outline img,
[data-theme="dark"] .btn-outline img {
    filter: brightness(0.8) invert(0.9);
}

body.dark-mode .btn-outline.active-nav-btn img,
body.dark-mode .btn-outline:hover img,
[data-theme="dark"] .btn-outline.active-nav-btn img,
[data-theme="dark"] .btn-outline:hover img {
    filter: brightness(1) invert(1);
}

/* ─── REGION: MODULE - AUTHENTICATION ─── */
.auth-mode-hidden {
    display: none !important;
}

.auth-mode-active {
    display: flex !important;
    animation: fadeIn 0.4s ease forwards;
}

#btn-login-google:hover {
    background-color: #f8fafc !important;
    border-color: #94a3b8 !important;
    transform: translateY(-2px);
}

/* ─── REGION: MODULE - WHATSAPP CHAT ENGINE ─── */
/* 1. Chat Bidireccional (Bubbles & Real-time UI) */

/* ── Contenedor principal ─────────────────────────────────────────────── */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 65vh;
    min-height: 480px;
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* ── Header del chat ──────────────────────────────────────────────────── */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: rgba(37, 99, 235, 0.05);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(8px);
    flex-shrink: 0;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar-ring {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.1);
    border: 2px solid rgba(37, 99, 235, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-header-icon {
    width: 20px;
    height: 20px;
}

.chat-header-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.2;
}

.chat-header-phone {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
}

.chat-header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #10b981;
    font-weight: 500;
}

.chat-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: chatPulse 2s infinite;
}

@keyframes chatPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

/* ── Feed de mensajes ─────────────────────────────────────────────────── */
.chat-feed {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
}

.chat-feed::-webkit-scrollbar {
    width: 4px;
}

.chat-feed::-webkit-scrollbar-track {
    background: transparent;
}

.chat-feed::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

/* ── Estado de carga ──────────────────────────────────────────────────── */
.chat-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    opacity: 0.5;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.chat-loading-dots {
    display: flex;
    gap: 4px;
}

.chat-loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    animation: chatDot 1.4s infinite ease-in-out;
}

.chat-loading-dots span:nth-child(1) { animation-delay: 0s; }
.chat-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatDot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ── Burbujas de mensaje ──────────────────────────────────────────────── */
.chat-bubble {
    display: flex;
    max-width: 72%;
    animation: bubbleIn 0.2s ease-out forwards;
}

@keyframes bubbleIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Paciente — izquierda */
.chat-bubble--patient {
    align-self: flex-start;
}

.chat-bubble--patient .chat-bubble-inner {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 2px 14px 14px 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Clínica — derecha */
.chat-bubble--clinic {
    align-self: flex-end;
}

.chat-bubble--clinic .chat-bubble-inner {
    background: rgba(37, 99, 235, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(37, 99, 235, 0.18);
    border-radius: 14px 2px 14px 14px;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.chat-bubble--failed .chat-bubble-inner {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.05);
}

/* ── Ajustes de Contraste en Modo Oscuro ── */
body.dark-mode .chat-container {
    background: rgba(15, 23, 42, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
}

body.dark-mode .chat-header {
    background: rgba(255, 255, 255, 0.04);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .chat-header-name {
    color: #f8fafc;
}

body.dark-mode .chat-header-phone {
    color: rgba(255, 255, 255, 0.5);
}

body.dark-mode .chat-feed {
    background: radial-gradient(circle at center, rgba(30, 41, 59, 0.3), rgba(15, 23, 42, 0.3));
}

body.dark-mode .chat-feed::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

body.dark-mode .chat-bubble--patient .chat-bubble-inner {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
}

body.dark-mode .chat-bubble--clinic .chat-bubble-inner {
    background: var(--primary); /* Color sólido para destacar */
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.dark-mode .chat-bubble--clinic .chat-bubble-text {
    color: #fff;
    font-weight: 500;
}

body.dark-mode .chat-bubble--clinic .chat-timestamp,
body.dark-mode .chat-bubble--clinic .chat-tick {
    color: rgba(255, 255, 255, 0.8);
}

body.dark-mode .chat-input-bar {
    background: rgba(15, 23, 42, 0.8);
    border-top-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .chat-input-field {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(255, 255, 255, 0.15);
    color: #f8fafc;
}

body.dark-mode .chat-input-field:focus {
    background: rgba(30, 41, 59, 0.8);
    border-color: var(--primary);
}

/* ── Inner de la burbuja ──────────────────────────────────────────────── */
.chat-bubble-inner {
    padding: 10px 14px 8px 14px;
    min-width: 80px;
}

.chat-bubble-text {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-main);
    word-break: break-word;
    white-space: pre-wrap;
}

.chat-bubble-text--muted {
    opacity: 0.6;
    font-style: italic;
    font-size: 0.82rem;
}

/* ── Metadata de la burbuja (hora + tick) ─────────────────────────────── */
.chat-bubble-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 5px;
}

.chat-timestamp {
    font-size: 0.68rem;
    color: var(--text-muted);
    opacity: 0.8;
    white-space: nowrap;
}

.chat-tick {
    display: flex;
    align-items: center;
    color: var(--text-muted);
    height: 14px;
}

/* ── Media: imágenes ──────────────────────────────────────────────────── */
.chat-media-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-media-thumb {
    max-width: 260px;
    max-height: 200px;
    border-radius: 10px;
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
    display: block;
}

.chat-media-thumb:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.chat-media-caption {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ── Media: audio ─────────────────────────────────────────────────────── */
.chat-audio-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.chat-audio-player {
    height: 36px;
    max-width: 220px;
    border-radius: 20px;
    outline: none;
}

/* ── Media: documento ─────────────────────────────────────────────────── */
.chat-doc-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: opacity 0.2s;
}

.chat-doc-link:hover {
    opacity: 0.75;
    text-decoration: underline;
}

/* ── Links en texto ───────────────────────────────────────────────────── */
.chat-link {
    color: var(--primary);
    text-decoration: underline;
    word-break: break-all;
}

/* ── Barra de input ───────────────────────────────────────────────────── */
.chat-input-bar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
    flex-shrink: 0;
}

.chat-input-field {
    flex: 1;
    resize: none;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text-main);
    background: var(--bg-body);
    outline: none;
    line-height: 1.4;
    max-height: 120px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.chat-input-field::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.chat-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s ease, transform 0.15s ease;
}

.chat-send-btn:hover:not(:disabled) {
    background: #1d4ed8;
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.chat-attach-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--border-color);
    cursor: not-allowed;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ── Error en feed ────────────────────────────────────────────────────── */
.chat-error {
    text-align: center;
    font-size: 0.8rem;
    color: #ef4444;
    padding: 8px;
    opacity: 0.8;
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .chat-container {
        height: 70vh;
        border-radius: 0;
    }

    .chat-bubble {
        max-width: 88%;
    }

    .chat-media-thumb {
        max-width: 200px;
    }
}


/* ─── REGION: MODULE - EXPEDIENTE & PATIENT PROFILE ─── */
/* 1. Sistema de Pestañas y Navegación Clínica */

/* ── Barra de pestañas (Nivel 1) ──────────────────────────────────────── */
.expediente-tab-bar {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
    padding: 2px;
    background: var(--bg-body);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    width: fit-content;
    max-width: 100%;
}

.exp-tab {
    padding: 9px 18px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative;
}

.exp-tab:hover:not(.active) {
    background: rgba(37, 99, 235, 0.06);
    color: var(--text-main);
}

.exp-tab.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.exp-tab img {
    transition: filter 0.2s ease;
}

.exp-tab.active img {
    filter: brightness(0) invert(1);
}

.exp-tab.active svg {
    stroke: white;
}

/* ── Barra de sub-filtros (Nivel 2) ───────────────────────────────────── */
.expediente-subfilter-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(37, 99, 235, 0.04);
    border-radius: 10px;
    border: 1px dashed rgba(37, 99, 235, 0.2);
    animation: subfilterSlideDown 0.22s ease-out forwards;
}

.expediente-subfilter-bar.hidden {
    display: none;
}

@keyframes subfilterSlideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Sub-filtros: botones más compactos */
.expediente-subfilter-bar .filter-btn {
    padding: 6px 14px;
    font-size: 0.82rem;
    border-radius: 8px;
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .expediente-tab-bar {
        gap: 2px;
    }

    .exp-tab {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .exp-tab img,
    .exp-tab svg {
        display: none; /* Ocultar íconos en móvil para ahorrar espacio */
    }
}


/* 2. Panel de Conversaciones (Listado & Búsqueda) */

/* ── Header del panel ─────────────────────────────────────────────── */
.conv-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 16px;
    flex-wrap: wrap;
}

.conv-panel-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ── Tabs de tipo ─────────────────────────────────────────────────── */
.conv-type-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 1.2rem;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 3px;
    width: fit-content;
}

.conv-type-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.conv-type-tab:hover:not(.active) {
    background: rgba(37, 99, 235, 0.06);
    color: var(--text-main);
}

.conv-type-tab.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

/* ── Indicadores de tipo ──────────────────────────────────────────── */
.badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-dot--green { background: #10b981; }
.badge-dot--amber { background: #f59e0b; }

/* ── Lista de conversaciones ──────────────────────────────────────── */
.conv-list-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.conv-list-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 3rem;
    opacity: 0.5;
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* ── Tarjeta de conversación ──────────────────────────────────────── */
.conv-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.18s ease;
    position: relative;
}

.conv-card:hover {
    border-color: rgba(37, 99, 235, 0.3);
    background: rgba(37, 99, 235, 0.03);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
}

.conv-card-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.1);
    border: 2px solid rgba(37, 99, 235, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.conv-card-body {
    flex: 1;
    min-width: 0;
}

.conv-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.conv-card-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.conv-card-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.conv-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.conv-card-preview {
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.conv-card-unread {
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.conv-card-notes {
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.8;
}

/* ── Botones de acción dentro de la tarjeta ───────────────────────── */
.conv-link-btn,
.conv-open-btn {
    border: none;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.conv-link-btn {
    background: rgba(245, 158, 11, 0.1);
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.conv-link-btn:hover {
    background: rgba(245, 158, 11, 0.2);
}

.conv-open-btn {
    background: rgba(37, 99, 235, 0.08);
    color: var(--primary);
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.conv-open-btn:hover {
    background: rgba(37, 99, 235, 0.14);
}

/* ── Badges de perfil ─────────────────────────────────────────────── */
.conv-profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.conv-profile-badge--linked {
    background: rgba(16, 185, 129, 0.1);
    color: #065f46;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.conv-profile-badge--spontaneous {
    background: rgba(245, 158, 11, 0.1);
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* ── Badge en botón nav ───────────────────────────────────────────── */
.conv-unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
}

/* ── Resultados del buscador en modal ─────────────────────────────── */
.link-patient-option:hover {
    background: rgba(37, 99, 235, 0.05);
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .conv-card-top {
        flex-direction: column;
        gap: 4px;
    }

    .conv-type-tabs {
        flex-wrap: wrap;
    }
}

/* 3. Homepage Components (Hero & Mural) */
.hero-section {
    position: relative;
    min-height: 75vh;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.18) 0%,
        rgba(0, 0, 0, 0.44) 55%,
        rgba(0, 0, 0, 0.70) 100%
    );
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: left;
    color: #fff;
    padding: 2rem 5%;
    max-width: 820px;
    width: 100%;
}

.hero-content h1 {
    font-size: clamp(2.4rem, 6vw, 5rem);
    font-weight: 800;
    text-shadow: 0 2px 24px rgba(0, 0, 0, 0.45);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: #fff;
}

.hero-content p {
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    opacity: 0.88;
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.35);
    max-width: 580px;
    margin: 0 0 2rem;
    line-height: 1.55;
    color: #fff;
}

.hero-cta {
    font-size: 1.05rem;
    padding: 14px 36px;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.28);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: inline-block;
}

.hero-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.32);
}

/* Cuando no hay imagen de portada configurada → fondo degradado elegante */
.hero-section--no-cover {
    background: linear-gradient(135deg, var(--primary) 0%, #1e40af 60%, #0f172a 100%);
}

/* ═══════════════════════════════════════════════════════════════
   MURAL — Feed de avisos autenticados (Phase 1.3)
═══════════════════════════════════════════════════════════════ */
.mural-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.mural-header h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
}

.mural-header p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 2px 0 0 0;
    opacity: 0.8;
}

.mural-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 1.2rem;
}

.mural-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.4rem 1.6rem;
    border-left: 5px solid transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: default;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.mural-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.09);
}

.mural-card--pending  { border-left-color: #f59e0b; }
.mural-card--promo    { border-left-color: #10b981; }
.mural-card--appt     { border-left-color: var(--primary); }
.mural-card--admin    { border-left-color: #6366f1; }

.mural-card-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    opacity: 0.5;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mural-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.4rem;
    line-height: 1.35;
}

.mural-card-body {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.1rem;
    line-height: 1.5;
}

.mural-card-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 7px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.15s ease;
    text-decoration: none;
}

.mural-card-action:hover {
    opacity: 0.82;
    transform: translateY(-1px);
}

.mural-card-action--pending {
    background: rgba(245, 158, 11, 0.12);
    color: #92400e;
}

.mural-card-action--promo {
    background: rgba(16, 185, 129, 0.12);
    color: #065f46;
}

.mural-card-action--appt {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

.mural-card-action--admin {
    background: rgba(99, 102, 241, 0.1);
    color: #4338ca;
}

.mural-empty {
    text-align: center;
    padding: 3rem 2rem;
    opacity: 0.42;
    font-size: 0.95rem;
    background: var(--bg-body);
    border-radius: 14px;
    border: 1px dashed var(--border-color);
    grid-column: 1 / -1;
}

.mural-section-divider {
    grid-column: 1 / -1;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    opacity: 0.55;
    padding: 0.5rem 0 0.2rem;
    border-bottom: 1px solid var(--border-color);
    margin-top: 0.5rem;
}

/* Glassmorphism overrides for mural */
.mural-card {
    background: rgba(255, 255, 255, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    border-radius: 16px;
    padding: 1.4rem 1.6rem;
    border-left: 5px solid transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease !important;
    cursor: default;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.07), inset 0 0 0 1px rgba(255, 255, 255, 0.4) !important;
}

/* Soporte para Modo Oscuro en todos los temas (body.dark-mode) */
body.dark-mode .mural-card {
    background: rgba(15, 23, 42, 0.8) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
}

body.dark-mode .mural-card-label {
    color: var(--primary);
    opacity: 0.9;
    font-weight: 800;
}

body.dark-mode .mural-card-title {
    color: #f8fafc !important;
}

body.dark-mode .mural-card-body {
    color: #cbd5e1 !important;
    opacity: 0.9;
}

/* Mejorar contraste de labels específicos en modo oscuro */
body.dark-mode .mural-card--pending { border-left-color: #fbbf24; }
body.dark-mode .mural-card--promo { border-left-color: #34d399; }
body.dark-mode .mural-card--appt { border-left-color: var(--primary); }

/* =====================================================================
   === BUSINESS HOURS EDITOR (Seccion 6 — Mi Consultorio)           ===
   ===================================================================== */

/* — Fila de dia — */
.bh-day-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    transition: background 0.2s, border-color 0.2s;
}
.bh-day-row:hover {
    border-color: rgba(var(--primary-rgb, 59,130,246), 0.35);
}
.bh-day-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    width: 90px;
    flex-shrink: 0;
}
.bh-toggle { flex-shrink: 0; }
.bh-time-range {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    transition: opacity 0.25s;
}
.bh-time-range.disabled {
    opacity: 0.3;
    pointer-events: none;
}
.bh-time-range input[type="time"] {
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 0.88rem;
    font-weight: 600;
    min-width: 90px;
    cursor: pointer;
    transition: border-color 0.2s;
}
.bh-time-range input[type="time"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 59,130,246), 0.15);
}
.bh-separator {
    color: var(--text-muted);
    font-weight: 700;
    font-size: 1rem;
}
.bh-closed-badge {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    background: rgba(var(--primary-rgb, 59,130,246), 0.07);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 3px 10px;
    white-space: nowrap;
    transition: opacity 0.2s;
}
.bh-closed-badge.hidden { display: none; }

/* =====================================================================
   === HOURS PUBLIC WIDGET (Homepage + Agenda del Paciente)          ===
   ===================================================================== */
.hours-widget {
    background: var(--bg-card);
    border: 1px solid rgba(var(--primary-rgb, 59,130,246), 0.15);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 18px;
    padding: 1.5rem 1.75rem;
    box-shadow: 0 4px 28px rgba(var(--primary-rgb, 59,130,246), 0.07);
    animation: cardFadeIn 0.5s ease both;
}
.hours-widget-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 1.1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}
.hours-widget-header img { width: 22px; height: 22px; }
.hours-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.hours-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 0.88rem;
    transition: background 0.18s;
}
.hours-item:hover { background: rgba(var(--primary-rgb, 59,130,246), 0.05); }
.hours-item .day { font-weight: 600; color: var(--text-main); }
.hours-item .range { font-weight: 700; color: var(--primary); }
.hours-item--closed { opacity: 0.5; }
.hours-item--closed .range-badge {
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(var(--primary-rgb, 59,130,246), 0.07);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2px 10px;
}
.hours-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(var(--primary-rgb, 59,130,246), 0.07);
    border: 1px solid rgba(var(--primary-rgb, 59,130,246), 0.18);
    border-radius: 14px;
    padding: 12px 18px;
    margin-bottom: 1.2rem;
    animation: cardFadeIn 0.4s ease both;
}
.hours-banner-icon { width: 22px; height: 22px; flex-shrink: 0; opacity: 0.85; }
.hours-banner-text { margin: 0; font-size: 0.87rem; color: var(--text-main); line-height: 1.5; }
.hours-banner-text strong { color: var(--primary); font-weight: 700; }

@media (max-width: 600px) {
    .bh-day-row { flex-wrap: wrap; gap: 8px; }
    .bh-day-label { width: 100%; margin-bottom: 2px; }
    .bh-time-range { flex: none; }
    .hours-widget { padding: 1.1rem 1rem; }
    .hours-banner { flex-direction: column; align-items: flex-start; gap: 6px; }
}
