/* --- Reseteo y Variables Globales --- */
:root {
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-text-hover: #ffffff;
    --main-bg: #f1f5f9;
    --panel-bg: #ffffff;
    --border-color: #e2e8f0;
    --primary-color: #3b82f6;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --sidebar-width: 260px;
}

/* Tema oscuro (clase .dark en html o body) */
.dark :root, .dark body {
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-text-hover: #ffffff;
    --main-bg: #0f172a;
    --panel-bg: #1e293b;
    --border-color: #334155;
    --primary-color: #3b82f6;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
}
body.dark, .dark body { background-color: var(--main-bg); color: var(--text-primary); }

.skip-link { position:absolute; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: var(--main-bg);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Layout Principal con Sidebar --- */
.app-layout {
    display: flex;
    min-height: 100vh;
    /* Padding general (desktop / >768px): ligero espacio superior */
    padding-top: 12px;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease-in-out;
    /* Permitir scroll si hay más items que alto disponible */
    overflow-y: auto;
}

.main-content {
    flex-grow: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* --- Estilos de la Sidebar --- */
.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #334155;
}
.sidebar-header h2 {
    margin: 0;
    color: white;
    font-size: 1.5rem;
}

.sidebar-nav {
    padding: 1rem;
}
.sidebar-nav h3 {
    padding: 0 0.5rem;
    margin: 1.5rem 0 0.5rem 0;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #94a3b8;
    font-weight: 700;
}
.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar-nav li a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.sidebar-nav li a:hover {
    background-color: #334155;
    color: var(--sidebar-text-hover);
}
.sidebar-nav ul.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* --- Header para Móviles --- */
.mobile-header {
    display: none; /* Oculto por defecto */
    background-color: var(--sidebar-bg);
    color: white;
    padding: 0.75rem 1rem;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}
.hamburger-btn {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
}
.hamburger-btn span {
    display: block;
    width: 24px;
    height: 3px;
    background-color: white;
    margin: 5px 0;
    transition: all 0.3s;
}
.mobile-header-title {
    font-size: 1.2rem;
    font-weight: 500;
    margin-left: 1rem;
    color: #fff;
    text-decoration: none;
}
/* Asegura estado hover/focus consistente */
.mobile-header-title:hover, .mobile-header-title:focus, .mobile-header-title:active {
    color: #fff;
    text-decoration: none;
}

/* --- Overlay para sidebar móvil --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 199;
}

/* --- Estilos del Contenido Principal --- */
.content-header h1 {
    margin: 0 0 2rem 0;
    font-size: 2rem;
}

.caja-busqueda, .panel-detalles, .caja-contenido {
    background-color: var(--panel-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}
#searchInput {
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-sizing: border-box;
    font-weight: 600; /* negrita solicitada */
    color: #1f2937; /* gris muy oscuro (tailwind slate-800 aprox) */
}
#searchInput::placeholder {
    color: #64748b; /* gris secundario para diferenciar del texto ingresado */
    font-weight: 500;
}
.search-results {
    background: white;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: var(--shadow);
}
.search-results div {
    padding: 12px 15px;
    cursor: pointer;
    font-size: 1.06rem; /* ligeramente más grande para mejor legibilidad */
    line-height: 1.25;
}
.search-results div:hover, .search-result-active {
    background-color: var(--primary-color);
    color: white;
}

