/* custom.css — StatusClaw 2.0 custom styles */

:root {
  --sc-bg: #0f1117;
  --sc-card-bg: #181c24;
  --sc-border: #2a2f3a;
  --sc-text: #e6edf3;
  --sc-text-secondary: #8b949e;
  --sc-accent: #58a6ff;
  --sc-success: #3fb950;
  --sc-warning: #d29922;
  --sc-danger: #f85149;
}

/* Base */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--sc-bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* Topbar */
.topbar {
  background: #161b22;
  border-bottom: 1px solid var(--sc-border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.topbar-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--sc-text);
}

/* Cards */
.card {
  border-color: var(--sc-border);
  background: var(--sc-card-bg);
  border-radius: 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  border-color: #3a4050;
}

/* Card header for sections */
.section-card .card-header {
  background: transparent;
  border-bottom: 1px solid var(--sc-border);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.75rem 1rem;
  cursor: default;
  font-size: 0.92rem;
}

/* KPI Cards */
.kpi-card {
  text-align: center;
  padding: 1rem 0.75rem;
  position: relative;
  overflow: hidden;
}
.kpi-icon {
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
}
.kpi-value {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.2;
}
.kpi-sub {
  font-size: 0.72rem;
  color: var(--sc-text-secondary);
  margin-top: 2px;
}
.kpi-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #21262d;
}
.kpi-bar .progress-bar {
  border-radius: 0;
  height: 100%;
  transition: width 0.5s ease;
}

/* Progress bars */
.progress-thin {
  height: 6px;
  border-radius: 3px;
  background: #21262d;
}
.progress-thin .progress-bar {
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* Badge glow */
.badge-glow {
  box-shadow: 0 0 8px rgba(63, 185, 80, 0.25);
}
.badge-glow.bg-warning {
  box-shadow: 0 0 8px rgba(210, 153, 34, 0.25);
}
.badge-glow.bg-secondary {
  box-shadow: none;
}

/* Agent / Session / Task / Cron cards */
.agent-card,
.session-card,
.task-card,
.cron-card {
  border-radius: 10px;
  transition: transform 0.15s ease, border-color 0.2s ease;
}
.agent-card:hover,
.session-card:hover,
.task-card:hover,
.cron-card:hover {
  transform: translateY(-1px);
  border-color: #3a4050;
}

/* Memory clickable items */
.mem-item-clickable {
  transition: background 0.15s ease;
  padding-left: 8px;
  padding-right: 8px;
  border-radius: 6px;
  margin: 0 -8px;
}
.mem-item-clickable:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* System section toggle */
.system-toggle {
  cursor: pointer;
  user-select: none;
}
.system-toggle:hover {
  background: rgba(255, 255, 255, 0.02);
}
#system-chevron {
  transition: transform 0.25s ease;
}

/* Toast container */
#toast-container {
  z-index: 9999;
}

/* Modal backdrop override for dark theme */
.modal-backdrop {
  background: rgba(0, 0, 0, 0.7) !important;
}

/* Login */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.login-card {
  max-width: 380px;
  width: 100%;
}
.login-card .card-body {
  padding: 2rem;
}
.login-card h2 {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 0.25rem;
}
.login-card .subtitle {
  text-align: center;
  color: var(--sc-text-secondary);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

/* Fade-in animation */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in {
  animation: fadeInUp 0.3s ease forwards;
}

/* Section spacing */
.section-card {
  margin-bottom: 0.75rem;
}

/* Pull to refresh indicator */
.ptr-indicator {
  text-align: center;
  padding: 8px;
  color: var(--sc-text-secondary);
  font-size: 0.8rem;
  transition: transform 0.2s ease, opacity 0.2s ease;
  opacity: 0;
}
.ptr-indicator.visible {
  opacity: 1;
}

/* Refresh button pulse */
.refresh-pulse {
  animation: pulse 2s ease infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(88, 166, 255, 0); }
  50% { box-shadow: 0 0 0 4px rgba(88, 166, 255, 0.3); }
}

/* Last update bar */
.update-bar {
  font-size: 0.75rem;
  color: var(--sc-text-secondary);
  text-align: center;
  padding: 0.75rem;
}

/* Raw output for modals */
.raw-output {
  background: #0d1117;
  border: 1px solid var(--sc-border);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.75rem;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--sc-text-secondary);
  line-height: 1.6;
}

/* Mobile tweaks */
@media (max-width: 576px) {
  .kpi-value {
    font-size: 1.15rem;
  }
  .kpi-icon {
    font-size: 1.2rem;
  }
  .container-fluid {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  .card-body {
    padding: 0.75rem;
  }
  .section-card .card-header {
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
  }
  /* Prevent horizontal scroll */
  body {
    overflow-x: hidden;
  }
  /* Full width buttons on mobile */
  .btn-sm {
    font-size: 0.8rem;
  }
}

/* Smooth scroll */
html {
  scroll-behavior: smooth;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--sc-bg);
}
::-webkit-scrollbar-thumb {
  background: var(--sc-border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3a4050;
}

/* Focus styles for accessibility */
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
  outline: 2px solid var(--sc-accent);
  outline-offset: 2px;
}
