/* ═══════════════════════════════════════════════════════════
   RMM Control Pro - Complete Stylesheet v7.0
   Dark theme + Fluid cards + Toast + Page transitions + Animations
   ═══════════════════════════════════════════════════════════ */

:root {
    --bg-dark: #0a0e17;
    --bg-sidebar: #0d1220;
    --bg-card: #111827;
    --bg-card-glass: rgba(17, 24, 39, 0.7);
    --bg-input: #1a2236;
    --bg-hover: #1e293b;
    --bg-tertiary: #151d2e;
    --border: #1e293b;
    --border-glow: rgba(79, 140, 255, 0.25);
    --accent: #4f8cff;
    --accent-hover: #6ba1ff;
    --accent-glow: rgba(79, 140, 255, 0.3);
    --green: #2ecc71;
    --green-glow: rgba(46, 204, 113, 0.3);
    --red: #e74c3c;
    --red-glow: rgba(231, 76, 60, 0.3);
    --orange: #f39c12;
    --yellow: #f1c40f;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow: 0 4px 16px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ═══ Keyframes ═══ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: translateX(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes pulseGlow { 0%, 100% { box-shadow: 0 0 4px var(--green-glow); } 50% { box-shadow: 0 0 12px var(--green-glow), 0 0 24px var(--green-glow); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes barGrow { from { width: 0%; } to { width: var(--bar-width, 0%); } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.02); } }
@keyframes cardEnter { from { opacity: 0; transform: translateY(20px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes pageEnter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pageExit { from { opacity: 1; } to { opacity: 0; } }
@keyframes toastSlideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastSlideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }
@keyframes ripple { 0% { transform: scale(0); opacity: 0.5; } 100% { transform: scale(4); opacity: 0; } }
@keyframes countUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', -apple-system, sans-serif; background: var(--bg-dark); color: var(--text-primary); overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 10px; transition: background var(--transition-fast); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* Selection */
::selection { background: var(--accent); color: #fff; }

/* ═══ Login ═══ */
.login-container { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg-dark); animation: fadeIn 0.5s ease; }
.login-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px; width: 380px; box-shadow: var(--shadow-lg); animation: scaleIn 0.4s ease; backdrop-filter: blur(12px); }
.login-logo { text-align: center; margin-bottom: 30px; }
.login-logo i { font-size: 48px; color: var(--accent); margin-bottom: 12px; filter: drop-shadow(0 0 12px var(--accent-glow)); }
.login-logo h1 { font-size: 22px; color: var(--text-primary); }
.login-logo p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.input-group { position: relative; margin-bottom: 16px; }
.input-group i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 14px; transition: color var(--transition-fast); }
.input-group input { width: 100%; padding: 12px 14px 12px 40px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-primary); font-size: 14px; outline: none; transition: all var(--transition-smooth); }
.input-group input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.input-group:focus-within i { color: var(--accent); }
.btn-login { width: 100%; padding: 12px; background: var(--accent); color: #fff; border: none; border-radius: var(--radius); font-size: 15px; font-weight: 600; cursor: pointer; transition: all var(--transition-smooth); }
.btn-login:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-glow); }
.btn-login:active { transform: translateY(0); }
.error-text { color: var(--red); font-size: 13px; text-align: center; margin-top: 12px; min-height: 18px; }

/* ═══ App Layout ═══ */
.app-container { display: flex; height: 100vh; overflow: hidden; animation: fadeIn 0.3s ease; }

