/* =========================================
   NEXUS ADMIN STYLE v5.0 (ULTIMATE)
   ========================================= */
:root {
    --nexus-bg: #05010d;
    --nexus-glass: rgba(5, 1, 13, 0.7);
    --nexus-border: rgba(255, 255, 255, 0.1);
    
    /* Default Theme: GOLD (Arquitecto) */
    --accent: #ffd700; 
    --accent-glow: rgba(255, 215, 0, 0.4);
    
    --danger: #ff4444;
    --success: #00ff9d;
    --font-main: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --sidebar-width: 260px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- THEMES --- */
[data-theme="cyberpunk"] { --accent: #ff00ff; --accent-glow: rgba(255, 0, 255, 0.5); }
[data-theme="matrix"] { --accent: #00ff00; --accent-glow: rgba(0, 255, 0, 0.4); }

/* --- BASICS & SCROLLBAR --- */
body.admin-mode {
    background-color: var(--nexus-bg);
    background-image: radial-gradient(circle at 50% 50%, rgba(20, 20, 40, 0.4) 0%, transparent 80%);
    color: #e0e0e0; font-family: var(--font-main);
    display: flex; min-height: 100vh; margin: 0; overflow-x: hidden;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* --- TYPOGRAPHY MONOSPACE --- */
.font-mono, .stat-val, .nexus-table td, .user-id, .date-display {
    font-family: var(--font-mono) !important;
}

/* --- SIDEBAR & COLLAPSIBLE --- */
.nexus-sidebar {
    width: var(--sidebar-width); background: var(--nexus-glass);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--nexus-border);
    padding: 1.5rem; display: flex; flex-direction: column;
    position: fixed; height: 100vh; z-index: 50;
    transition: var(--transition);
}
.nexus-sidebar.collapsed { width: 80px; padding: 1.5rem 0.5rem; }
.nexus-sidebar.collapsed .logo-text, 
.nexus-sidebar.collapsed .link-text,
.nexus-sidebar.collapsed .sidebar-footer { display: none; }
.nexus-sidebar.collapsed .nexus-brand { justify-content: center; }
.nexus-sidebar.collapsed .nexus-link { justify-content: center; padding: 12px; }

.nexus-brand { display: flex; align-items: center; gap: 10px; font-family: 'Cinzel', serif; color: #fff; margin-bottom: 2rem; font-size: 1.2rem; }
.nexus-link {
    background: none; border: none; width: 100%; text-align: left;
    padding: 12px 16px; border-radius: 8px; color: #888;
    cursor: pointer; display: flex; align-items: center; gap: 15px;
    font-size: 0.95rem; margin-bottom: 5px; transition: var(--transition);
}
.nexus-link:hover, .nexus-link.active {
    background: rgba(255, 255, 255, 0.03); color: var(--accent);
    border: 1px solid var(--nexus-border);
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
}

/* --- MAIN CONTENT --- */
.nexus-main { 
    flex: 1; margin-left: var(--sidebar-width); padding: 2rem; 
    transition: var(--transition);
}
.nexus-sidebar.collapsed + .nexus-main { margin-left: 80px; }

.nexus-header {
    display: flex; justify-content: space-between; align-items: flex-end;
    margin-bottom: 2rem; border-bottom: 1px solid var(--nexus-border);
    padding-bottom: 1.5rem;
}
.header-actions { display: flex; gap: 1rem; align-items: center; }

/* --- GLASSMORPHISM PRO --- */
.glass-panel, .stat-card, .nexus-toast, .context-menu {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    position: relative; overflow: hidden;
}

/* --- MICRO-INTERACTIONS & GLOW --- */
.stat-card::before, .glass-panel::before {
    content: ''; position: absolute; top: var(--y, -50%); left: var(--x, -50%);
    width: 200px; height: 200px; background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    opacity: 0; transform: translate(-50%, -50%); transition: opacity 0.3s; pointer-events: none; mix-blend-mode: screen;
}
.stat-card:hover::before, .glass-panel:hover::before { opacity: 0.4; }
.pointer { cursor: pointer; transition: transform 0.2s; }
.pointer:hover { transform: translateY(-3px); border-color: var(--accent); }

/* --- ANIMATIONS --- */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.animate-entry { animation: fadeInUp 0.4s ease forwards; opacity: 0; }

/* --- DASHBOARD CARDS --- */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.stat-card { padding: 1.5rem; text-align: center; }
.stat-val { font-size: 2.5rem; font-weight: 700; display: block; margin-bottom: 5px; }
.stat-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; color: #888; }

/* --- TABLES & BADGES --- */
.nexus-table { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
.nexus-table th { color: #666; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; padding: 0 15px; }
.nexus-table tr { background: rgba(255,255,255,0.01); transition: 0.2s; }
.nexus-table tr:hover { background: rgba(255,255,255,0.04); transform: scale(1.01); }
.nexus-table td { padding: 15px; border: none; vertical-align: middle; }
.nexus-table tr td:first-child { border-radius: 10px 0 0 10px; }
.nexus-table tr td:last-child { border-radius: 0 10px 10px 0; }

/* PULSE BADGE */
.badge-pulse { animation: pulse-red 2s infinite; }
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.4); } 70% { box-shadow: 0 0 0 10px rgba(255, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 68, 68, 0); } }

/* --- CONTEXT MENU --- */
.context-menu {
    position: fixed; z-index: 9999; width: 200px;
    display: none; flex-direction: column; padding: 5px;
}
.context-menu.active { display: flex; animation: fadeIn 0.1s; }
.ctx-item {
    padding: 10px; cursor: pointer; display: flex; align-items: center; gap: 10px;
    color: #ccc; border-radius: 6px; font-size: 0.85rem; transition: background 0.2s;
}
.ctx-item:hover { background: rgba(255,255,255,0.1); color: #fff; }
.ctx-item .material-icons-round { font-size: 1.1rem; }

/* --- TOAST STACK --- */
.nexus-toast-container {
    position: fixed; bottom: 20px; right: 20px; z-index: 10000;
    display: flex; flex-direction: column-reverse; gap: 10px; pointer-events: none;
}
.nexus-toast {
    min-width: 250px; padding: 15px; border-left: 3px solid var(--accent);
    display: flex; align-items: center; gap: 10px; animation: slideInRight 0.3s;
    pointer-events: all;
}
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }

/* --- MAPA & EXTRAS --- */
#worldMap { width: 100%; height: 350px; background: rgba(0,0,0,0.2); border-radius: 12px; }
.map-tooltip { background: #000 !important; border: 1px solid var(--accent); color: #fff; font-family: var(--font-mono); }

/* --- SKELETON LOADING --- */
.skeleton { background: linear-gradient(90deg, #111 25%, #1a1a1a 50%, #111 75%); background-size: 200% 100%; animation: loading 1.5s infinite; border-radius: 4px; height: 20px; }
@keyframes loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* --- INPUTS & BUTTONS --- */
.nexus-input, .nexus-textarea {
    background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1);
    color: #fff; padding: 10px 15px; border-radius: 8px; font-family: var(--font-main);
    width: 100%; box-sizing: border-box; transition: border 0.3s;
}
.nexus-input:focus, .nexus-textarea:focus { outline: none; border-color: var(--accent); }

.btn-nexus { 
    background: rgba(255,255,255,0.05); border: 1px solid var(--accent); color: var(--accent);
    padding: 8px 16px; border-radius: 6px; cursor: pointer; font-weight: 600;
    transition: all 0.2s; text-transform: uppercase; font-size: 0.8rem; letter-spacing: 1px;
}
.btn-nexus:hover { background: var(--accent); color: #000; box-shadow: 0 0 15px var(--accent-glow); }
.btn-icon { background: none; border: none; color: #666; cursor: pointer; padding: 5px; border-radius: 50%; transition: color 0.2s; }
.btn-icon:hover { color: #fff; background: rgba(255,255,255,0.05); }

/* --- THEME SWITCHER & CONTROLS --- */
.control-bar { display: flex; gap: 15px; align-items: center; margin-top: 10px; }
.theme-btn { width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.2); cursor: pointer; transition: transform 0.2s; }
.theme-btn:hover { transform: scale(1.1); }
.theme-btn.active { border-color: #fff; transform: scale(1.2); box-shadow: 0 0 10px currentColor; }
.cost-counter { font-family: var(--font-mono); font-size: 0.8rem; color: #666; border: 1px solid #333; padding: 4px 8px; border-radius: 4px; }

/* --- AUDIT LOG --- */
.audit-list { list-style: none; padding: 0; margin: 0; max-height: 400px; overflow-y: auto; }
.audit-item { 
    padding: 12px; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 0.85rem; 
    display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: center;
}
.audit-item:last-child { border-bottom: none; }
.audit-main { display: flex; gap: 10px; align-items: center; }
.audit-diff { font-family: var(--font-mono); font-size: 0.75rem; color: #888; }
.audit-time { color: #555; font-size: 0.7rem; font-family: var(--font-mono); }

/* --- UTILS --- */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-gold { color: var(--gold) !important; } /* Fallback */
.text-gold { color: var(--accent) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.sub-text { font-size: 0.8rem; color: #888; }