/* MedControl Premium Theme - Modern Dark/Light Design */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Paleta de Colores de Alto Contraste y Premium (Clínico Moderno Light - Verdi-Azul) */
    --bg-primary: #f0fdfa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --border-color: #cbd5e1;
    --border-hover: #99f6e4;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --accent-emerald: #0d9488;
    --accent-emerald-hover: #0f766e;
    --accent-sky: #0891b2;
    --accent-sky-hover: #0e7490;
    --accent-rose: #e11d48;
    --accent-rose-hover: #be123c;
    --accent-amber: #d97706;
    
    --shadow-premium: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 20px rgba(13, 148, 136, 0.08);
    
    --radius-xl: 20px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

code {
    background: rgba(15, 23, 42, 0.05);
    color: var(--text-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

/* Reset de Estilos */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Scrollbar Personalizado */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-sm);
    border: 2px solid var(--bg-primary);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Tipografías y Títulos */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

a {
    color: var(--accent-sky);
    text-decoration: none;
    transition: var(--transition);
}
a:hover {
    color: var(--accent-sky-hover);
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 15px rgba(16, 185, 129, 0.2); }
    50% { box-shadow: 0 0 25px rgba(16, 185, 129, 0.4); }
}

.animate-fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ==========================================================================
   LANDING PAGE E INICIO DE SESIÓN
   ========================================================================== */
.login-container {
    min-height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 10% 20%, rgba(13, 148, 136, 0.06) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(8, 145, 178, 0.06) 0%, transparent 45%),
                var(--bg-primary);
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: var(--border-premium);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 480px;
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-premium);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-emerald), var(--accent-sky));
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 30px;
}

.logo-icon {
    background: linear-gradient(135deg, var(--accent-emerald), var(--accent-sky));
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 24px;
    box-shadow: var(--shadow-glow);
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -1px;
}

.logo-text span {
    color: var(--accent-emerald);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ==========================================================================
   COMPONENTES DE FORMULARIO
   ========================================================================== */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.form-control {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 15px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-emerald);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Checkboxes y Radios Personalizados */
.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    cursor: pointer;
}

.form-check-input {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #ffffff;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.form-check-input:checked {
    background: var(--accent-emerald);
    border-color: var(--accent-emerald);
}

.form-check-input:checked::before {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 14px;
    font-weight: bold;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.form-radio-input {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.form-radio-input:checked {
    border-color: var(--accent-emerald);
}

.form-radio-input:checked::before {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--accent-emerald);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Botones Premium */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-emerald), #059669);
    color: white;
    box-shadow: 0 4px 15px -3px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -3px rgba(16, 185, 129, 0.5);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(15, 23, 42, 0.04);
    border-color: var(--border-hover);
}

.btn-danger {
    background: linear-gradient(135deg, var(--accent-rose), #E11D48);
    color: white;
    box-shadow: 0 4px 15px -3px rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -3px rgba(244, 63, 94, 0.5);
}

.btn-block {
    width: 100%;
}

/* Alertas Estilizadas */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid transparent;
}

.alert-danger {
    background: rgba(244, 63, 94, 0.08);
    border-color: rgba(244, 63, 94, 0.2);
    color: #b91c1c;
}

.alert-success {
    background: rgba(13, 148, 136, 0.08);
    border-color: rgba(13, 148, 136, 0.2);
    color: #0f766e;
}

.alert-info {
    background: rgba(8, 145, 178, 0.08);
    border-color: rgba(8, 145, 178, 0.2);
    color: #0e7490;
}

/* ==========================================================================
   ESTRUCTURA DASHBOARD (SIDEBAR + MAIN CONTENT)
   ========================================================================== */
.dashboard-container {
    display: flex;
    width: 100vw;
    min-height: 100vh;
}

/* Sidebar Estilo Neo-Clinical */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: var(--transition);
}

.sidebar-brand {
    padding: 30px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-menu {
    list-style: none;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.sidebar-item-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.sidebar-item-link svg {
    width: 22px;
    height: 22px;
    color: var(--text-muted);
    transition: var(--transition);
}

.sidebar-item-link:hover {
    color: var(--text-primary);
    background: rgba(13, 148, 136, 0.05);
}

.sidebar-item-link:hover svg {
    color: var(--accent-emerald);
}

.sidebar-item-link.active {
    color: white;
    background: linear-gradient(135deg, var(--accent-emerald), var(--accent-emerald-hover));
    border: 1px solid var(--accent-emerald);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.2);
}

.sidebar-item-link.active svg {
    color: white;
}

/* Sidebar Footer (Información de Perfil de Usuario) */
.sidebar-user {
    padding: 20px;
    background: rgba(13, 148, 136, 0.04);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-emerald), var(--accent-sky));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 16px;
}

