/* Variables CSS para consistencia */
:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #10b981;
    --accent-color: #f59e0b;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-dark: #1f2937;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --border-radius: 0.75rem;
    --border-radius-sm: 0.5rem;
    --medical-primary: #0d6efd;
    --medical-info: #0dcaf0;
    --medical-secondary: #6c757d;
    --medical-success: #198754;
    --medical-bg-light: #f8f9fa;
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* =================================
   ESTILOS DE CARGA MODERNOS
   ================================= */
.loading-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, #ffffff 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(99, 102, 241, 0.1);
    border-left: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loading-text {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-secondary);
    animation: pulse 2s ease-in-out infinite;
}

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

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* =================================
   ERROR UI MODERNO
   ================================= */
#blazor-error-ui {
    background: rgba(239, 68, 68, 0.1);
    backdrop-filter: blur(10px);
    bottom: 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    display: none;
    left: 0;
    padding: 1rem;
    position: fixed;
    right: 0;
    z-index: 1000;
    border-top: 2px solid #ef4444;
}

#blazor-error-ui .error-container {
    background: white;
    border-radius: var(--border-radius);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-md);
    max-width: 600px;
    margin: 0 auto;
}

#blazor-error-ui .error-container i {
    color: #ef4444;
    font-size: 1.25rem;
}

#blazor-error-ui .reload-btn {
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

#blazor-error-ui .reload-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

#blazor-error-ui .dismiss-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: bold;
    margin-left: auto;
    padding: 0.25rem;
}

#blazor-error-ui .dismiss-btn:hover {
    color: var(--text-primary);
}

/* =================================
   COMPONENTES MÉDICOS
   ================================= */
