/* CSS Variables para el Tema Claro Clínico Premium */
:root {
    --primary-color: #008080; /* Teal/Turquesa Clínico */
    --primary-hover: #006666;
    --secondary-color: #4A90E2; /* Azul profesional */
    --accent-color: #F5A623;
    
    --bg-color: #F8FAFC; /* Blanco azulado, súper limpio */
    --surface-color: #FFFFFF;
    --text-color: #334155;
    --text-muted: #64748B;
    
    --border-color: #E2E8F0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -2px rgba(0,0,0,0.03);
    
    --radius-md: 6px;
    --radius-lg: 12px;
    
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --transition: all 0.3s ease;
}

html {
    font-size: 14px; /* Reduce todo el tamaño base de la UI */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* Tipografía */
h1, h2, h3, h4 {
    color: #1E293B;
    font-weight: 600;
}

/* Formularios Premium */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.85rem;
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--text-color);
    background-color: var(--surface-color);
    background-clip: padding-box;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    color: var(--text-color);
    background-color: var(--surface-color);
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 128, 128, 0.15);
}

/* Botones */
.btn {
    display: inline-block;
    font-weight: 500;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    background-color: transparent;
    border: 1px solid transparent;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    line-height: 1.4;
    border-radius: var(--radius-md);
    transition: var(--transition);
    cursor: pointer;
}

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

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

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Cards Premium Glassmorphism suave */
.card {
    background-color: var(--surface-color);
    background-clip: border-box;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    animation: fadeIn 0.4s ease-out forwards;
}

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

/* Layout Login */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: radial-gradient(circle at top right, #e0f2f1 0%, var(--bg-color) 40%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 3rem 2rem;
    text-align: center;
}

.login-logo {
    max-width: 100px;
    margin-bottom: 1.5rem;
}

.login-title {
    margin-bottom: 2rem;
    font-size: 1.5rem;
}

.alert {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}
.alert-error {
    background-color: #FEF2F2;
    color: #B91C1C;
    border: 1px solid #FCA5A5;
}

/* Safe area padding for notch devices (iPhone / modern Android) */
body {
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* =========================================
   PWA & Fullscreen Styles
   ========================================= */

:fullscreen {
    background-color: var(--bg-color);
}
:-webkit-full-screen {
    background-color: var(--bg-color);
}

.pwa-install-banner {
    display: none;
    position: fixed;
    bottom: 1.25rem;
    left: 1rem;
    right: 1rem;
    max-width: 480px;
    margin: 0 auto;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white;
    padding: 0.9rem 1.1rem;
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.35);
    z-index: 1050;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border: 1px solid rgba(255,255,255,0.12);
    animation: pwaSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.btn-install-pwa {
    display: none;
    align-items: center;
    gap: 0.4rem;
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
    color: white !important;
    border: none;
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(13, 148, 136, 0.35);
    transition: all 0.2s;
    text-decoration: none;
}
.btn-install-pwa:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(13, 148, 136, 0.45);
}

/* Tablas Universales Responsivas */
.table-responsive, table {
    max-width: 100%;
}
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.5rem;
    border-radius: var(--radius-md);
}

/* =========================================
   Responsive Design (Tablet: max-width 1024px)
   ========================================= */

.sidebar-overlay {
    display: none !important;
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 998;
    transition: opacity 0.3s ease;
}

.mobile-header {
    display: none !important;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 900;
}

@media (max-width: 1024px) {
    /* Layout global colapsado para tablets y celulares */
    .dashboard-layout, .layout {
        display: block !important;
    }
    
    .sidebar {
        position: fixed !important;
        left: -320px;
        top: 0;
        height: 100vh;
        height: 100dvh;
        width: 280px !important;
        z-index: 1000;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 25px rgba(0,0,0,0.18);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background: var(--surface-color);
    }
    
    .sidebar.open {
        left: 0 !important;
    }
    
    .sidebar-overlay.open {
        display: block !important;
    }
    
    .mobile-header {
        display: flex !important;
    }
    
    .main-content {
        padding: 1.25rem !important;
        max-width: 100vw;
        overflow-x: hidden;
    }

    /* Grids en Tablets (2 columnas) */
    .metrics-grid, .grid-cards {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
    }

    /* Tablas con scroll táctil */
    table {
        min-width: 650px;
    }
}