.user-info {
    flex-grow: 1;
    overflow: hidden;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.user-role {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--accent-emerald);
    letter-spacing: 0.05em;
}

/* Área de Contenido Principal */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: 80px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
}

.topbar-title h1 {
    font-size: 24px;
    font-weight: 700;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.patient-badge {
    background: rgba(8, 145, 178, 0.08);
    border: 1px solid rgba(8, 145, 178, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--accent-sky);
    display: flex;
    align-items: center;
    gap: 8px;
}

.patient-badge strong {
    color: var(--text-primary);
}

.content-pane {
    padding: 40px;
    overflow-y: auto;
    flex-grow: 1;
}

/* ==========================================================================
   CARDS Y DISEÑO DE REJILLA (LAYOUT SYSTEM)
   ========================================================================== */
.grid {
    display: grid;
    gap: 30px;
}

.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-5 { grid-template-columns: repeat(5, 1fr); }

.grid-main-aside {
    grid-template-columns: 2fr 1fr;
}

@media(max-width: 1024px) {
    .grid-cols-3, .grid-cols-4, .grid-cols-5, .grid-main-aside {
        grid-template-columns: 1fr;
    }
}
@media(max-width: 768px) {
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    .topbar {
        padding: 0 20px;
    }
    .content-pane {
        padding: 20px;
    }
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-premium);
    position: relative;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-hover);
}

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

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Tablas Premium */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 10px;
}

.table th {
    background: rgba(15, 23, 42, 0.02);
    padding: 14px 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.table td {
    padding: 16px 20px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

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

.table tr:hover td {
    background: rgba(15, 23, 42, 0.01);
}

/* ==========================================================================
   VISTAS Y MÓDULOS ESPECÍFICOS
   ========================================================================== */

/* Submenús en Pacientes */
.tab-nav {
    display: flex;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
}

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

.tab-btn.active {
    color: var(--accent-emerald);
    border-bottom-color: var(--accent-emerald);
}

/* Captura de Cámara */
.camera-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    background: rgba(15, 23, 42, 0.02);
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border-color);
    margin-bottom: 20px;
}

.camera-preview {
    width: 240px;
    height: 180px;
    border-radius: var(--radius-md);
    object-fit: cover;
    background: #000;
    border: 2px solid var(--border-color);
}

.captured-image {
    width: 240px;
    height: 180px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 2px solid var(--accent-emerald);
    box-shadow: var(--shadow-glow);
}

/* Timeline del Historial */
.timeline {
    position: relative;
    padding-left: 20px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 5px;
    bottom: 5px;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: 24px;
    cursor: pointer;
}

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

.timeline-dot {
    position: absolute;
    left: -24px;
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    border: 2px solid var(--bg-primary);
    transition: var(--transition);
}

.timeline-item:hover .timeline-dot,
.timeline-item.active .timeline-dot {
    background: var(--accent-emerald);
    transform: scale(1.3);
    box-shadow: 0 0 10px var(--accent-emerald);
}

.timeline-date {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-sky);
    margin-bottom: 4px;
}

.timeline-summary {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Calendario Agenda */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-top: 15px;
}

.calendar-day-label {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding: 8px 0;
}

.calendar-day {
    min-height: 100px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: var(--transition);
}

.calendar-day:hover {
    background: rgba(15, 23, 42, 0.02);
    border-color: var(--border-hover);
}

.calendar-day.today {
    border-color: var(--accent-emerald);
    background: rgba(13, 148, 136, 0.05);
}

.calendar-day.other-month {
    opacity: 0.3;
}