.content .header-primary,
.main-content .header-primary {
    background: linear-gradient(135deg, var(--medical-primary) 0%, #0b5ed7 100%);
    color: white;
    border-bottom: 1px solid var(--medical-primary);
}

.content .header-info,
.main-content .header-info {
    background: linear-gradient(135deg, var(--medical-info) 0%, #31d2f2 100%);
    color: white;
    border-bottom: 1px solid var(--medical-info);
}

.content .header-secondary,
.main-content .header-secondary {
    background: linear-gradient(135deg, var(--medical-secondary) 0%, #5c636a 100%);
    color: white;
    border-bottom: 1px solid var(--medical-secondary);
}

.content .header-success,
.main-content .header-success {
    background: linear-gradient(135deg, var(--medical-success) 0%, #146c43 100%);
    color: white;
    border-bottom: 1px solid var(--medical-success);
}

.content .text-white-force,
.content .text-white-force h1,
.content .text-white-force h2,
.content .text-white-force h3,
.content .text-white-force h4,
.content .text-white-force h5,
.content .text-white-force h6,
.content .text-white-force i,
.content .text-white-force small {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.prescription-display {
    font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
    font-weight: 500;
}

.prescription-value {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--text-primary);
    background: white;
    padding: 12px 8px;
    border-radius: var(--border-radius-sm);
    border: 2px solid var(--border-color);
    min-height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.prescription-value:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.prescription-value.empty {
    color: var(--text-secondary);
    font-style: italic;
    background: var(--medical-bg-light);
    border-style: dashed;
}

.timeline {
    position: relative;
    padding-left: 3rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 1rem;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 2px;
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-marker {
    position: absolute;
    left: -2.5rem;
    top: 0.5rem;
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: 3px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    color: white;
    box-shadow: var(--shadow-md);
    z-index: 1;
}

.timeline-content {
    margin-left: 1rem;
    animation: fadeInRight 0.5s ease-out;
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* =================================
   TIPOGRAFÍA MEJORADA
   ================================= */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.025em;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

/* =================================
   BOTONES MODERNOS
   ================================= */
.btn {
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    padding: 0.75rem 1.5rem;
    border: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #3730a3 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover {
    background-color: var(--bg-secondary);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

.btn-outline-danger {
    border: 2px solid #ef4444;
    color: #ef4444;
    background: transparent;
}

.btn-outline-danger:hover {
    background-color: #ef4444;
    color: white;
    transform: translateY(-1px);
}

.btn-outline-info {
    border: 2px solid var(--medical-info);
    color: var(--medical-info);
    background: transparent;
}

.btn-outline-info:hover {
    background-color: var(--medical-info);
    color: white;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-radius: var(--border-radius-sm) 0 0 var(--border-radius-sm);
}

.btn-group .btn:last-child {
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
}

/* =================================
   CARDS MODERNAS
   ================================= */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, #ffffff 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
    background-color: var(--medical-bg-light);
}

.card-title {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-title i {
    font-size: 1.25rem;
    color: var(--primary-color);
}

.card.border-success {
    border-left: 4px solid var(--medical-success);
}

.card.border-primary {
    border-left: 4px solid var(--medical-primary);
}

.card.border-info {
    border-left: 4px solid var(--medical-info);
}

/* =================================
   FORMULARIOS MEJORADOS
   ================================= */
.form-control {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
    background-color: var(--bg-primary);
    font-weight: 400;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(99 102 241 / 0.1);
    outline: none;
    background-color: white;
}

.form-control::placeholder {
    color: var(--text-secondary);
    font-style: italic;
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-label i {
    color: var(--primary-color);
    font-size: 0.875rem;
}

.form-select {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.75rem 1rem;
    background-color: var(--bg-primary);
    transition: all 0.2s ease;
}

.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(99 102 241 / 0.1);
}

/* =================================
   AVATARES
   ================================= */
.avatar-sm {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: 50%;
}

.avatar-md {
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    border-radius: 50%;
}

.avatar-lg {
    width: 60px;
    height: 60px;
    min-width: 60px;
    min-height: 60px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.25rem;
    border-radius: 50%;
}

.avatar-sm,
.avatar-md,
.avatar-lg {
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

/* =================================
   Estados de validación
   ================================= */
.valid.modified:not([type=checkbox]) {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgb(16 185 129 / 0.1);
}

.invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgb(239 68 68 / 0.1);
}

.validation-message {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.validation-message::before {
    content: "⚠";
    font-size: 1rem;
}

.text-muted {
    color: var(--text-secondary);
}

.bg-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
}

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

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

.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

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

.bounce-in {
    animation: bounceIn 0.5s ease-out;
}

@keyframes bounceIn {
    0% { opacity: 0; transform: scale(0.3); }
    50% { opacity: 1; transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

/* =================================
   ESTRUCTURA PRINCIPAL
   ================================= */
.page {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    overflow-y: auto;
    overflow-x: hidden;
    background: linear-gradient(180deg, var(--bg-dark) 0%, #374151 100%);
    color: white;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: all 0.3s ease;
}

.main {
    margin-left: 260px;
    min-height: 100vh;
    background-color: var(--bg-secondary);
    transition: all 0.3s ease;
}

/* =================================
   NAVBAR TOP
   ================================= */
.top-row {
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1f2937 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 1001;
}

.brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    box-shadow: var(--shadow-md);
}

.brand-icon i {
    font-size: 1.25rem;
    color: white;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    margin: 0;
}

.navbar-brand:hover {
    color: white;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
    margin-top: -2px;
}

.navbar-toggler:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.navbar-toggler:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.navbar-toggler-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.navbar-toggler-icon i {
    font-size: 1.2rem;
    transition: transform 0.2s ease;
}

/* =================================
   NAVEGACIÓN
   ================================= */
.nav-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.nav {
    padding: 0 1rem;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.75rem;
    padding: 0 0.75rem;
}

.nav-item {
    margin-bottom: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.nav-link:hover::before {
    left: 100%;
}

.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
}

.nav-link.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.nav-link.active:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #3730a3 100%);
    transform: translateX(4px);
}

.nav-link.disabled {
    color: rgba(255, 255, 255, 0.4);
    cursor: not-allowed;
}

.nav-link.disabled:hover {
    background: none;
    transform: none;
    color: rgba(255, 255, 255, 0.4);
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    margin-right: 0.75rem;
    font-size: 1rem;
}

.nav-badge {
    margin-left: auto;
}

.nav-badge .badge {
    font-size: 0.625rem;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
}

/* =================================
   FOOTER DE NAVEGACIÓN
   ================================= */
.nav-footer {
    margin-top: auto;
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.nav-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--secondary-color) 0%, #059669 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    box-shadow: var(--shadow-sm);
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: white;
    margin-bottom: 2px;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

/* =================================
   CONTENIDO PRINCIPAL
   ================================= */
.main .top-row {
    background: white;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.content {
    padding: 2rem;
    min-height: calc(100vh - 80px);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

/* =================================
   COMPONENTES ADICIONALES
   ================================= */
.stats-badge {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.feature-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    height: 100%;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.feature-card:hover::before {
    opacity: 1;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    color: white;
}

.feature-icon.bg-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.feature-icon.bg-secondary {
    background: linear-gradient(135deg, var(--secondary-color), #059669);
}

.feature-icon.bg-accent {
    background: linear-gradient(135deg, var(--accent-color), #d97706);
}

.feature-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.feature-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem;
    border-radius: var(--border-radius-sm);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.quick-action:hover:not(.disabled) {
    background-color: var(--bg-secondary);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.quick-action.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quick-action-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--bg-secondary), #e2e8f0);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
    color: var(--primary-color);
    transition: all 0.2s ease;
}

.quick-action:hover:not(.disabled) .quick-action-icon {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.quick-action span {
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
}

/* =================================
   RESPONSIVE DESIGN
   ================================= */
@media (min-width: 769px) {
    .navbar-toggler {
        display: none;
    }
}

@media (max-width: 992px) {
    .card-body {
        padding: 1.25rem;
    }
    
    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.9rem;
    }
    
    .form-control,
    .form-select {
        padding: 0.625rem 0.875rem;
        font-size: 0.9rem;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.375rem; }
    h4 { font-size: 1.125rem; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        z-index: 1000;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main {
        margin-left: 0;
    }
    
    .nav-scrollable.show {
        display: block;
    }
    
    .nav-scrollable.collapse {
        display: none;
    }
    
    .navbar-toggler {
        display: block;
    }

    .content {
        padding: 1rem;
    }
    
    .nav-link {
        padding: 1rem 0.75rem;
        font-size: 1rem;
    }
    
    .nav-icon {
        width: 24px;
        font-size: 1.125rem;
    }

    .card {
        margin-bottom: 1rem;
    }
    
    .card-header {
        padding: 1rem;
        font-size: 0.95rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        gap: 0.375rem;
    }
    
    .btn-sm {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .form-control,
    .form-select {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
        min-height: 38px;
    }
    
    .form-label {
        font-size: 0.875rem;
        margin-bottom: 0.375rem;
    }
    
    .avatar-sm {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        font-size: 0.75rem;
    }
    
    .avatar-md {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        font-size: 0.875rem;
    }
    
    .avatar-lg {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
        font-size: 1rem;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.125rem; }
    h5 { font-size: 1rem; }
    h6 { font-size: 0.875rem; }
    
    .prescription-value {
        font-size: 0.9rem;
        padding: 8px 6px;
        min-height: 36px;
    }
    
    .timeline {
        padding-left: 2.5rem;
    }
    
    .timeline::before {
        left: 0.875rem;
        width: 2px;
    }
    
    .timeline-marker {
        left: -2rem;
        width: 2rem;
        height: 2rem;
        font-size: 0.75rem;
    }
    
    .timeline-content {
        margin-left: 0.75rem;
    }
}

@media (max-width: 576px) {
    .sidebar {
        width: 100%;
    }
    
    .content {
        padding: 0.75rem;
    }
    
    .top-row {
        padding: 1rem;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .brand-subtitle {
        font-size: 0.7rem;
    }

    .card-header,
    .card-body {
        padding: 0.75rem;
    }
    
    .btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
        gap: 0.25rem;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .form-control,
    .form-select {
        padding: 0.375rem 0.625rem;
        font-size: 0.8rem;
        min-height: 34px;
    }
    
    .form-label {
        font-size: 0.8rem;
        margin-bottom: 0.25rem;
    }
    
    .avatar-sm {
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
        font-size: 0.7rem;
    }
    
    .avatar-md {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        font-size: 0.8rem;
    }
    
    .avatar-lg {
        width: 42px;
        height: 42px;
        min-width: 42px;
        min-height: 42px;
        font-size: 0.9rem;
    }
    
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.375rem; }
    h3 { font-size: 1.125rem; }
    h4 { font-size: 1rem; }
    h5 { font-size: 0.9rem; }
    h6 { font-size: 0.8rem; }
    
    .prescription-value {
        font-size: 0.8rem;
        padding: 6px 4px;
        min-height: 32px;
    }
    
    .timeline {
        padding-left: 2rem;
    }
    
    .timeline-marker {
        left: -1.5rem;
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.7rem;
    }
    
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        border-radius: var(--border-radius-sm);
        margin-bottom: 0.25rem;
        width: 100%;
    }
    
    .btn-group .btn:last-child {
        margin-bottom: 0;
    }
}

/* =================================
   ESTADOS DE COLAPSO
   ================================= */
.sidebar,
.main,
.nav-scrollable {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-scrollable::-webkit-scrollbar {
    width: 6px;
}

.nav-scrollable::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.nav-scrollable::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.nav-scrollable::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
}

/* Botón hamburguesa en MainLayout */
.mobile-menu-toggle {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 1.5rem;
    padding: 0.5rem;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.mobile-menu-toggle:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-dark);
}

.mobile-menu-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.mobile-menu-toggle i {
    transition: transform 0.2s ease;
}

.mobile-menu-toggle:active i {
    transform: scale(0.95);
}

/* Overlay para móviles */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
}

/* =================================
   RESPONSIVE DESIGN ACTUALIZADO
   ================================= */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        z-index: 1000;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main {
        margin-left: 0;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
}

@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none;
    }
    
    .sidebar {
        transform: translateX(0);
    }
    
    .main {
        margin-left: 260px;
    }
}


/* =================================
   MEJORAS PARA BOTONES DE CLIENTE
   ================================= */

/* Grupo de botones de acción en tabla de clientes */
.btn-group .btn {
    border-radius: 0;
    border-width: 1px;
    margin: 0;
    position: relative;
}

.btn-group .btn:first-child {
    border-radius: var(--border-radius-sm) 0 0 var(--border-radius-sm);
}

.btn-group .btn:last-child {
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
}

.btn-group .btn:not(:first-child) {
    border-left: none;
}

/* Estilos específicos para botones de acción */
.btn-outline-primary {
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
    transition: all 0.2s ease;
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
}

.btn-outline-secondary {
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
    background: transparent;
    transition: all 0.2s ease;
}

.btn-outline-secondary:hover {
    background-color: var(--text-secondary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(107, 114, 128, 0.2);
}

.btn-outline-danger {
    border: 1px solid #ef4444;
    color: #ef4444;
    background: transparent;
    transition: all 0.2s ease;
}

.btn-outline-danger:hover {
    background-color: #ef4444;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

/* Botones pequeños en grupos */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    border-radius: var(--border-radius-sm);
    min-width: 36px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Tooltips mejorados para botones */
.btn[title] {
    position: relative;
}

.btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 4px;
    opacity: 0;
    animation: tooltipFadeIn 0.2s ease forwards;
}

@keyframes tooltipFadeIn {
    to {
        opacity: 1;
    }
}

/* =================================
   MEJORAS PARA FORMULARIO DE EXAMEN
   ================================= */

/* Contenedor del modal del examen */
.modal-xl {
    max-width: 95%;
}

@media (min-width: 1200px) {
    .modal-xl {
        max-width: 1140px;
    }
}

/* Cards del formulario de examen */
.modal-body .card {
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

.modal-body .card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

.modal-body .card-header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, #f3f4f6 100%);
    border-bottom: 2px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: 1rem;
}

.modal-body .card-header.bg-primary {
    background: linear-gradient(135deg, var(--medical-primary) 0%, #0b5ed7 100%);
    color: white;
    border-bottom-color: var(--medical-primary);
}

.modal-body .card-header.bg-info {
    background: linear-gradient(135deg, var(--medical-info) 0%, #31d2f2 100%);
    color: white;
    border-bottom-color: var(--medical-info);
}

.modal-body .card-body {
    padding: 1.5rem;
    background-color: #fafbfc;
}

/* Inputs específicos del examen */
.modal-body .form-control,
.modal-body .form-select {
    border: 2px solid #e2e8f0;
    border-radius: var(--border-radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    background-color: white;
    transition: all 0.2s ease;
}

.modal-body .form-control:focus,
.modal-body .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background-color: #fefefe;
}

.modal-body .form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Inputs numéricos especiales para graduación */
input[type="number"].form-control {
    text-align: center;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    font-size: 1rem;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

input[type="number"].form-control:focus {
    background: white;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    border-color: var(--primary-color);
}

/* Estilos específicos para campos de graduación */
.graduacion-input {
    position: relative;
}

.graduacion-input input {
    padding-right: 2.5rem;
}

.graduacion-input::after {
    content: attr(data-unit);
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    pointer-events: none;
}

/* Grid mejorado para el formulario */
.modal-body .row.g-3 > .col-md-3,
.modal-body .row.g-3 > .col-md-4,
.modal-body .row.g-3 > .col-md-6,
.modal-body .row.g-3 > .col-6 {
    margin-bottom: 1rem;
}

/* Textarea de observaciones */
.modal-body textarea.form-control {
    resize: vertical;
    min-height: 100px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
}

/* Botones del modal */
.modal-footer {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, #ffffff 100%);
    border-top: 2px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    gap: 0.75rem;
    justify-content: flex-end;
}

.modal-footer .btn {
    min-width: 120px;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
}

/* Estados de validación mejorados */
.modal-body .form-control.is-valid {
    border-color: var(--medical-success);
    background-image: none;
}

.modal-body .form-control.is-invalid {
    border-color: #dc3545;
    background-image: none;
}

/* =================================
   MEJORAS PARA HEADER DE CLIENTE
   ================================= */

.client-header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.client-header-info {
    flex: 1;
}

.client-header-details h3 {
    margin-bottom: 0.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.client-header-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 0.75rem;
}

.client-header-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.client-header-meta-item i {
    color: var(--primary-color);
    width: 16px;
    text-align: center;
}

.client-header-actions {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* =================================
   MEJORAS PARA TABLA DE CLIENTES
   ================================= */

.table {
    margin-bottom: 0;
}

.table thead th {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, #f3f4f6 100%);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary);
    padding: 1rem 0.75rem;
    position: sticky;
    top: 0;
    z-index: 1;
}

.table tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid #f1f5f9;
}

.table tbody tr:hover {
    background-color: rgba(99, 102, 241, 0.05);
    transform: translateX(2px);
}

.table tbody td {
    padding: 1rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

/* Información del cliente en tabla */
.table .fw-bold {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.table .text-muted {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Prescription display en tabla */
.prescription-display {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
}

.prescription-display small {
    font-weight: 600;
    color: var(--text-secondary);
}

/* =================================
   RESPONSIVE PARA FORMULARIO
   ================================= */

@media (max-width: 768px) {
    .modal-xl {
        max-width: 95%;
        margin: 0.5rem;
    }
    
    .modal-body .card-body {
        padding: 1rem;
    }
    
    .modal-body .row.g-3 > .col-6 {
        margin-bottom: 0.75rem;
    }
    
    .client-header-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .client-header-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .client-header-meta {
        gap: 1rem;
    }
    
    .client-header-meta-item {
        font-size: 0.85rem;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        border-radius: var(--border-radius-sm);
        margin-bottom: 0.25rem;
    }
    
    .btn-group .btn:not(:first-child) {
        border-left: 1px solid;
    }
}

@media (max-width: 576px) {
    .modal-body .row.g-3 > .col-md-3,
    .modal-body .row.g-3 > .col-md-4,
    .modal-body .row.g-3 > .col-md-6 {
        padding: 0 0.5rem;
    }
    
    .modal-body .form-control,
    .modal-body .form-select {
        padding: 0.625rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .modal-footer {
        padding: 1rem;
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .table-responsive {
        border-radius: var(--border-radius);
        overflow-x: auto;
    }
    
    .table tbody td {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
    }
    
    .btn-group {
        flex-direction: row;
        gap: 0.25rem;
    }
    
    .btn-group .btn {
        min-width: 32px;
        padding: 0.375rem;
        margin: 0;
    }
}

/* =================================
   ANIMACIONES ESPECÍFICAS
   ================================= */

.btn:hover {
    animation: buttonHover 0.2s ease;
}

@keyframes buttonHover {
    0% { transform: translateY(0); }
    50% { transform: translateY(-1px); }
    100% { transform: translateY(-1px); }
}

.card:hover {
    animation: cardHover 0.3s ease;
}

@keyframes cardHover {
    0% { transform: translateY(0); }
    100% { transform: translateY(-2px); }
}

/* Focus visible mejorado */
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}
