/* =====================================================
   Modern Medical Dashboard - Sistema de Emergencia
   Diseño: Minimalista, Profesional, Confiable
   ===================================================== */

/* Reset y Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

:root {
    /* Paleta Principal - Indigo Professional */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    
    /* Estados de Salud Semánticos */
    --status-stable: #10b981;
    --status-stable-bg: #d1fae5;
    --status-critical: #f43f5e;
    --status-critical-bg: #ffe4e6;
    --status-deceased: #64748b;
    --status-deceased-bg: #f1f5f9;
    --status-unknown: #f59e0b;
    --status-unknown-bg: #fef3c7;
    
    /* Escala de Grises Slate */
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    
    /* Sombras Profesionales */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    
    /* Bordes */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* Transiciones */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--slate-900);
    background: var(--slate-50);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    position: relative;
}

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Header - Medical Emergency Theme */
.header {
    text-align: center;
    padding: 40px 32px;
    background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="40" height="40" xmlns="http://www.w3.org/2000/svg"><circle cx="20" cy="20" r="1.5" fill="white" opacity="0.1"/></svg>');
    pointer-events: none;
}

.header h1 {
    font-size: 32px;
    font-weight: 700;
    color: white;
    margin-bottom: 8px;
    letter-spacing: -0.025em;
    position: relative;
}

.subtitle {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    position: relative;
}

/* Action Cards - Toggle between Search and Register */
.action-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.action-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: white;
    border: 2px solid var(--slate-200);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: left;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    word-break: break-word;
    overflow-wrap: break-word;
}

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

.action-card.active {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: var(--shadow-md);
}

.action-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.action-card h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--slate-900);
    margin-bottom: 4px;
    word-wrap: break-word;
}

.action-card p {
    font-size: 13px;
    color: var(--slate-600);
    margin: 0;
    word-wrap: break-word;
}

.action-card.active h3 {
    color: var(--primary);
}

/* Search Section - Card Style */
.search-section {
    background: white;
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 28px;
    border: 1px solid var(--slate-200);
    transition: box-shadow var(--transition-base);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.search-section:hover {
    box-shadow: var(--shadow-lg);
}

.search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
    width: 100%;
    max-width: 100%;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.input-group label {
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    color: var(--slate-700);
}

.input-group input {
    padding: 12px 16px;
    border: 1.5px solid var(--slate-300);
    border-radius: var(--radius-md);
    font-size: 15px;
    color: var(--slate-900);
    background: var(--slate-50);
    transition: all var(--transition-base);
    font-weight: 500;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.input-group input::placeholder {
    color: var(--slate-400);
    font-weight: 400;
}

.input-group input:hover {
    border-color: var(--slate-400);
    background: white;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px var(--primary-light);
}

.button-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Advanced Filters */
.advanced-filters {
    margin-bottom: 20px;
    margin-top: 16px;
}

.toggle-filters-btn {
    background: var(--slate-100);
    border: 1px solid var(--slate-300);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    color: var(--slate-700);
    cursor: pointer;
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.toggle-filters-btn:hover {
    background: var(--slate-200);
    border-color: var(--slate-400);
}

.toggle-filters-btn #filterIcon {
    transition: transform var(--transition-base);
}

.toggle-filters-btn.active #filterIcon {
    transform: rotate(180deg);
}

.advanced-filters-content {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--slate-200);
    animation: slideDown 0.3s ease-out;
}

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

.select-input,
.date-input {
    padding: 12px 16px;
    border: 1.5px solid var(--slate-300);
    border-radius: var(--radius-md);
    font-size: 15px;
    color: var(--slate-900);
    background: var(--slate-50);
    transition: all var(--transition-base);
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Opciones del select con colores correctos */
.select-input option {
    background-color: white;
    color: var(--slate-900);
    padding: 8px 12px;
    font-weight: 500;
}

.select-input:hover,
.date-input:hover {
    border-color: var(--slate-400);
    background: white;
}

.select-input:focus,
.date-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px var(--primary-light);
}

/* Select deshabilitado */
.select-input:disabled {
    background-color: var(--slate-100);
    color: var(--slate-500);
    cursor: not-allowed;
    opacity: 0.65;
}

/* Buttons - Modern Design */
.btn {
    padding: 11px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
}

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

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--slate-100);
    color: var(--slate-700);
    border: 1.5px solid var(--slate-300);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--slate-200);
    border-color: var(--slate-400);
}

.btn-page {
    background: white;
    border: 1.5px solid var(--slate-300);
    color: var(--slate-700);
    padding: 10px 20px;
    font-weight: 600;
}