.calendar-day-num {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.calendar-day.today .calendar-day-num {
    color: var(--accent-emerald);
}

.calendar-event {
    background: linear-gradient(90deg, rgba(13, 148, 136, 0.12), rgba(8, 145, 178, 0.08));
    border-left: 3px solid var(--accent-emerald);
    color: #0f766e;
    font-size: 11px;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: var(--transition);
}

.calendar-event:hover {
    transform: translateY(-1px);
    background: linear-gradient(90deg, rgba(13, 148, 136, 0.2), rgba(8, 145, 178, 0.15));
}

.calendar-event.cancelada {
    border-left-color: var(--accent-rose);
    background: rgba(244, 63, 94, 0.08);
    color: #be123c;
}

.calendar-event.confirmada {
    border-left-color: #10b981;
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.calendar-event.pendiente {
    border-left-color: var(--accent-sky);
    background: rgba(8, 145, 178, 0.12);
    color: #0369a1;
}

/* Modales Premium */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 550px;
    box-shadow: var(--shadow-premium);
    overflow: hidden;
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    transition: var(--transition);
}

.close-btn:hover {
    color: var(--text-primary);
}

/* Gráficos de Reportes Basados en CSS */
.stats-widget {
    display: flex;
    align-items: center;
    gap: 20px;
}

.stats-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-emerald);
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stats-info {
    display: flex;
    flex-direction: column;
}

.stats-number {
    font-size: 28px;
    font-weight: 700;
    font-family: var(--font-heading);
}

.stats-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.chart-bar-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
}

.chart-bar-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chart-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 500;
}

.chart-bar-bg {
    height: 8px;
    background: rgba(15, 23, 42, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-emerald), var(--accent-sky));
    border-radius: 4px;
}

/* Password criteria verification lists */
.password-criteria {
    margin-top: 10px;
    list-style: none;
    font-size: 12px;
    color: var(--text-muted);
}

.password-criteria li {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.password-criteria li.valid {
    color: var(--accent-emerald);
}

.password-criteria li.valid::before {
    content: '✓';
    font-weight: bold;
}

.password-criteria li.invalid::before {
    content: '○';
}

/* Clean UI components for attachments in history */
.attachment-card {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(15, 23, 42, 0.03);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    margin: 5px;
    font-size: 12px;
}

.attachment-card a {
    color: var(--text-primary);
}

.attachment-card a:hover {
    color: var(--accent-sky);
}

/* ==========================================================================
   DISEÑO RESPONSIVO PREMIUM (MOBILE & TABLET ADAPTATIONS)
   ========================================================================== */

/* Botón de Menú Hamburguesa (Oculto por defecto en pantallas de escritorio) */
.menu-toggle-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    align-items: center;
    justify-content: center;
}

.menu-toggle-btn:hover {
    background: rgba(15, 23, 42, 0.04);
    color: var(--accent-emerald);
}

/* Reglas Generales de Ajustes en Tablas */
.table-responsive {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

/* Pantallas Medianas y Pequeñas (Tablets y Smartphones) */
@media (max-width: 992px) {
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* Mostrar Botón Hamburguesa */
    .menu-toggle-btn {
        display: inline-flex;
    }

    /* Sidebar Flotante y Deslizable */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 1001;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 20px 0 35px rgba(0, 0, 0, 0.6);
        background: var(--bg-secondary);
    }

    .dashboard-container.sidebar-open .sidebar {
        transform: translateX(0);
    }

    /* Backdrop Oscuro de Fondo */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.65);
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
        z-index: 1000;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .dashboard-container.sidebar-open .sidebar-backdrop {
        display: block;
        opacity: 1;
    }

    /* Ajuste en el Topbar */
    .topbar {
        height: auto;
        padding: 15px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .topbar-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .patient-badge {
        width: 100%;
        justify-content: space-between;
        font-size: 12px;
        padding: 6px 12px;
    }

    /* Contenedor Principal */
    .content-pane {
        padding: 15px;
    }

    /* Tarjetas */
    .card {
        padding: 20px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    /* Calendario de Agenda deslizable */
    #clinica-calendar-workspace {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #clinica-calendar-workspace > div {
        min-width: 750px; /* Evita que el calendario colapse a tamaño ilegible */
    }

    /* Grillas y Secciones */
    .grid-cols-3, .grid-cols-4, .grid-cols-5, .grid-main-aside, .grid-cols-2 {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }

    /* Ajustar Cabecera de Paciente Activo e Historial */
    .card div[style*="display: flex; justify-content: space-between; align-items: center;"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 15px !important;
    }

    .card div[style*="display: flex; justify-content: space-between; align-items: center;"] div[style*="display: flex; gap: 10px;"] {
        width: 100%;
        justify-content: flex-start;
    }

    /* Modales */
    .modal {
        width: 95%;
        max-width: 480px;
        max-height: 90vh;
        display: flex;
        flex-direction: column;
    }

    .modal-body {
        overflow-y: auto;
        padding: 20px;
    }

    /* Cámaras y Captura */
    .camera-box {
        width: 100%;
    }

    .camera-preview, .captured-image {
        width: 100% !important;
        max-width: 320px;
        height: auto !important;
        aspect-ratio: 4/3;
    }
}