/* ═══ Sidebar ═══ */
.sidebar { width: 220px; min-width: 220px; background: var(--bg-sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 10; transition: width var(--transition-smooth), min-width var(--transition-smooth); }
.sidebar-header { padding: 20px 16px; display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; color: var(--accent); }
.sidebar-header i { font-size: 22px; filter: drop-shadow(0 0 8px var(--accent-glow)); }
.sidebar-nav { flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); color: var(--text-secondary); font-size: 14px; transition: all var(--transition-fast); cursor: pointer; position: relative; overflow: hidden; }
.nav-item::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); border-radius: var(--radius); transition: width var(--transition-smooth); opacity: 0.1; }
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item:hover::before { width: 100%; }
.nav-item.active { background: rgba(79,140,255,0.12); color: var(--accent); font-weight: 600; }
.nav-item.active::before { width: 3px; opacity: 1; border-radius: 0 var(--radius) var(--radius) 0; }
.nav-item i { width: 18px; text-align: center; font-size: 15px; position: relative; z-index: 1; }
.nav-item span { position: relative; z-index: 1; }
.nav-section { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; padding: 16px 12px 6px; }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.user-info { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 13px; }
.btn-icon { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 6px; border-radius: 6px; transition: all var(--transition-fast); }
.btn-icon:hover { color: var(--red); background: rgba(231,76,60,0.1); }
.badge { background: var(--red); color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 10px; font-weight: 700; margin-left: auto; animation: pulse 2s infinite; }

/* ═══ Main Content ═══ */
.main-content { flex: 1; overflow-y: auto; padding: 24px; scroll-behavior: smooth; }
.page { display: none; }
.page.active { display: block; animation: pageEnter 0.35s cubic-bezier(0.4, 0, 0.2, 1) both; }
.page.page-enter { animation: pageEnter 0.35s cubic-bezier(0.4, 0, 0.2, 1) both; }
.page.page-exit { animation: pageExit 0.2s ease both; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-header h2 { font-size: 22px; font-weight: 700; }

/* ═══ Buttons ═══ */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); color: var(--text-primary); font-size: 13px; cursor: pointer; transition: all var(--transition-fast); white-space: nowrap; position: relative; overflow: hidden; }
.btn::after { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,0); transition: background var(--transition-fast); }
.btn:hover { background: var(--bg-hover); border-color: var(--text-muted); transform: translateY(-1px); }
.btn:hover::after { background: rgba(255,255,255,0.02); }
.btn:active { transform: translateY(0); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 12px var(--accent-glow); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { box-shadow: 0 4px 12px var(--green-glow); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { box-shadow: 0 4px 12px var(--red-glow); }
.btn-warning { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg-hover); }

/* ═══ Cards & Stats ═══ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; display: flex; align-items: center; gap: 16px; transition: all var(--transition-smooth); position: relative; overflow: hidden; animation: slideUp 0.4s ease backwards; }
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }
.stat-card::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at top left, rgba(79,140,255,0.04), transparent 70%); pointer-events: none; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--border-glow); }
.stat-icon { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; transition: transform var(--transition-spring); }
.stat-card:hover .stat-icon { transform: scale(1.1); }
.stat-icon.blue { background: rgba(79,140,255,0.12); color: var(--accent); }
.stat-icon.green { background: rgba(46,204,113,0.12); color: var(--green); }
.stat-icon.red { background: rgba(231,76,60,0.12); color: var(--red); }
.stat-icon.orange { background: rgba(243,156,18,0.12); color: var(--orange); }
.stat-value { font-size: 30px; font-weight: 800; display: block; letter-spacing: -0.5px; transition: all var(--transition-fast); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: all var(--transition-smooth); }
.card:hover { border-color: rgba(255,255,255,0.06); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 16px 20px; }

/* ═══ Tables ═══ */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 10px 12px; font-size: 11px; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); font-weight: 600; letter-spacing: 0.5px; }
.table td { padding: 10px 12px; font-size: 13px; border-bottom: 1px solid rgba(255,255,255,0.03); transition: background var(--transition-fast); }
.table tr:hover td { background: var(--bg-hover); }
.table-sm td, .table-sm th { padding: 6px 10px; font-size: 12px; }