.btn-page:hover:not(:disabled) {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateX(0);
}

/* Loading - Modern Spinner */
.loading {
    text-align: center;
    padding: 48px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
    border: 1px solid var(--slate-200);
}

.spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 20px;
    border: 4px solid var(--slate-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

.loading p {
    color: var(--slate-600);
    font-weight: 500;
    font-size: 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error Message - Alert Style */
.error-message {
    background: var(--status-critical-bg);
    border: 1.5px solid var(--status-critical);
    color: #991b1b;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
}

.error-message::before {
    content: '⚠️';
    font-size: 20px;
}

/* Success Message - Mejorado */
.success-message {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 2px solid var(--status-stable);
    color: #065f46;
    padding: 24px 32px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    font-weight: 600;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.2);
    animation: successPulse 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.success-message::before {
    content: '✅';
    font-size: 32px;
    animation: checkmarkBounce 0.6s ease-out;
}

.success-message::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 1.5s ease-in-out;
}

@keyframes successPulse {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes checkmarkBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Results Info - Elegant Badge */
.results-info {
    background: var(--primary-light);
    padding: 14px 24px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--slate-700);
    border: 1px solid var(--slate-200);
    font-weight: 500;
}

/* Register Section */
.register-section {
    background: white;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 28px;
    border: 1px solid var(--slate-200);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.form-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--slate-900);
    margin-bottom: 8px;
    word-wrap: break-word;
}

.form-subtitle {
    font-size: 15px;
    color: var(--slate-600);
    margin-bottom: 28px;
    word-wrap: break-word;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 28px;
    width: 100%;
    max-width: 100%;
}

.full-width {
    grid-column: 1 / -1;
    width: 100%;
    max-width: 100%;
}

.required {
    color: var(--status-critical);
    font-weight: 700;
}

.input-hint {
    font-size: 12px;
    color: var(--slate-500);
    margin-top: 4px;
    display: block;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 15px;
}

/* Table - Modern Medical Design */
.table-container {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid var(--slate-200);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.results-table {
    width: 100%;
    max-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-size: 14px;
}

.results-table thead {
    background: linear-gradient(180deg, var(--slate-100) 0%, var(--slate-50) 100%);
    border-bottom: 2px solid var(--slate-200);
}

.results-table th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 700;
    font-size: 12px;
    color: var(--slate-700);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: var(--slate-100);
}

/* Anchos de columna optimizados */
.results-table th:nth-child(1), /* Nombre */
.results-table td:nth-child(1) {
    width: 15%;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
}

.results-table th:nth-child(2), /* Cédula */
.results-table td:nth-child(2) {
    width: 10%;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
}

.results-table th:nth-child(3), /* Edad */
.results-table td:nth-child(3) {
    width: 5%;
    white-space: nowrap !important;
}

.results-table th:nth-child(4), /* Teléfono */
.results-table td:nth-child(4) {
    width: 10%;
    white-space: nowrap !important;
}

.results-table th:nth-child(5), /* Estado */
.results-table td:nth-child(5) {
    width: 8%;
    white-space: nowrap !important;
}

.results-table th:nth-child(6), /* Municipio */
.results-table td:nth-child(6) {
    width: 9%;
    white-space: nowrap !important;
}

.results-table th:nth-child(7), /* Parroquia */
.results-table td:nth-child(7) {
    width: 9%;
    white-space: nowrap !important;
}

.results-table th:nth-child(8), /* Ubicación Actual */
.results-table td:nth-child(8) {
    width: 18%;
    white-space: normal !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
}

.results-table th:nth-child(9), /* Estado de Salud */
.results-table td:nth-child(9) {
    width: 11%;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
}

.results-table th:nth-child(10), /* Fecha */
.results-table td:nth-child(10) {
    width: 10%;
}

.results-table td {
    padding: 12px 10px; /* Reducido de 20px a 12px vertical y 10px horizontal */
    border-bottom: 1px solid var(--slate-200);
    color: var(--slate-700);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
}

.results-table td:first-child {
    font-weight: 700;
    color: var(--slate-900);
    font-size: 15px;
}

.results-table tbody tr {
    transition: all var(--transition-base);
}

.results-table tbody tr:hover {
    background: var(--slate-50);
    box-shadow: inset 0 0 0 1px var(--slate-200);
}

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

.no-results {
    text-align: center;
    color: var(--slate-500);
    padding: 60px 40px !important;
    font-weight: 500;
    font-size: 15px;
}

