@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Paleta de Grises Profesional - Alta Densidad */
    --bg-deep: #09090b;
    --bg-sidebar: #0f0f11;
    --bg-content: #2a2a2d;
    --bg-card: #1c1c1f;
    
    --accent-primary: #0071e3; 
    --accent-secondary: #2d2d30;
    --accent-success: #22c55e;
    --accent-warning: #eab308;
    --accent-danger: #ef4444;
    
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa; 
    --text-muted: #71717a;     
    
    --border-color: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.08);
    
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    
    --transition-smooth: all 0.2s ease;
}

[data-theme='light'] {
    --bg-deep: #f4f4f7;       
    --bg-sidebar: #f2f2f2;    
    --bg-content: #ffffff;    
    --bg-card: #ffffff;       
    --text-primary: #09090b;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --border-color: rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-deep);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    line-height: 1.3;
    font-size: 14px; /* Alta densidad */
}

/* COMPONENTES COMPACTOS */

.nx-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.95rem 1.25rem !important;
    transition: var(--transition-smooth);
}

.nx-btn {
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
}

.nx-btn-primary { background: var(--accent-primary); color: white; }
.nx-btn-outline { background: transparent; border-color: var(--border-color); color: var(--text-primary); }
.nx-btn-outline:hover { background: rgba(255,255,255,0.03); }

.nx-input {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.7rem;
    font-size: 13px;
    color: var(--text-primary);
    width: 100%;
    outline: none;
}

.nx-badge {
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border: 1px solid transparent;
}

.nx-badge-success { background: rgba(34, 197, 94, 0.08); color: #4ade80; border-color: rgba(34, 197, 94, 0.1); }
.nx-badge-warning { background: rgba(234, 179, 8, 0.08); color: #facc15; border-color: rgba(234, 179, 8, 0.1); }
.nx-badge-danger { background: rgba(239, 68, 68, 0.08); color: #f87171; border-color: rgba(239, 68, 68, 0.1); }
.nx-badge-outline { background: transparent; border-color: var(--border-color); color: var(--text-secondary); }
.nx-badge-secondary { background: var(--border-color); border-color: var(--border-color); color: var(--text-secondary); }

/* TABLAS ADAPTABLES Y RESILIENTES */
.nx-table-container {
    width: 100%;
    overflow-x: auto;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    -webkit-overflow-scrolling: touch;
}

.nx-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    padding: 0;
    color: var(--text-primary);
}

/* PANTALLA DE RESILIENCIA (OVERLAY SERVICIO NO DISPONIBLE) */
.nx-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(9, 9, 11, 0.82); /* Fallback elegante */
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999;
    padding: 3rem;
    text-align: center;
    border-radius: 16px 0 0 0; /* Coincide con el redondeado superior del contenedor .content */
    animation: fadeInOverlay 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

[data-theme='light'] .nx-overlay {
    background: rgba(244, 244, 247, 0.82);
}

.nx-overlay-icon {
    font-size: 4.5rem;
    color: var(--accent-danger);
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 20px rgba(239, 68, 68, 0.4));
    animation: pulseIcon 2.4s infinite ease-in-out;
}

.nx-overlay-title {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    letter-spacing: -0.03em;
}

.nx-overlay-msg {
    font-size: 0.95rem;
    color: var(--text-secondary);
    max-width: 480px;
    margin-bottom: 2.25rem;
    line-height: 1.65;
}

.nx-overlay-msg strong {
    color: var(--accent-primary);
    font-weight: 600;
}

.nx-overlay .nx-btn {
    padding: 0.75rem 1.75rem;
    font-size: 13.5px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 113, 227, 0.35);
    font-weight: 600;
    letter-spacing: -0.01em;
    gap: 8px;
    background: var(--accent-primary);
    color: #ffffff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.nx-overlay .nx-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(0, 113, 227, 0.5);
    background: #0077ed; /* Apple Hover Highlight */
}

.nx-overlay .nx-btn:active {
    transform: translateY(1px);
    box-shadow: 0 5px 15px -5px rgba(0, 113, 227, 0.4);
}

@keyframes fadeInOverlay {
    from { opacity: 0; backdrop-filter: blur(0px); -webkit-backdrop-filter: blur(0px); }
    to { opacity: 1; backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }
}

@keyframes pulseIcon {
    0% { transform: scale(1); filter: drop-shadow(0 0 15px rgba(239, 68, 68, 0.3)); }
    50% { transform: scale(1.08); filter: drop-shadow(0 0 30px rgba(239, 68, 68, 0.65)); }
    100% { transform: scale(1); filter: drop-shadow(0 0 15px rgba(239, 68, 68, 0.3)); }
}

/* Animación de pulso para esqueletos inactivos */
.animate-pulse {
    animation: pulseSkeleton 1.8s infinite ease-in-out;
}

@keyframes pulseSkeleton {
    0% { opacity: 0.22; }
    50% { opacity: 0.42; }
    100% { opacity: 0.22; }
}

/* Bloqueo de scroll inteligente al caer servicio (oculta esqueletos excedentes) */
.content:has(.nx-overlay) {
    overflow-y: hidden !important;
}

.nx-icon-dynamic { color: var(--text-muted); }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: var(--accent-secondary); border-radius: 10px; }
