/* VoraSploit — custom styles (plain CSS; utilities come from Tailwind CDN) */

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.safe-bottom {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }

.font-mono, code, pre {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* Cards */
.card {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 0.5rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, opacity 0.15s;
  border: none;
  cursor: pointer;
}
.btn:focus { outline: none; box-shadow: 0 0 0 2px rgba(16,185,129,0.4); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn-primary { background: #059669; color: #fff; }
.btn-primary:hover { background: #10b981; }
.btn-secondary {
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid #334155;
}
.btn-secondary:hover { background: #334155; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #ef4444; }
.btn-ghost { background: transparent; color: #cbd5e1; }
.btn-ghost:hover { background: #1e293b; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.75rem; }

/* Inputs */
.input {
  width: 100%;
  border-radius: 0.5rem;
  border: 1px solid #334155;
  background: #0f172a;
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  color: #f1f5f9;
}
.input::placeholder { color: #64748b; }
.input:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 1px #10b981;
}

.label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: #94a3b8;
  margin-bottom: 0.375rem;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-green { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-yellow { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-red { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-blue { background: rgba(14,165,233,0.15); color: #38bdf8; }
.badge-slate { background: rgba(100,116,139,0.15); color: #cbd5e1; }
.badge-purple { background: rgba(139,92,246,0.15); color: #a78bfa; }

.status-dot { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 9999px; }
.status-running { background: #34d399; }
.status-pending { background: #fbbf24; }
.status-failed { background: #f87171; }
.status-stopped { background: #94a3b8; }

#page-content { animation: fadeIn 0.2s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.nav-item-active { color: #34d399; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; font-size: 0.875rem; text-align: left; border-collapse: collapse; }
table.data th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  font-weight: 500;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #1e293b;
}
table.data td {
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(30,41,59,0.8);
}

.empty-state { text-align: center; padding: 4rem 1rem; color: #64748b; }

.toast {
  pointer-events: auto;
  border-radius: 0.5rem;
  border: 1px solid;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.35);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  animation: slideIn 0.25s ease;
  background: #0f172a;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}
.toast-success { border-color: rgba(16,185,129,0.4); color: #d1fae5; }
.toast-error { border-color: rgba(239,68,68,0.4); color: #fecaca; }
.toast-info { border-color: rgba(14,165,233,0.4); color: #e0f2fe; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  padding: 1rem;
}
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; }
}
.modal-panel {
  width: 100%;
  max-width: 28rem;
  border-radius: 1rem;
  border: 1px solid #334155;
  background: #0f172a;
  padding: 1.25rem;
  box-shadow: 0 25px 50px rgba(0,0,0,0.5);
  max-height: 90vh;
  overflow-y: auto;
}

.workspace-grid { display: grid; gap: 1rem; }
@media (min-width: 1024px) {
  .workspace-grid { grid-template-columns: 2fr 1fr; }
}
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Learning module — lesson body */
.lesson-body h1 { font-size: 1.5rem; font-weight: 700; margin: 1.25rem 0 0.75rem; color: #f8fafc; }
.lesson-body h2 { font-size: 1.25rem; font-weight: 600; margin: 1.1rem 0 0.6rem; color: #f1f5f9; }
.lesson-body h3 { font-size: 1.1rem; font-weight: 600; margin: 1rem 0 0.5rem; color: #e2e8f0; }
.lesson-body p { margin: 0.65rem 0; line-height: 1.65; }
.lesson-body ul, .lesson-body ol { margin: 0.65rem 0; padding-left: 1.35rem; }
.lesson-body li { margin: 0.25rem 0; }
.lesson-body a { color: #34d399; text-decoration: underline; }
.lesson-body code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.85em;
  background: #1e293b;
  padding: 0.1em 0.35em;
  border-radius: 0.25rem;
}
.lesson-body pre {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 0.5rem;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  margin: 0.85rem 0;
  font-size: 0.85rem;
}
.lesson-body pre code { background: transparent; padding: 0; }
.lesson-body table { width: 100%; border-collapse: collapse; margin: 0.85rem 0; font-size: 0.9rem; }
.lesson-body th, .lesson-body td { border: 1px solid #334155; padding: 0.4rem 0.65rem; text-align: left; }
.lesson-body th { background: #1e293b; }
.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Side navigation (desktop retractable / mobile overlay) ─────────────── */

:root {
  --sidebar-width: 15.5rem;
  --sidebar-collapsed-width: 4.25rem;
}

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 45;
  width: var(--sidebar-width);
  max-width: 85vw;
  background: #0a0f1a;
  border-right: 1px solid #1e293b;
  transform: translateX(-105%);
  transition: transform 0.22s ease, width 0.22s ease;
  display: none;
}

html.has-sidebar .app-sidebar {
  display: block;
}

/* Mobile overlay open */
html.sidebar-open .app-sidebar {
  transform: translateX(0);
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.45);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 44;
  background: rgba(2, 6, 23, 0.65);
  backdrop-filter: blur(2px);
}

html.sidebar-open .sidebar-backdrop {
  display: block;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0.75rem 0.6rem;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.4rem 0.85rem;
  border-bottom: 1px solid #1e293b;
  margin-bottom: 0.75rem;
}

.sidebar-logo {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-close-btn {
  padding: 0.4rem;
  border-radius: 0.5rem;
  color: #94a3b8;
  background: transparent;
  border: none;
  cursor: pointer;
}
.sidebar-close-btn:hover {
  background: #1e293b;
  color: #f1f5f9;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0 0.15rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  color: #94a3b8;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.sidebar-link:hover {
  background: #1e293b;
  color: #f1f5f9;
}
.sidebar-link.is-active {
  background: rgba(5, 150, 105, 0.15);
  color: #34d399;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.35);
}
.sidebar-link-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid #1e293b;
}

.sidebar-collapse-btn {
  width: 100%;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  color: #64748b;
  font-size: 0.75rem;
  background: transparent;
  border: none;
  cursor: pointer;
}
.sidebar-collapse-btn:hover {
  background: #1e293b;
  color: #cbd5e1;
}

/* Desktop: fixed sidebar, push content */
@media (min-width: 1024px) {
  .app-sidebar {
    transform: translateX(0);
    position: sticky;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
    z-index: 40;
  }

  html.has-sidebar #app {
    flex-direction: row;
  }

  .sidebar-backdrop {
    display: none !important;
  }

  /* Collapsed: icon-only rail */
  html.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-collapsed-width);
  }
  html.sidebar-collapsed .sidebar-brand-text,
  html.sidebar-collapsed .sidebar-label {
    display: none;
  }
  html.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  html.sidebar-collapsed .sidebar-brand {
    justify-content: center;
  }
  html.sidebar-collapsed .sidebar-collapse-btn {
    justify-content: center;
  }
}

.app-column {
  min-height: 100vh;
}

/* ── Bottom navigation (viewport-fixed; never scrolls with content) ───────── */
.mobile-nav {
  display: none;
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  top: auto !important;
  width: 100% !important;
  max-width: 100vw;
  margin: 0;
  z-index: 9999 !important;
  border-top: 1px solid #1e293b;
  background: rgba(2, 6, 23, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding-bottom: env(safe-area-inset-bottom, 0);
  /* Escape any transformed ancestors */
  transform: none !important;
  will-change: auto;
}
html.has-mobile-nav .mobile-nav {
  display: block !important;
}
html.has-mobile-nav #app-main,
html.has-mobile-nav .app-column {
  padding-bottom: 5.5rem !important;
}
/* Keep page content above the bar; do not nest fixed nav inside transformed parents */
body {
  overflow-x: hidden;
}