@media (max-width: 480px) {
    /* Login */
    .login-card {
        padding: 25px 20px;
    }

    .login-header h2 {
        font-size: 20px;
    }

    .logo-text {
        font-size: 24px;
    }

    /* Títulos en topbar */
    .topbar-title h1 {
        font-size: 20px;
    }

    /* Inputs de formulario */
    .form-control {
        padding: 10px 12px;
        font-size: 14px;
    }

    .btn {
        padding: 10px 18px;
        font-size: 14px;
    }

    /* Historial */
    .card h2 {
        font-size: 20px !important;
    }
}

/* ==========================================================================
   ESTILOS DE LA NUEVA LANDING PAGE (¿QUÉ ES? / CONTACTO / LOGIN)
   ========================================================================== */

/* Navbar superior estilo Glassmorphism */
.landing-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    align-items: center;
}

.landing-navbar-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Logotipo específico alineado en Navbar */
.navbar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 0;
    cursor: pointer;
}

.landing-nav {
    display: flex;
    align-items: center;
    gap: 30px;
    height: 100%;
}

.nav-link {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    position: relative;
    padding: 6px 0;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-emerald);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover::after,
.nav-link.active::after {
    transform: scaleX(1);
    transform-origin: left;
}

.btn-login-nav::after {
    display: none;
}

/* Contenedores de Secciones SPA */
.landing-section {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.landing-section.active {
    opacity: 1;
    transform: translateY(0);
}

/* Sección de Características */
.features-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.features-hero {
    text-align: center;
    max-width: 800px;
    margin-bottom: 25px;
}

.hero-badge {
    display: inline-block;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--accent-emerald);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 15px;
}

.features-hero h2 {
    font-size: 38px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 15px;
    background: linear-gradient(135deg, var(--text-primary), #94A3B8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.features-hero p {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
}

/* Contenedor Centrado y Acotado para las Tarjetas (Reducido 40%) */
.features-grid-wrapper {
    width: 100%;
    max-width: 760px; /* Reducción de ancho general para centrar y encoger */
    margin: 0 auto;
}

/* Tarjetas de Características Súper Compactas (40% de reducción visual) */
.feature-card {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 10px; /* Reducido de 15px */
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 18px; /* Reducido de 30px */
    border-radius: var(--radius-md);
}

.feature-card:hover {
    border-color: rgba(16, 185, 129, 0.2);
    transform: translateY(-3px);
    box-shadow: 0 15px 30px -10px rgba(0,0,0,0.5);
}

.feature-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-emerald);
    width: 38px; /* Reducido de 48px */
    height: 38px; /* Reducido de 48px */
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2px;
}

.feature-icon svg {
    width: 18px; /* Reducido de 24px */
    height: 18px; /* Reducido de 24px */
}

.feature-card h3 {
    font-size: 14px; /* Reducido de 18px */
    font-weight: 700;
    color: var(--text-primary);
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 12px; /* Reducido de 14px */
    line-height: 1.5;
}

/* Ajustes Adaptables para Navbar en Móviles */
@media (max-width: 768px) {
    .landing-navbar {
        height: auto;
        position: absolute;
        padding: 10px 0;
    }

    .landing-navbar-container {
        flex-direction: column;
        gap: 15px;
        align-items: center;
        padding: 0 15px;
    }

    .landing-nav {
        gap: 20px;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .landing-main {
        padding-top: 170px !important;
    }

    .features-hero h2 {
        font-size: 30px;
    }
}

/* Estilos para Pantalla de Recuperación Administrativa */
.step-box {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 15px;
    margin-bottom: 20px;
}

.step-title {
    font-size: 13.5px;
    text-transform: uppercase;
    color: var(--accent-emerald-hover);
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.step-title span {
    background: rgba(13, 148, 136, 0.1);
    color: var(--accent-emerald-hover);
}

.token-display {
    background: var(--bg-secondary);
    border: 1px solid var(--border-hover);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 15px;
    color: var(--accent-emerald);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

.copy-btn {
    background: var(--accent-emerald);
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.copy-btn:hover {
    background: var(--accent-emerald-hover);
    transform: translateY(-1px);
}