/* =========================================
   Responsive Design (Celulares: max-width 768px)
   ========================================= */

@media (max-width: 768px) {
    html {
        font-size: 13.5px;
    }

    .main-content {
        padding: 0.75rem !important;
    }

    /* Cabeceras de página */
    .header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }
    
    .header h2 {
        font-size: 1.3rem;
    }
    
    /* Formularios y cuadrículas colapsados a 1 sola columna en móvil */
    .form-grid, .form-container, .card-section {
        grid-template-columns: 1fr !important;
        max-width: 100% !important;
    }
    
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns: 2fr 1fr"],
    [style*="grid-template-columns: 1fr 2fr"],
    [style*="grid-template-columns: repeat(4"],
    [style*="grid-template-columns: repeat(3"] {
        grid-template-columns: 1fr !important;
    }

    .full-width {
        grid-column: span 1 !important;
    }
    
    /* Métricas en 1 columna */
    .metrics-grid, .grid-cards {
        grid-template-columns: 1fr !important;
    }
    
    /* Modales en móviles */
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        max-height: 88vh;
        overflow-y: auto;
        padding: 1.25rem !important;
        margin: 0 auto;
    }
    
    /* Controles de formulario optimizados para dedos (Touch targets) */
    .form-control, select, input, button {
        min-height: 42px;
    }
    
    /* Previene auto-zoom molesto en Safari iOS al tocar campos */
    input[type="text"], input[type="date"], input[type="time"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
        font-size: 16px !important;
    }

    /* Pestañas clínicas en móvil con scroll horizontal táctil */
    .clinical-tabs {
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 4px !important;
    }
    .clinical-tab-btn {
        white-space: nowrap !important;
        padding: 0.6rem 0.9rem !important;
        font-size: 0.85rem !important;
    }

    /* Layout clínico a 1 columna en móvil y tablet */
    .layout-clinico {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }

    /* Contenedor de Odontograma con desplazamiento táctil */
    .odontograma-container, .odontograma-visual, svg.odontograma-svg {
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Formulario de Presupuestos (filas de ítems) */
    .row-item {
        grid-template-columns: 1fr !important;
        gap: 0.5rem !important;
    }

    /* Botones de acción en móvil */
    .btn-group, .actions-bar {
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }
}

/* Reglas específicas para Tablets (769px a 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .layout-clinico {
        grid-template-columns: 1fr !important;
    }
    .clinical-tabs {
        overflow-x: auto !important;
        white-space: nowrap !important;
    }
}

/* ========================================================
   BARRA DE TASAS DE CAMBIO UNIVERSAL (BCV & BINANCE)
   ======================================================== */
.desktop-rates-bar {
    display: none; /* Se activa dinámicamente con JS en .main-content */
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.65rem 1.15rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 6px -1px rgba(0, 128, 128, 0.06), 0 1px 3px rgba(0,0,0,0.03);
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    animation: fadeIn 0.3s ease-out;
}

.rates-bar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.rates-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-right: 0.75rem;
    border-right: 1px solid #e2e8f0;
}

.rates-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.rates-title-text {
    font-weight: 700;
    font-size: 0.85rem;
    color: #1e293b;
    display: block;
    line-height: 1.2;
}

.rates-status-dot {
    font-size: 0.68rem;
    font-weight: 700;
    color: #059669;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.rate-card-item {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.4rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 140px;
    user-select: none;
}

.rate-card-item:hover {
    border-color: #94a3b8;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.04);
}

.rate-card-item.is-active-source {
    background: linear-gradient(135deg, #f0fdfa 0%, #e6fffa 100%);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 128, 128, 0.15);
}

.rate-card-header {
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
}

.rate-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: #334155;
}

.rate-source-tag {
    font-size: 0.65rem;
    color: #64748b;
    background: rgba(0,0,0,0.04);
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: auto;
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rate-card-val {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.2px;
}

.rates-bar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-left: auto;
}

