/* =========================================
   1. VARIABLES Y RESET
   ========================================= */
:root {
    --primary: #008ba3;        /* Azul Petróleo (Identidade IOOB) */
    --primary-dark: #006070;   /* Azul mais escuro para hover */
    --secondary: #ff6f61;      /* Coral (Acolhimento/Urgência) */
    --text-dark: #2c3e50;      /* Cinza escuro para texto */
    --text-light: #ecf0f1;     /* Texto claro */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --success: #27ae60;
    --danger: #c0392b;
    --warning: #f1c40f;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

/* CORRECCIÓN RESPONSIVE: Evitar scroll horizontal fantasma */
html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden; 
    position: relative;
}

body {
    background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 100%);
    color: var(--text-dark);
    min-height: 100vh;
    padding-top: 80px; /* Espacio para el Navbar fijo */
}

/* =========================================
   2. FONDO ANIMADO (BLOBS)
   ========================================= */
.blob-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; 
    z-index: -1;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.6;
}

.blob-1 {
    top: 10%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: rgba(0, 139, 163, 0.3);
    animation: float 10s infinite alternate;
}

.blob-2 {
    bottom: 10%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: rgba(255, 111, 97, 0.25);
    animation: float 8s infinite alternate-reverse;
}

@keyframes float {
    0% { transform: translate(0, 0); }
    100% { transform: translate(30px, 50px); }
}

/* =========================================
   3. NAVBAR MODERN (DESKTOP BASE)
   ========================================= */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    z-index: 1000;
    padding: 0 1.5rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255,255,255,0.5);
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    display: flex;
    align-items: center; 
}

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

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-menu {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-link {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 1rem;
    position: relative;
    padding: 5px 0;
    transition: color 0.3s;
    cursor: pointer;
    /* Flexbox para alinear iconos si se usan */
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.nav-link.active::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 3px;
    background: var(--secondary);
    bottom: -2px;
    left: 0;
    border-radius: 2px;
}

/* Menu Hamburguer */
.menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    z-index: 1001; 
}

.bar {
    width: 25px;
    height: 3px;
    background-color: var(--text-dark);
    margin: 3px 0;
    transition: 0.4s;
    border-radius: 3px;
}

/* =========================================
   4. LAYOUT GERAL & GLASSMORPHISM
   ========================================= */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
}

header {
    text-align: center;
    padding: 2rem 0;
    animation: fadeIn 0.8s ease;
}

h1 {
    color: var(--primary);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.subtitle {
    color: #546e7a;
    font-size: 1.1rem;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    transition: transform 0.3s;
}

.section-title {
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
    padding-left: 15px;
    border-left: 5px solid var(--secondary);
    font-weight: 600;
    font-size: 1.3rem;
}

/* =========================================
   5. VISTA INICIO
   ========================================= */
.select-container {
    text-align: center;
}

.select-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--primary-dark);
}

.custom-select-wrapper {
    position: relative;
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
}

select {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--primary);
    border-radius: 12px;
    background: rgba(255,255,255,0.9);
    outline: none;
    cursor: pointer;
    font-size: 1rem;
    appearance: none; 
}

.select-arrow {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--primary);
}

/* Cartão do Consultório */
.result-card {
    background: rgba(255, 255, 255, 0.85);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
    animation: slideUp 0.5s ease;
    margin-bottom: 3rem;
}