/* Estado de Salud - Badges Elegantes */
.estado-estable,
.estado-critico,
.estado-fallecido,
.estado-desconocido {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.estado-estable {
    background: var(--status-stable-bg);
    color: #065f46;
    border: 1px solid var(--status-stable);
}

.estado-estable::before {
    content: '●';
    color: var(--status-stable);
    font-size: 14px;
}

.estado-critico {
    background: var(--status-critical-bg);
    color: #9f1239;
    border: 1px solid var(--status-critical);
}

.estado-critico::before {
    content: '●';
    color: var(--status-critical);
    font-size: 14px;
}

.estado-fallecido {
    background: var(--status-deceased-bg);
    color: #334155;
    border: 1px solid var(--status-deceased);
}

.estado-fallecido::before {
    content: '●';
    color: var(--status-deceased);
    font-size: 14px;
}

.estado-desconocido {
    background: var(--status-unknown-bg);
    color: #92400e;
    border: 1px solid var(--status-unknown);
}

.estado-desconocido::before {
    content: '●';
    color: var(--status-unknown);
    font-size: 14px;
}

/* Pagination - Clean Design */
.pagination {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    margin-top: 28px;
    padding: 20px 32px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--slate-200);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.pagination-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.pagination-options {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--slate-600);
}

.page-size-select {
    width: auto;
    min-width: 72px;
    padding: 8px 12px;
}

.load-more-btn {
    width: 100%;
}

.pagination-mobile .pagination-nav {
    display: none;
}

.na-value {
    color: var(--slate-400);
    font-style: italic;
}

.cell-fecha {
    color: var(--slate-500);
    font-size: 13px;
}

.results-hint {
    margin-top: 8px;
    font-size: 13px;
    color: var(--amber-700, #b45309);
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: var(--radius-md);
    padding: 10px 14px;
}

/* Tarjetas compactas en móvil */
.patient-card {
    display: block;
    margin-bottom: 12px;
    background: white;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.patient-card-cell {
    display: block !important;
    padding: 0 !important;
    border: none !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

.patient-card-header {
    width: 100%;
    max-width: 100%;
    text-align: left;
    background: white;
    border: none;
    padding: 14px 16px;
    cursor: pointer;
    font-family: inherit;
    box-sizing: border-box;
}

.patient-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
    width: 100%;
    max-width: 100%;
}

.patient-card-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--slate-900);
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    flex: 1;
    min-width: 0;
}

.patient-card-summary {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--slate-600);
    margin-bottom: 8px;
    width: 100%;
    max-width: 100%;
}