.panel-detalles {
    margin-top: 2rem;
}
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.panel-header h2 {
    margin: 0;
    font-size: 1.5rem;
}
.clinic-tags {
    display: flex;
    gap: 0.5rem;
}
.tag {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-weight: 500;
    font-size: 0.8rem;
}
.tag-country { background-color: #e0e7ff; color: #4338ca; }
.tag-shipping { background-color: #d1fae5; color: #065f46; }

/* --- Utilidades --- */
.hidden {
    display: none !important;
}
.error {
    color: #ef4444;
    background-color: #fee2e2;
    padding: 1rem;
    border-radius: 6px;
}

/* --- Estilos de Tarjetas de Pago --- */
.payment-card {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: #f8f9fa;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0.5rem 1rem;
}
.payment-header {
    grid-column: 1 / 2;
}
.payment-body {
    grid-column: 1 / 3;
}
.payment-amount-container {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    text-align: right;
}
.payment-logo {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 30px;
    height: 30px;
    opacity: 0.5;
}
.payment-date {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.payment-amount {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-color);
}
.payment-body p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
}
.payment-body p strong {
    color: var(--text-primary);
}

/* --- Media Queries para Responsive --- */
@media (max-width: 768px) {
    body.sidebar-mobile-open {
        overflow: hidden; /* Evita el scroll del body cuando el menú está abierto */
    }

    .app-layout {
        /* Reducimos el espacio superior en pantallas pequeñas para compactar el layout */
        padding-top: 44px; /* antes (desktop): 12px */
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 200;
        transform: translateX(-100%);
    /* Scroll suave en móvil */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    }

    body.sidebar-mobile-open .sidebar {
        transform: translateX(0);
        box-shadow: 0 0 20px rgba(0,0,0,0.2);
    }

    body.sidebar-mobile-open .sidebar-overlay {
        display: block;
    }

    .main-content {
        padding: 1.5rem;
    }

    .content-header h1 {
        font-size: 1.75rem;
    }

    .mobile-header {
        display: flex;
    }

    .sidebar-header {
        display: none; /* Ocultamos el header de la sidebar normal */
    }
}

/* --- Estilos de la Clínica --- */
.panel-clinica-wrapper { display:flex; flex-direction:column; gap:.85rem; }
.panel-clinica-header { margin:0 0 .15rem 0; }
.panel-clinica-header h1 { margin:0 0 .1rem 0; font-size:1.28rem; line-height:1.15; }
.panel-clinica-header .sub { margin:0; font-size:.8rem; color:#666; line-height:1.2; }
.panel-clinica-contenido { font-size:.9rem; line-height:1.4; }

/* Espaciado ultra compacto específico de la página Buscar clínica */
.page-buscar-clinica { padding-top: 0.75rem !important; }
.page-buscar-clinica .panel-clinica-wrapper { gap: .55rem; }
.page-buscar-clinica .panel-clinica-header { margin-bottom: .05rem; }
.page-buscar-clinica .panel-clinica-header h1 { font-size: 1.15rem; }
.page-buscar-clinica .caja-busqueda { margin-top: 0; }
@media (max-width:480px){
    .page-buscar-clinica { padding-top: .55rem !important; }
    .page-buscar-clinica .panel-clinica-wrapper { gap:.45rem; }
    .page-buscar-clinica .panel-clinica-header h1 { font-size:.9rem; }
}

.logo-link,
.mobile-header-title {
  color: #fff;
  text-decoration: none;
}

.logo-link:hover,
.mobile-header-title:hover {
  color: #eaeaea;
}

/* Ajustes dark específicos */
.dark .sidebar { background-color: var(--sidebar-bg); }
.dark .caja-busqueda, .dark .panel-detalles, .dark .caja-contenido { background-color: var(--panel-bg); }
.dark .search-results { background:#1e293b; }
.dark .search-results div:hover, .dark .search-result-active { background-color: #334155; }

/* (Fin del archivo original) */

/* =============================
     Mejora Responsive Inicial (Mobile < 480px)
     Enfoque: reducir espacios, mejor tipografía, evitar overflow de chips y título largo
     ============================= */
@media (max-width: 480px) {
    /* En móviles muy pequeños, compactar aún más el espacio superior */
    .app-layout { padding-top: 1px; }
    :root { /* Ajuste leve de escala */
        --sidebar-width: 220px; /* por si se abre el menú */
    }
    .main-content { padding: 0.9rem 0.85rem; }
    .caja-busqueda, .panel-detalles, .caja-contenido { padding: 1rem 0.9rem; }
    .caja-busqueda { margin-top: .25rem; }
    #searchInput { font-size: .9rem; padding: .65rem .75rem; }
    /*.search-results div { padding: 10px 12px; font-size: .9rem; }*/
    .search-results div { padding: 6px 6px; font-size: .9rem; }
    .panel-clinica-wrapper { gap: .6rem; }
    .panel-clinica-header h1 { font-size: .95rem; }
    .panel-clinica-header .sub { font-size: .68rem; }
    .panel-header { flex-direction: column; align-items: flex-start; gap: .55rem; }
    .panel-header h2 { font-size: 1.05rem; line-height: 1.25; word-break: break-word; margin-bottom: 0; }
    .clinic-tags { flex-wrap: wrap; row-gap: .4rem; }
    .tag { font-size: .65rem; padding: .28rem .55rem; }
    .tag-country, .tag-shipping { font-weight: 600; }
    .payment-card { grid-template-columns: 1fr; grid-template-rows: auto; padding: .75rem .7rem; }
    .payment-amount-container { text-align: left; }
    .payment-amount { font-size: 1rem; }
    .payment-logo { top: .55rem; right: .55rem; width: 26px; height: 26px; }
    .estado-editor { flex-wrap: wrap; gap: .4rem; }
    .dependientes-wrapper .dep-header, .dependientes-wrapper .dep-row { grid-template-columns: 1fr 54px 74px 70px; }
    .dep-action { font-size: .55rem; padding: .3rem .5rem; }
    /* Sticky búsqueda para acceso rápido mientras se desplaza */
    .caja-busqueda { position: sticky; top: .35rem; z-index: 15; box-shadow: 0 2px 6px -2px rgba(0,0,0,.08); }
    /* Mejoras de la cabecera móvil */
    .mobile-header { box-shadow: 0 2px 6px -2px rgba(0,0,0,.4); }
    .hamburger-btn { padding: .65rem; margin: -.4rem 0; }
    .hamburger-btn span { height: 2.5px; }
    /* Unificar estilo de botones pequeños dentro del panel */
    .mini-launcher { font-size: .65rem; }
    /* Ajuste de texto general para densidad */
    body { font-size: 15px; }
}

/* Micro mejora para foco accesible (teclado) en elementos clicables */
.sidebar-nav a:focus, .mini-launcher:focus, button:focus { outline: 2px solid var(--primary-color); outline-offset: 2px; }