.card-header-main {
    background: rgba(0, 139, 163, 0.1);
    padding: 1.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.card-title-main {
    font-size: 1.4rem;
    color: var(--primary-dark);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.current-badge {
    background: var(--secondary);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 111, 97, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(255, 111, 97, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 111, 97, 0); }
}

.card-body { padding: 1.5rem; }

/* Acordeón de Consultorios */
.turno-item {
    background: white;
    margin-bottom: 10px;
    border-radius: 12px;
    border: 1px solid #eee;
    overflow: hidden;
    transition: all 0.3s ease;
}

.turno-item:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.turno-header {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: #fff;
}

.turno-time {
    font-weight: 700;
    color: var(--secondary);
    display: block;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.turno-specialty {
    font-size: 1rem;
    color: var(--text-dark);
}

.arrow-icon {
    color: var(--primary);
    transition: transform 0.3s ease;
}

.turno-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    background: #f8fdfe;
    border-top: 1px dashed #eee;
}

.team-list {
    list-style: none;
    padding: 15px;
}

.team-list li {
    margin-bottom: 5px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.badge-role {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    color: white;
    font-weight: bold;
    min-width: 30px;
    text-align: center;
    margin-right: 8px;
}
.bg-dr { background: var(--primary); }
.bg-res { background: #78909c; }
.bg-tec { background: #f39c12; }

/* =========================================
   6. VISTA FARMÁCIA
   ========================================= */
.farmacia-layout {
    display: grid;
    grid-template-columns: 2fr 1fr; 
    gap: 20px;
    align-items: start;
    width: 100%;
}

.search-box {
    position: relative;
    margin-bottom: 15px;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
}

.search-input {
    padding-left: 40px !important;
}

/* Wrapper de tabla con scroll controlado */
.table-wrapper-scroll {
    width: 100%;
    overflow-x: auto;      
    overflow-y: hidden;    
    max-height: 60vh;      
    border-radius: 10px;
    border: 1px solid #eee;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.table-wrapper-scroll::-webkit-scrollbar {
    display: none;
}

.table-farmacia {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px; /* Fuerza el ancho para activar el scroll en móviles */
}

.table-farmacia th {
    text-align: left;
    padding: 15px;
    background: #e0f7fa; 
    color: var(--primary-dark);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-farmacia td {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    font-size: 0.9rem;
    vertical-align: middle;
}

.stock-low { color: var(--danger); font-weight: bold; }
.stock-ok { color: var(--success); font-weight: bold; }

.btn-add {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-add:hover { background: var(--primary-dark); transform: scale(1.05); }
.btn-add:disabled { background: #ccc; cursor: not-allowed; transform: none; }

/* Carrinho Sidebar */
.carrito-panel {
    background: white;
    display: flex;
    flex-direction: column;
    max-height: 600px;
    position: sticky;
    top: 100px; 
    z-index: 900;
}

.info-paciente-box {
    background: rgba(39, 174, 96, 0.1);
    border: 1px solid var(--success);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
    color: var(--primary-dark);
}

.carrito-items {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px;
    min-height: 100px;
    max-height: 300px;
}

.empty-msg {
    text-align: center;
    color: #95a5a6;
    font-size: 0.9rem;
    margin-top: 20px;
    font-style: italic;
}

.cart-item {
    background: #f9f9f9;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 8px;
    border-left: 3px solid var(--secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    animation: slideIn 0.3s ease;
}

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

.btn-remove {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: 0.2s;
}

.btn-remove:hover {
    background: var(--danger);
    color: white;
}

.carrito-footer {
    border-top: 2px dashed #eee;
    padding-top: 15px;
}

.total-info {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: var(--text-dark);
}

.btn-confirmar {
    background: var(--secondary);
    width: 100%;
    padding: 12px;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}
.btn-confirmar:hover { background: #e64a19; }

.mobile-cart-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 10px;
}
.mobile-cart-header h3 { color: var(--primary); margin: 0; }
.btn-close-cart { background: none; border: none; font-size: 1.5rem; color: var(--danger); cursor: pointer; }

/* =========================================
   7. FORMULÁRIO E FOOTER
   ========================================= */
.form-group { margin-bottom: 15px; width: 100%; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; width: 100%; }

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    background: rgba(255,255,255,0.8);
    box-sizing: border-box; 
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 139, 163, 0.1);
}

.btn-submit {
    width: 100%;
    padding: 15px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}
.btn-submit:hover { background: var(--primary-dark); }

footer {
    background: white;
    margin-top: auto;
    width: 100%;
}

.map-container {
    height: 300px;
    width: 100%;
    filter: grayscale(10%);
    transition: filter 0.3s;
}
.map-container:hover { filter: grayscale(0%); }

.footer-info {
    text-align: center;
    padding: 2rem;
    background: var(--primary-dark);
    color: white;
}

/* =========================================
   8. MODAL Y FLOATING BUTTON
   ========================================= */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: none; 
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: white;
    max-width: 500px;
    width: 100%;
    border: 2px solid var(--secondary);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    color: var(--secondary);
}
.warning-icon { font-size: 2rem; }

.modal-desc {
    margin-bottom: 25px;
    color: #555;
    line-height: 1.5;
}

.fab-cart {
    display: none; 
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--secondary);
    color: white;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(255, 111, 97, 0.6);
    z-index: 1500;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.3s;
}
.fab-cart:hover { transform: scale(1.1); }
.fab-cart:active { transform: scale(0.9); }

.fab-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: white;
    color: var(--secondary);
    font-size: 0.8rem;
    font-weight: bold;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid var(--secondary);
}

.cart-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1550; 
}

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

/* =========================================
   9. SECCIÓN DE DONACIONES
   ========================================= */
.donation-banner {
    margin-top: 30px;
    border: 2px solid var(--secondary);
    animation: pulseBorder 3s infinite;
    position: relative;
    overflow: hidden;
}

@keyframes pulseBorder {
    0% { box-shadow: 0 0 0 0 rgba(255, 111, 97, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(255, 111, 97, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 111, 97, 0); }
}

.donation-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding-bottom: 15px;
}

.icon-pulse {
    background: rgba(255, 111, 97, 0.15);
    color: var(--secondary);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
}

.donation-title h2 {
    color: var(--secondary);
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.donation-title p {
    font-size: 0.95rem;
    color: #666;
}

.donation-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.donation-col h4 {
    color: var(--primary-dark);
    margin-bottom: 15px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.med-list-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    list-style: none;
}

.med-list-grid li {
    font-size: 0.9rem;
    background: rgba(255,255,255,0.6);
    padding: 5px 10px;
    border-radius: 5px;
    border-left: 3px solid var(--primary);
}

.check-list {
    list-style: none;
    background: rgba(255, 255, 255, 0.5);
    padding: 15px;
    border-radius: 10px;
    border: 1px dashed var(--secondary);
}

.check-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.check-list li:last-child { margin-bottom: 0; }

.check-list i {
    color: var(--success);
    font-size: 1.1rem;
    margin-top: 2px;
}

/* =========================================
   10. VISTA HISTORIAS CLÍNICAS
   ========================================= */

/* Estilos de Consulta y Mockups */
.search-hc-section {
    max-width: 800px;
    margin: 0 auto 3rem auto;
}

.hc-result-container {
    margin-top: 30px;
    animation: fadeIn 0.5s ease;
}

.hc-status-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    border-radius: 12px;
    border-left: 5px solid;
    background: rgba(255,255,255,0.8);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.status-icon {
    font-size: 2.5rem;
    min-width: 60px;
    text-align: center;
}

.status-info h3 { margin-bottom: 5px; font-size: 1.1rem; }
.status-info p { margin-bottom: 5px; font-size: 0.95rem; color: #555; }

/* Variantes de Estado */
.status-error {
    border-color: var(--danger);
    background: rgba(192, 57, 43, 0.1);
}
.status-error .status-icon { color: var(--danger); }
.status-error h3 { color: var(--danger); }

.status-success {
    border-color: var(--success);
    background: rgba(39, 174, 96, 0.1);
}
.status-success .status-icon { color: var(--success); }
.status-success h3 { color: var(--success); }

.status-warning {
    border-color: var(--warning);
    background: rgba(241, 196, 15, 0.1);
}
.status-warning .status-icon { color: var(--warning); }
.status-warning h3 { color: #d35400; }

.time-estimate {
    background: white;
    padding: 5px 10px;
    border-radius: 20px;
    display: inline-block;
    font-size: 0.85rem;
    color: #d35400;
    border: 1px dashed #d35400;
}

/* Solicitudes y Tabs */
.requests-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 3rem;
}

.request-card {
    padding: 0; /* Override padding del panel */
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.request-header {
    background: var(--primary);
    padding: 20px;
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
}

.request-icon { font-size: 1.8rem; }
.request-header h3 { font-size: 1.1rem; margin: 0; color: white; }

/* Tabs Navegación */
.tabs-nav {
    display: flex;
    background: rgba(0,0,0,0.05);
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 12px;
    cursor: pointer;
    font-weight: 600;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: 0.3s;
}

.tab-btn:hover { background: rgba(0,0,0,0.05); }
.tab-btn.active {
    color: var(--secondary);
    border-bottom-color: var(--secondary);
    background: white;
}

.tab-content {
    padding: 20px;
    display: none;
    animation: fadeIn 0.3s ease;
    flex: 1;
}
.tab-content.active { display: block; }

.reason-list {
    list-style: none;
    padding-left: 0;
}
.reason-list li {
    margin-bottom: 8px;
    position: relative;
    padding-left: 20px;
    font-size: 0.9rem;
}
.reason-list li::before {
    content: '•';
    color: var(--secondary);
    font-weight: bold;
    position: absolute;
    left: 0;
}

.price-box {
    text-align: center;
    padding: 10px;
}
.price-tag {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 5px;
}
.btn-qr {
    margin-top: 15px;
    background: var(--text-dark);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    transition: 0.3s;
}
.btn-qr:hover { background: black; }

/* Acordeón de Requisitos */
.req-item {
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    overflow: hidden;
}
.req-header {
    padding: 15px;
    background: #f8f9fa;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: var(--primary-dark);
}
.req-body {
    display: none;
    padding: 15px;
    border-top: 1px solid #eee;
}
.req-body.active { display: block; }


/* =========================================
   11. MEDIA QUERIES (ARREGLOS MÓVIL)
   ========================================= */
@media (max-width: 768px) {
    /* ------------------------------------
       A. NAVBAR ACORDEÓN (FULL SCREEN)
       ------------------------------------ */
    .menu-toggle { display: flex; z-index: 1001; }
    
    .menu-toggle.active .bar:nth-child(2) { opacity: 0; }
    .menu-toggle.active .bar:nth-child(1) { transform: translateY(9px) rotate(45deg); }
    .menu-toggle.active .bar:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

    .nav-menu {
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        height: calc(100vh - 70px); /* Ocupa toda la altura bajo el header */
        background: #fff;
        flex-direction: column;
        align-items: stretch; /* Estirar botones al 100% de ancho */
        padding: 0;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
        z-index: 999;
        overflow-y: auto;
        box-shadow: 0 10px 10px rgba(0,0,0,0.1);
        gap: 0; /* Sin espacio entre botones */
    }

    .nav-menu.active { 
        transform: translateX(0); 
    }

    /* Estilo de botones del menú tipo acordeón */
    .nav-menu li {
        width: 100%;
        border-bottom: 1px solid #eee;
    }

    .nav-link {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        padding: 20px 25px;
        font-size: 1.2rem;
        font-weight: 600;
        color: var(--text-dark);
        background: #f9f9f9;
        transition: all 0.3s ease;
    }

    /* Icono izquierdo */
    .nav-link i:first-child {
        margin-right: 15px;
        font-size: 1.3rem;
        color: var(--primary);
        width: 25px;
        text-align: center;
    }

    /* Flecha derecha (acordeón) */
    .nav-link .accordion-arrow {
        font-size: 1rem;
        color: #aaa;
        transition: transform 0.3s ease;
        display: block !important; /* Asegurar que se vea en móvil */
    }

    /* Estados Activo/Hover */
    .nav-link:hover, .nav-link.active {
        background: var(--primary);
        color: white;
    }
    
    .nav-link:hover i:first-child, .nav-link.active i:first-child,
    .nav-link:hover .accordion-arrow, .nav-link.active .accordion-arrow {
        color: white;
    }

    .nav-link.active::after { display: none; } /* Quitar linea de desktop */
    
    .nav-link.active .accordion-arrow {
        transform: rotate(180deg);
    }


    /* ------------------------------------
       B. AJUSTES GENERALES MÓVIL
       ------------------------------------ */
    .container { padding: 0 1rem; } 
    h1 { font-size: 1.6rem; }
    .form-row { grid-template-columns: 1fr; }

    /* Reducción de Padding (Glassmorphism) */
    .glass-panel { padding: 1.25rem; }
    
    /* ------------------------------------
       C. FARMACIA & DONACIONES MÓVIL
       ------------------------------------ */
    .farmacia-layout {
        display: flex;
        flex-direction: column;
        width: 100%;
        margin-bottom: 100px;
    }

    .stock-container {
        width: 100%;
        overflow: hidden; 
    }

    .table-wrapper-scroll {
        width: 100%;
        max-width: 100%;
        display: block;
        overflow-x: auto;
    }

    .donation-header { flex-direction: column; text-align: center; }
    .donation-grid { grid-template-columns: 1fr; gap: 20px; }
    .med-list-grid { grid-template-columns: 1fr; }

    /* ------------------------------------
       D. HISTORIAS CLÍNICAS MÓVIL
       ------------------------------------ */
    .requests-grid { grid-template-columns: 1fr; }
    .hc-status-card { flex-direction: column; text-align: center; }

    /* ------------------------------------
       E. CARRITO OFF-CANVAS
       ------------------------------------ */
    .carrito-container {
        position: fixed;
        top: 0;
        right: 0;
        transform: translateX(100%);
        width: 85%;
        height: 100vh;
        z-index: 1600;
        max-height: none;
        margin: 0;
        border-radius: 0;
        transition: transform 0.3s cubic-bezier(0.77, 0, 0.175, 1);
        box-shadow: -10px 0 30px rgba(0,0,0,0.3);
        background: #fff;
    }
    
    .carrito-container.active { transform: translateX(0); }
    .mobile-cart-header { display: flex; }
    .desktop-title { display: none; }
    .carrito-container.active + .cart-overlay { display: block; }
    .cart-overlay { display: none; }
    .fab-cart { display: flex; }
}