.summary-item {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.patient-card-toggle {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    flex-shrink: 0;
}

.patient-card-details {
    display: none;
    padding: 0 16px 14px;
    border-top: 1px solid var(--slate-100);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.patient-card.expanded .patient-card-details {
    display: block;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--slate-100);
    font-size: 14px;
    width: 100%;
    max-width: 100%;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row span:first-child {
    font-weight: 700;
    font-size: 11px;
    color: var(--slate-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.detail-row span:last-child {
    text-align: right;
    color: var(--slate-700);
    word-break: break-word;
    overflow-wrap: break-word;
    flex: 1;
    min-width: 0;
}

.page-info {
    font-size: 14px;
    font-weight: 600;
    color: var(--slate-700);
    padding: 8px 16px;
    background: var(--slate-100);
    border-radius: var(--radius-md);
}

/* Footer - Emergency Context */
.footer {
    text-align: center;
    padding: 40px 20px;
    margin-top: 48px;
    color: var(--slate-600);
    font-size: 14px;
    border-top: 1px solid var(--slate-200);
}

.footer p:first-child {
    font-weight: 500;
    margin-bottom: 8px;
}

.footer-note {
    margin-top: 12px;
    font-weight: 700;
    color: var(--status-critical);
    font-size: 15px;
    padding: 12px 24px;
    background: var(--status-critical-bg);
    border-radius: var(--radius-md);
    display: inline-block;
    border: 1px solid var(--status-critical);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 12px;
        width: 100%;
        max-width: 100vw;
    }

    .header {
        padding: 24px 16px;
        border-radius: var(--radius-md);
        margin-left: 0;
        margin-right: 0;
    }

    .header h1 {
        font-size: 22px;
        line-height: 1.3;
    }

    .subtitle {
        font-size: 14px;
    }

    .action-cards {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .action-card {
        padding: 16px;
        gap: 12px;
    }

    .search-section,
    .register-section {
        padding: 16px;
        border-radius: var(--radius-md);
    }

    .search-grid,
    .form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .button-group {
        flex-direction: column;
        gap: 10px;
    }

    .btn {
        width: 100%;
        justify-content: center;
        padding: 12px 16px;
    }

    .table-container {
        overflow-x: visible;
        background: transparent;
        border: none;
        box-shadow: none;
        margin: 0;
        padding: 0;
    }

    .results-table {
        font-size: 14px;
        table-layout: auto;
    }

    .results-table tbody tr.patient-card {
        display: block;
    }

    .results-table thead {
        display: none;
    }

    .results-table tbody tr:not(.patient-card) {
        display: block;
    }

    .results-table .no-results {
        display: block;
        text-align: center;
        padding: 40px 20px !important;
    }

    .pagination {
        padding: 16px;
    }

    .pagination-nav {
        flex-direction: column;
        gap: 12px;
    }

    .pagination-nav .btn-page {
        width: 100%;
    }

    .pagination-options {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .page-size-select {
        flex: 0 0 auto;
        min-width: 80px;
        max-width: 100px;
    }

    .page-info {
        font-size: 13px;
        padding: 6px 12px;
    }

    .results-info {
        padding: 12px;
        font-size: 13px;
        margin-left: 0;
        margin-right: 0;
    }

    .error-message,
    .success-message {
        padding: 14px;
        font-size: 15px;
        margin-left: 0;
        margin-right: 0;
    }

    .footer {
        padding: 24px 12px;
    }

    .footer-note {
        font-size: 13px;
        padding: 10px 14px;
    }

    /* Asegurar que inputs no se desborden */
    input,
    select,
    textarea,
    .select-input,
    .date-input {
        max-width: 100%;
        min-width: 0;
    }

    /* Prevenir desbordamiento en elementos flexbox */
    .action-card > div {
        flex: 1;
        min-width: 0;
    }
}

/* Performance Optimizations */
.results-table tbody {
    will-change: contents;
}

/* Micro-interactions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.results-table tbody tr:not(.patient-card) {
    animation: fadeIn 0.3s ease-out;
}

.results-info,
.error-message {
    animation: slideIn 0.3s ease-out;
}

/* Tablet Responsive (481px - 768px) */
@media (max-width: 768px) and (min-width: 481px) {
    .search-grid,
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .full-width {
        grid-column: 1 / -1;
    }

    .action-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile Small (max 480px) */
@media (max-width: 480px) {
    .container {
        padding: 8px;
    }

    .header {
        padding: 20px 12px;
        margin-bottom: 16px;
    }

    .header h1 {
        font-size: 18px;
    }

    .subtitle {
        font-size: 12px;
    }

    .action-card {
        padding: 12px;
        gap: 10px;
    }

    .action-card h3 {
        font-size: 14px;
    }

    .action-card p {
        font-size: 11px;
    }

    .action-icon {
        font-size: 28px;
    }

    .search-section,
    .register-section {
        padding: 12px;
        margin-bottom: 16px;
    }

    .form-title {
        font-size: 18px;
    }

    .form-subtitle {
        font-size: 13px;
    }

    .input-group label {
        font-size: 11px;
    }

    .input-group input,
    .select-input,
    .date-input {
        font-size: 14px;
        padding: 10px 12px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .patient-card {
        margin-bottom: 10px;
    }

    .patient-card-header {
        padding: 12px;
    }

    .patient-card-name {
        font-size: 14px;
    }

    .patient-card-summary {
        font-size: 11px;
    }

    .detail-row {
        font-size: 12px;
        gap: 8px;
    }

    .pagination {
        padding: 12px;
    }

    .results-info,
    .error-message,
    .success-message {
        padding: 10px;
        font-size: 13px;
    }
}

/* Print Styles */
@media print {
    .search-section,
    .pagination,
    .footer {
        display: none;
    }
    
    .header {
        background: white;
        color: black;
    }
    
    .results-table {
        border: 1px solid black;
    }
}


/* =====================================================
   Google Maps Autocomplete Customization
   ===================================================== */

/* Personalizar el contenedor del autocompletado */
.pac-container {
    background-color: white;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-family: 'Inter', sans-serif;
    margin-top: 4px;
    z-index: 10000;
}

/* Items del autocompletado */
.pac-item {
    padding: 12px 16px;
    border-top: 1px solid var(--slate-100);
    cursor: pointer;
    transition: background-color 0.15s ease;
    font-size: 14px;
    line-height: 1.5;
}

.pac-item:first-child {
    border-top: none;
}

.pac-item:hover {
    background-color: var(--primary-light);
}

.pac-item-selected {
    background-color: var(--primary-light);
}

/* Iconos del autocompletado */
.pac-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    margin-top: 4px;
    background-size: contain;
}

/* Texto del item */
.pac-item-query {
    color: var(--slate-900);
    font-weight: 500;
    font-size: 14px;
}

.pac-matched {
    color: var(--primary);
    font-weight: 600;
}

/* Descripción secundaria */
.pac-item span:not(.pac-item-query) {
    color: var(--slate-500);
    font-size: 13px;
}

/* Logo de Google */
.pac-logo:after {
    padding: 8px;
    opacity: 0.6;
}

/* Indicador de carga del input */
.pac-target-input {
    position: relative;
}

/* Estilo para el input cuando Google Maps está activo */
input.pac-target-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Indicador visual de que el autocompletado está habilitado */
#regUbicacion::placeholder {
    color: var(--slate-400);
    font-style: italic;
}

#regUbicacion:focus::placeholder {
    color: var(--slate-300);
}

/* Animación sutil para cuando se selecciona un lugar */
@keyframes placeSelected {
    0% { background-color: var(--primary-light); }
    100% { background-color: white; }
}

.place-selected {
    animation: placeSelected 0.6s ease;
}

/* Responsive para el autocompletado en móviles */
@media (max-width: 768px) {
    .pac-container {
        width: calc(100vw - 32px) !important;
        left: 16px !important;
        right: 16px !important;
    }
    
    .pac-item {
        padding: 10px 12px;
        font-size: 13px;
    }
}


/* =====================================================
   OpenStreetMap Autocomplete Customization (GRATIS)
   ===================================================== */

/* Contenedor de sugerencias */
.osm-suggestions-container {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: white;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    margin-top: 4px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 10000;
    font-family: 'Inter', sans-serif;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Items de sugerencia */
.osm-suggestion-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 16px;
    border-bottom: 1px solid var(--slate-100);
    cursor: pointer;
    transition: all 0.15s ease;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.osm-suggestion-item:last-child {
    border-bottom: none;
}

.osm-suggestion-item:hover,
.osm-suggestion-hover {
    background-color: var(--primary-light);
    border-left: 3px solid var(--primary);
    padding-left: 13px;
}

/* Icono de la sugerencia */
.osm-suggestion-icon {
    font-size: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Contenido de la sugerencia */
.osm-suggestion-content {
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

.osm-suggestion-name {
    color: var(--slate-900);
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 4px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.osm-suggestion-address {
    color: var(--slate-500);
    font-size: 12px;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Estados de carga, error y sin resultados */
.osm-loading,
.osm-error,
.osm-no-results {
    padding: 16px;
    text-align: center;
    color: var(--slate-600);
    font-size: 14px;
}

.osm-error {
    color: var(--status-critical);
    background-color: var(--status-critical-bg);
}

.osm-no-results {
    color: var(--slate-500);
}

/* Animación para selección de lugar */
@keyframes placeSelected {
    0% { 
        background-color: var(--primary-light);
        transform: scale(1.02);
    }
    100% { 
        background-color: white;
        transform: scale(1);
    }
}

.place-selected {
    animation: placeSelected 0.6s ease;
}

/* Indicador visual en el input */
#regUbicacion::placeholder {
    color: var(--slate-400);
    transition: color 0.2s ease;
}

#regUbicacion:focus::placeholder {
    color: var(--slate-300);
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .osm-suggestions-container {
        position: fixed;
        left: 8px;
        right: 8px;
        max-height: 50vh;
        width: calc(100% - 16px);
    }
    
    .osm-suggestion-item {
        padding: 12px;
    }
    
    .osm-suggestion-icon {
        font-size: 20px;
    }
    
    .osm-suggestion-name {
        font-size: 13px;
    }
    
    .osm-suggestion-address {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .osm-suggestions-container {
        left: 4px;
        right: 4px;
        width: calc(100% - 8px);
        max-height: 40vh;
    }

    .osm-suggestion-item {
        padding: 10px;
        gap: 10px;
    }
}

/* Scrollbar personalizada para el contenedor de sugerencias */
.osm-suggestions-container::-webkit-scrollbar {
    width: 8px;
}

.osm-suggestions-container::-webkit-scrollbar-track {
    background: var(--slate-100);
}

.osm-suggestions-container::-webkit-scrollbar-thumb {
    background: var(--slate-300);
    border-radius: 4px;
}

.osm-suggestions-container::-webkit-scrollbar-thumb:hover {
    background: var(--slate-400);
}