/* ═══ Terminal ═══ */
.terminal-card { display: flex; flex-direction: column; height: calc(100vh - 140px); }
.terminal-output { flex: 1; overflow-y: auto; padding: 16px; font-family: 'Consolas', 'Courier New', monospace; font-size: 13px; background: #050810; border-radius: 8px 8px 0 0; }
.terminal-welcome { color: var(--text-muted); }
.terminal-line { margin: 2px 0; line-height: 1.5; animation: fadeIn 0.15s ease; }
.terminal-line.cmd { color: var(--green); }
.terminal-line.out { color: var(--text-secondary); white-space: pre-wrap; word-break: break-all; }
.terminal-line.err { color: var(--red); }
.terminal-input-area { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--bg-sidebar); border-radius: 0 0 8px 8px; }
.terminal-prompt { color: var(--green); font-family: 'Consolas', monospace; font-weight: 700; }
.terminal-input-area input { flex: 1; background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; color: var(--text-primary); font-family: 'Consolas', monospace; font-size: 13px; outline: none; transition: all var(--transition-fast); }
.terminal-input-area input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.select-agent { background: var(--bg-input); border: 1px solid var(--border); color: var(--text-primary); padding: 6px 12px; border-radius: var(--radius); font-size: 13px; outline: none; transition: border-color var(--transition-fast); }
.select-agent:focus { border-color: var(--accent); }

/* ═══ Agents Grid (Cards) - FLUID ═══ */
.agents-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.agents-search { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 200px; max-width: 400px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 12px; transition: all var(--transition-fast); }
.agents-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.agents-search i { color: var(--text-muted); font-size: 14px; }
.agents-search input { flex: 1; background: none; border: none; color: var(--text-primary); padding: 8px 0; font-size: 13px; outline: none; }
.agents-sort { display: flex; align-items: center; gap: 4px; }
.agents-sort .btn { font-size: 11px; padding: 5px 10px; }
.agents-sort .btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.agents-count { font-size: 12px; color: var(--text-muted); margin-left: auto; }