.rate-selector-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.selector-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Switch Segmentado Moderno */
.rate-switch-control {
    display: inline-flex;
    background: #e2e8f0;
    border-radius: 20px;
    padding: 3px;
    gap: 2px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.08);
}

.rate-switch-option {
    border: none;
    background: transparent;
    padding: 0.35rem 0.85rem;
    border-radius: 18px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    user-select: none;
}

.rate-switch-option:hover:not(.active) {
    color: #0f172a;
}

.rate-switch-option.active {
    background: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 128, 128, 0.35);
}

.active-badge-pill {
    background: #f0fdfa;
    border: 1px solid #99f6e4;
    color: #0f766e;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
    animation: pulseGlow 1.8s infinite;
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

.btn-refresh-rates {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 0.38rem 0.75rem;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.btn-refresh-rates:hover {
    background: #f8fafc;
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.btn-refresh-rates.spinning .refresh-icon,
.btn-refresh-rates-mini.spinning {
    display: inline-block;
    animation: spin 0.8s linear infinite;
}

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

/* ========================================================
   ESTILOS DE TASAS EN MÓVIL Y SIDEBAR
   ======================================================== */
.mobile-rates-bar {
    display: flex;
    gap: 4px;
    align-items: center;
    width: 100%;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed #e2e8f0;
    overflow-x: auto;
    scrollbar-width: none;
}

.mobile-rates-bar::-webkit-scrollbar {
    display: none;
}

.mobile-rate-chip {
    flex: 1 0 auto;
    text-align: center;
    padding: 4px 7px;
    border-radius: 8px;
    font-size: 0.72rem;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    white-space: nowrap;
}

.mobile-rate-chip.active {
    background: #f0fdfa;
    border-color: var(--primary-color);
    color: #0f766e;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(0, 128, 128, 0.15);
}

.btn-refresh-rates-mini {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-rates-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.sidebar-rates-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.sidebar-rates-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: #0f766e;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.sidebar-rate-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.15s;
    margin-bottom: 2px;
}

.sidebar-rate-row:hover {
    background: #f1f5f9;
}

.sidebar-rate-row.active {
    background: #f0fdfa;
    color: #0f766e;
    font-weight: 700;
    border-left: 3px solid var(--primary-color);
}

/* Toast flotante de tasas */
.exchange-rate-toast {
    display: none;
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    background: #0f172a;
    color: #ffffff;
    border-left: 4px solid #10b981;
    padding: 0.75rem 1.1rem;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 9999;
    align-items: center;
    gap: 8px;
    animation: toastSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.exchange-rate-toast.error {
    border-left-color: #ef4444;
}

@keyframes toastSlide {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 1024px) {
    .desktop-rates-bar {
        display: none !important; /* En móvil/tablet se usa el mobile-header y sidebar */
    }
}

/* ========================================================
   MODAL DE ESPERA GLOBAL Y ANTI DOBLE CLIC (PROCESANDO...)
   ======================================================== */

body.app-loader-active {
    overflow: hidden !important;
}

.app-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
}

.app-loader-overlay.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.app-loader-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.68);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.app-loader-card {
    position: relative;
    z-index: 2;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 24px;
    padding: 2.25rem 2rem 2rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.4) inset;
    transform: scale(0.92) translateY(15px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: loaderCardPop 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.app-loader-overlay.is-active .app-loader-card {
    transform: scale(1) translateY(0);
}

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

.app-loader-icon-container {
    position: relative;
    width: 76px;
    height: 76px;
    margin: 0 auto 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-loader-spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3.5px solid #e2e8f0;
    border-top-color: #008080;
    border-right-color: #0284c7;
    animation: appLoaderSpin 0.9s cubic-bezier(0.55, 0.15, 0.45, 0.85) infinite;
}

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

.app-loader-spinner-inner {
    width: 54px;
    height: 54px;
    background: linear-gradient(135deg, #f0fdfa 0%, #e0f2fe 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 128, 128, 0.15);
    animation: appLoaderPulse 1.8s ease-in-out infinite;
}

.app-loader-tooth {
    font-size: 1.6rem;
    line-height: 1;
    display: inline-block;
}

@keyframes appLoaderPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.app-loader-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.45rem;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.app-loader-subtitle {
    font-size: 0.88rem;
    color: #64748b;
    line-height: 1.45;
    margin-bottom: 1.4rem;
}

.app-loader-progress-track {
    width: 100%;
    height: 6px;
    background: #f1f5f9;
    border-radius: 99px;
    overflow: hidden;
    position: relative;
}

.app-loader-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 45%;
    background: linear-gradient(90deg, #008080, #0284c7, #10b981);
    border-radius: 99px;
    animation: appLoaderBarIndeterminate 1.5s infinite ease-in-out;
}

@keyframes appLoaderBarIndeterminate {
    0% {
        left: -45%;
        width: 45%;
    }
    50% {
        left: 30%;
        width: 60%;
    }
    100% {
        left: 100%;
        width: 45%;
    }
}

/* ========================================================
   ESTILOS DE BOTONES EN ESTADO PROCESANDO
   ======================================================== */

.btn-is-processing,
button[disabled].btn-is-processing,
a.btn-is-processing {
    opacity: 0.82 !important;
    cursor: wait !important;
    pointer-events: none !important;
    user-select: none !important;
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.55rem !important;
    transform: none !important;
    box-shadow: none !important;
}

.btn-spinner-icon {
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    display: inline-block;
    vertical-align: middle;
    animation: btnSpin 0.7s linear infinite;
    flex-shrink: 0;
}

/* Para botones con fondo claro */
.btn-secondary.btn-is-processing .btn-spinner-icon,
.btn-outline.btn-is-processing .btn-spinner-icon,
.btn-secondary-outline.btn-is-processing .btn-spinner-icon {
    border-color: rgba(15, 23, 42, 0.2);
    border-top-color: #0f172a;
}

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

/* ==========================================================================
   COMPONENTE GLOBAL: BUSCADOR DE PACIENTES POR TECLADO (AUTOCOMPLETADO)
   ========================================================================== */
.paciente-search-wrapper {
    position: relative !important;
    width: 100%;
    flex: 1;
    min-width: 0;
    z-index: 100 !important;
}
.filter-card {
    position: relative !important;
    z-index: 50 !important;
}
.paciente-dropdown-menu {
    position: absolute !important;
    top: calc(100% + 4px) !important;
    left: 0 !important;
    right: 0 !important;
    max-height: 260px !important;
    overflow-y: auto !important;
    background: #ffffff !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.18), 0 8px 10px -6px rgba(0, 0, 0, 0.12) !important;
    z-index: 99999 !important;
    display: none;
}
.paciente-dropdown-item {
    padding: 0.6rem 0.85rem;
    font-size: 0.86rem;
    color: #1e293b;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: background 0.15s ease, color 0.15s ease;
    text-align: left;
}
.paciente-dropdown-item:last-child {
    border-bottom: none;
}
.paciente-dropdown-item:hover,
.paciente-dropdown-item.active {
    background-color: #f0fdfa;
    color: #0f766e;
}
.paciente-dropdown-item.active {
    font-weight: 600;
}
.paciente-item-cedula {
    font-size: 0.76rem;
    color: #64748b;
}
.paciente-dropdown-empty {
    padding: 0.85rem;
    font-size: 0.85rem;
    color: #94a3b8;
    text-align: center;
}
.clear-paciente-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.15rem;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    transition: color 0.15s ease;
    z-index: 2;
}
.clear-paciente-btn:hover {
    color: #ef4444;
}
.paciente-search-input {
    width: 100% !important;
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    padding: 0.55rem 0.75rem !important;
    padding-right: 32px !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 8px !important;
    font-size: 0.88rem !important;
    background-color: #ffffff !important;
    box-sizing: border-box !important;
    color: #1e293b !important;
    outline: none !important;
    cursor: text;
    transition: all 0.2s ease !important;
}
.paciente-search-input:focus {
    border-color: #0d9488 !important;
    box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.15) !important;
    background-color: #ffffff !important;
}