.agents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.agent-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    cursor: pointer;
    transition: all var(--transition-smooth);
    position: relative;
    overflow: hidden;
    animation: cardEnter 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
    will-change: transform, box-shadow;
}
.agent-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    transition: width var(--transition-smooth);
}
.agent-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at top right, rgba(79,140,255,0.03), transparent 70%);
    pointer-events: none;
    transition: opacity var(--transition-smooth);
    opacity: 0;
}
.agent-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 12px 36px rgba(0,0,0,0.3), 0 0 0 1px var(--border-glow);
}
.agent-card:hover::after { opacity: 1; }
.agent-card:hover::before { width: 4px; }
.agent-card:active { transform: translateY(-2px) scale(1.005); }
.agent-card.online::before { background: var(--green); box-shadow: 2px 0 12px var(--green-glow); }
.agent-card.offline::before { background: var(--red); }
.agent-card.offline { opacity: 0.55; }
.agent-card.offline:hover { opacity: 0.75; }
.ac-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.ac-status { font-size: 11px; font-weight: 700; text-transform: uppercase; display: flex; align-items: center; gap: 6px; letter-spacing: 0.5px; }
.ac-status.online { color: var(--green); }
.ac-status.offline { color: var(--red); }
.ac-status i { font-size: 7px; }
.ac-status.online i { animation: pulseGlow 2s ease-in-out infinite; border-radius: 50%; }
.ac-icon { text-align: center; margin-bottom: 10px; }
.ac-icon i { font-size: 34px; color: var(--accent); opacity: 0.7; transition: all var(--transition-smooth); filter: drop-shadow(0 2px 8px var(--accent-glow)); }
.agent-card:hover .ac-icon i { opacity: 1; transform: scale(1.08); }
.agent-card.offline .ac-icon i { color: var(--text-muted); filter: none; }
.ac-name { text-align: center; font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.ac-ip { text-align: center; font-size: 12px; color: var(--accent); font-family: 'Consolas', monospace; margin-bottom: 2px; }
.ac-os { text-align: center; font-size: 11px; color: var(--text-muted); margin-bottom: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-metrics { display: flex; flex-direction: column; gap: 6px; }
.ac-metric { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.ac-metric-label { color: var(--text-muted); width: 32px; text-align: right; font-weight: 600; }
.ac-metric-val { color: var(--text-secondary); width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.mini-bar { flex: 1; height: 5px; background: var(--bg-input); border-radius: 3px; overflow: hidden; position: relative; }
.mini-fill { height: 100%; border-radius: 3px; width: var(--bar-width, 0%); transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1); animation: barGrow 1s cubic-bezier(0.34, 1.56, 0.64, 1) backwards; position: relative; }
.mini-fill::after { content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 8px; background: inherit; filter: brightness(1.3); border-radius: 0 3px 3px 0; }
.mini-fill.low { background: linear-gradient(90deg, #1a9f4d, var(--green)); }
.mini-fill.med { background: linear-gradient(90deg, #e67e22, var(--orange)); }
.mini-fill.high { background: linear-gradient(90deg, #c0392b, var(--red)); }
.ac-footer { display: flex; justify-content: space-between; margin-top: 14px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,0.04); font-size: 11px; color: var(--text-muted); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); animation: fadeIn 0.5s ease; }
.empty-state i { font-size: 48px; margin-bottom: 12px; opacity: 0.3; display: block; }

/* Agent card stagger animation (set via JS inline style) */
.agent-card[style*="animation-delay"] { /* applied dynamically */ }

/* ═══ Toast Notifications ═══ */
.toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 10000;
    display: flex; flex-direction: column; gap: 10px; pointer-events: none; max-width: 380px;
}
.toast {
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(12px);
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toast.toast-enter { transform: translateX(0); opacity: 1; }
.toast.toast-exit { animation: toastSlideOut 0.3s ease forwards; }
.toast-success { border-left: 3px solid var(--green); }
.toast-success i { color: var(--green); }
.toast-error { border-left: 3px solid var(--red); }
.toast-error i { color: var(--red); }
.toast-warning { border-left: 3px solid var(--orange); }
.toast-warning i { color: var(--orange); }
.toast-info { border-left: 3px solid var(--accent); }
.toast-info i { color: var(--accent); }
.toast i { font-size: 16px; flex-shrink: 0; }
.toast span { flex: 1; line-height: 1.4; }
.toast-close {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    font-size: 18px; padding: 0 4px; transition: color var(--transition-fast); flex-shrink: 0;
}
.toast-close:hover { color: var(--text-primary); }

/* ═══ Button loading state ═══ */
.btn-loading { position: relative; pointer-events: none; color: transparent !important; }
.btn-loading::before {
    content: ''; position: absolute; left: 50%; top: 50%;
    width: 16px; height: 16px; margin: -8px 0 0 -8px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ═══ App enter animation ═══ */
.app-enter { animation: fadeIn 0.4s ease; }
.app-enter .sidebar { animation: slideInLeft 0.4s ease; }
.app-enter .main-content { animation: fadeIn 0.5s ease 0.1s both; }

/* ═══ Agent card uptime badge ═══ */
.ac-uptime {
    font-size: 10px; color: var(--text-muted); font-weight: 600;
    background: var(--bg-input); padding: 2px 6px; border-radius: 4px;
}
.toast-fade-out { animation: fadeIn 0.3s ease reverse forwards; }

/* ═══ Modal ═══ */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; animation: fadeIn 0.2s ease; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.modal-content { position: relative; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); width: 480px; max-width: 90vw; animation: scaleIn 0.25s ease; box-shadow: var(--shadow-lg); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; }
.btn-close { background: none; border: none; color: var(--text-muted); font-size: 24px; cursor: pointer; transition: color var(--transition-fast); }
.btn-close:hover { color: var(--text-primary); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-input { width: 100%; padding: 10px 14px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-primary); font-size: 14px; outline: none; transition: all var(--transition-fast); }
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
textarea.form-input { resize: vertical; font-family: 'Consolas', monospace; font-size: 13px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.text-muted { color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════
   REMOTE DESKTOP OVERLAY (estilo AnyDesk/Discord)
   ═══════════════════════════════════════════════════════════ */

.remote-desktop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    background: #000;
}

/* Top toolbar */
.rd-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    min-height: 44px;
    z-index: 10;
    flex-shrink: 0;
}
.rd-toolbar-left, .rd-toolbar-center, .rd-toolbar-right { display: flex; align-items: center; gap: 8px; }
.rd-toolbar-center { flex: 1; justify-content: center; }

.rd-btn {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition-fast);
}
.rd-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--text-muted); }

.rd-machine-name { font-weight: 700; font-size: 14px; color: var(--text-primary); }
.rd-status-dot { width: 8px; height: 8px; border-radius: 50%; }
.rd-status-dot.online { background: var(--green); box-shadow: 0 0 6px var(--green); }
.rd-status-dot.offline { background: var(--red); }

.rd-mode-switch {
    display: flex;
    background: var(--bg-input);
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}
.rd-mode-btn {
    padding: 5px 14px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 5px;
}
.rd-mode-btn.active { background: var(--accent); color: #fff; box-shadow: 0 2px 8px var(--accent-glow); }
.rd-mode-btn:hover:not(.active) { color: var(--text-primary); }

.rd-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
}

.rd-info { font-size: 12px; color: var(--text-muted); font-family: 'Consolas', monospace; }

/* Body: canvas + sidebar */
.rd-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

.rd-canvas-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0a0a;
    overflow: hidden;
    position: relative;
}

#rd-canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    outline: none;
    display: none;
}
#rd-canvas:focus { /* No visible outline - immersive */ }

.rd-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 12px;
}
.rd-placeholder i { font-size: 48px; opacity: 0.3; }
.rd-placeholder p { font-size: 14px; }
.rd-spinner {
    width: 24px; height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Sidebar tools */
.rd-sidebar {
    width: 340px;
    min-width: 340px;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    display: flex;
    overflow: hidden;
}
.rd-sidebar-tabs {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
}
.rd-tab {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition-fast);
    position: relative;
}
.rd-tab:hover { color: var(--text-primary); background: var(--bg-hover); }
.rd-tab.active { color: var(--accent); background: rgba(79,140,255,0.12); }
.rd-tab.active::after { content: ''; position: absolute; left: 0; top: 25%; bottom: 25%; width: 2px; background: var(--accent); border-radius: 1px; }

.rd-sidebar-content {
    flex: 1;
    overflow-y: auto;
    position: relative;
}
.rd-panel {
    display: none;
    padding: 14px;
    position: absolute;
    inset: 0;
    overflow-y: auto;
    flex-direction: column;
}
.rd-panel.active { display: flex; }
.rd-panel h4 { font-size: 14px; font-weight: 700; margin-bottom: 10px; color: var(--text-secondary); }

/* Info panel */
.rd-info-row { display: flex; justify-content: space-between; font-size: 12px; padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.rd-info-row label { color: var(--text-muted); font-weight: 600; }
.rd-info-row span { color: var(--text-primary); text-align: right; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Terminal panel */
.rd-term-output {
    flex: 1; min-height: 200px; max-height: 400px;
    overflow-y: auto; background: #0a0a0a; border-radius: 6px;
    padding: 8px; font-family: 'Consolas', monospace; font-size: 12px;
    color: var(--text-secondary); margin-bottom: 8px;
}
.rd-term-input {
    display: flex; align-items: center; gap: 6px;
    background: var(--bg-input); border-radius: 6px; padding: 4px 8px;
}
.rd-term-input span { color: var(--green); font-family: 'Consolas', monospace; font-weight: 700; }
.rd-term-input input {
    flex: 1; background: none; border: none; color: var(--text-primary);
    font-family: 'Consolas', monospace; font-size: 12px; outline: none;
}

/* Keylogger panel */
.rd-keylog-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.rd-keylog-badge { font-size: 11px; font-weight: 700; margin-left: auto; }
.rd-keylog-badge.on { color: var(--green); }
.rd-keylog-badge.off { color: var(--red); }
.rd-keylog-out {
    flex: 1; min-height: 200px; max-height: 400px;
    overflow-y: auto; background: #0a0a0a; border-radius: 6px;
    padding: 8px; font-family: 'Consolas', monospace; font-size: 12px;
    color: #b5bd68; white-space: pre-wrap; word-break: break-all;
}

/* Audio panel */
.rd-audio-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.rd-audio-list { display: flex; flex-direction: column; gap: 8px; }
.rd-audio-item { background: var(--bg-input); border-radius: 6px; padding: 8px; }
.rd-audio-item audio { width: 100%; height: 32px; }

/* Files panel */
.rd-file-bar { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.rd-file-input {
    flex: 1; background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 4px; color: var(--text-primary); font-family: 'Consolas', monospace;
    font-size: 12px; padding: 4px 8px; outline: none;
}
.rd-file-input:focus { border-color: var(--accent); }
.rd-file-list { flex: 1; overflow-y: auto; max-height: 500px; }
.rd-file-item {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 8px; border-radius: 6px; font-size: 12px;
    cursor: pointer; transition: all var(--transition-fast);
}
.rd-file-item:hover { background: var(--bg-hover); transform: translateX(2px); }
.rd-file-item i.fa-folder { color: var(--orange); }
.rd-file-item i.fa-file { color: var(--text-muted); }
.rd-file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-file-size { color: var(--text-muted); font-size: 11px; }

/* Network panel */
.rd-net-list { flex: 1; overflow-y: auto; max-height: 500px; }
.rd-net-row {
    display: flex; align-items: center; gap: 6px; padding: 3px 0;
    font-size: 11px; font-family: 'Consolas', monospace;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.rd-net-proto { color: var(--accent); width: 28px; font-weight: 700; }
.rd-net-addr { color: var(--text-secondary); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-net-state { font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 3px; }
.rd-net-state.est { color: var(--green); background: rgba(46,204,113,0.1); }
.rd-net-state.listen { color: var(--accent); background: rgba(79,140,255,0.1); }
.rd-net-state.other { color: var(--text-muted); }

/* Process & Services panel */
.rd-proc-list { flex: 1; overflow-y: auto; }
.rd-proc-list .rd-proc-row { transition: background var(--transition-fast); }
.rd-proc-list .rd-proc-row:hover { background: var(--bg-hover); }
.rd-sub-tabs .btn.active { background: var(--accent); color: #fff; }
.rd-sub-tabs .btn { background: var(--bg-tertiary); color: var(--text-secondary); border: none; font-size: 11px; padding: 3px 8px; }
.rd-sub-tabs .btn:hover { background: var(--bg-hover); }

/* ═══ Skeleton Loading ═══ */
.skeleton {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-hover) 37%, var(--bg-input) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.4s ease infinite;
    border-radius: var(--radius);
}
.skeleton-card { height: 260px; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.skeleton-stat { height: 88px; border-radius: var(--radius-lg); }
.skeleton-row { height: 44px; margin-bottom: 4px; }
.agent-card.skeleton-card { padding: 0; cursor: default; pointer-events: none; animation: shimmer 1.4s ease infinite; background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-hover) 37%, var(--bg-input) 63%); background-size: 400% 100%; }

/* ═══ Responsive ═══ */
@media (max-width: 900px) {
    .sidebar { width: 60px; min-width: 60px; }
    .sidebar-header span, .nav-item span, .nav-section, .user-info span { display: none; }
    .grid-2 { grid-template-columns: 1fr; }
    .rd-sidebar { width: 280px; min-width: 280px; }
    .agents-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .agents-toolbar { flex-direction: column; }
    .agents-search { max-width: none; }
}

@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr; }
    .agents-grid { grid-template-columns: 1fr; }
    .main-content { padding: 12px; }
}
