/* =============================================================
   Warder — WoT Ajah Design System
   Wheel of Time Ajah colour palette mapped to UI semantics
   ============================================================= */

/* --- Colour tokens ------------------------------------------ */
:root {
  /* App chrome — Black Ajah (the hidden depths) */
  --w-bg:           #0c0a14;
  --w-surface:      #110e1c;
  --w-surface-2:    #17132a;
  --w-surface-3:    #1d1535;
  --w-border:       rgba(139, 92, 246, 0.10);
  --w-border-mid:   rgba(139, 92, 246, 0.20);
  --w-border-hi:    rgba(139, 92, 246, 0.38);

  /* Brand — Warder fancloth (shifting violet) */
  --w-brand:        #7c3aed;
  --w-brand-dim:    #4c1d95;
  --w-brand-text:   #c4b5fd;
  --w-brand-hover:  #5b21b6;

  /* Text — White / Gray Ajah */
  --w-text:         #e8e4f0;
  --w-text-2:       #9d8ec0;
  --w-text-3:       #4a4060;

  /* Red Ajah — security alerts, danger */
  --w-red:          #f87171;
  --w-red-bg:       #290a0a;
  --w-red-border:   rgba(220, 38, 38, 0.25);

  /* Blue Ajah — informational, links */
  --w-blue:         #93c5fd;
  --w-blue-bg:      #0d1f40;
  --w-blue-border:  rgba(59, 130, 246, 0.25);

  /* Green Ajah — healthy, online, success */
  --w-green:        #4ade80;
  --w-green-bg:     #14290f;
  --w-green-border: rgba(34, 197, 94, 0.25);

  /* Yellow Ajah — warnings, caution */
  --w-yellow:       #facc15;
  --w-yellow-bg:    #2a1f05;
  --w-yellow-border:rgba(234, 179, 8, 0.25);
}

/* --- Base ---------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--w-bg);
  color: var(--w-text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* --- App shell (sidebar layout) ----------------------------- */
.w-shell {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar ------------------------------------------------- */
.w-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--w-surface);
  border-right: 1px solid var(--w-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.w-sidebar-logo {
  padding: 20px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--w-border);
  flex-shrink: 0;
}

.w-logo-mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--w-surface-2);
  border: 1px solid var(--w-border-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.w-logo-dots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  width: 14px;
}

.w-logo-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.w-logo-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--w-text);
  letter-spacing: 0.02em;
}

.w-nav {
  padding: 12px 0;
  flex: 1;
}

.w-nav-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--w-text-3);
  padding: 10px 18px 5px;
}

.w-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  font-size: 13px;
  color: var(--w-text-2);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.12s, background 0.12s;
  white-space: nowrap;
}

.w-nav-item:hover {
  color: var(--w-text);
  background: rgba(139, 92, 246, 0.06);
}

.w-nav-item.active {
  color: var(--w-brand-text);
  background: rgba(139, 92, 246, 0.09);
  border-left-color: var(--w-brand);
}

.w-nav-item svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.w-nav-badge {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  background: #2d1a3d;
  color: var(--w-brand-text);
}

.w-nav-divider {
  height: 1px;
  background: var(--w-border);
  margin: 10px 18px;
}

.w-sidebar-user {
  padding: 14px 18px;
  border-top: 1px solid var(--w-border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.w-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #2d1a3d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--w-brand-text);
  font-weight: 600;
  flex-shrink: 0;
}

.w-avatar-name {
  font-size: 12px;
  color: var(--w-text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Main content area -------------------------------------- */
.w-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.w-topbar {
  padding: 15px 24px;
  border-bottom: 1px solid var(--w-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--w-surface);
  flex-shrink: 0;
}

.w-page-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--w-text);
}

.w-content {
  padding: 24px;
  flex: 1;
}

/* --- Panels / cards ----------------------------------------- */
.w-panel {
  background: var(--w-surface-2);
  border-radius: 10px;
  border: 1px solid var(--w-border);
  margin-bottom: 16px;
  overflow: hidden;
}

.w-panel-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--w-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.w-panel-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--w-text);
}

.w-panel-body {
  padding: 18px;
}

/* --- Form elements ------------------------------------------ */
.w-label {
  font-size: 12px;
  color: var(--w-text-2);
  display: block;
  margin-bottom: 6px;
}

.w-input {
  background: var(--w-surface);
  border: 1px solid var(--w-border-mid);
  border-radius: 7px;
  padding: 9px 13px;
  font-size: 13px;
  color: var(--w-text);
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.w-input::placeholder { color: var(--w-text-3); }

.w-input:focus {
  border-color: var(--w-brand);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

/* --- Buttons ------------------------------------------------- */
.w-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
  border: 1px solid transparent;
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
}

.w-btn svg { width: 14px; height: 14px; }

.w-btn-sm {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: 6px;
  gap: 5px;
}
.w-btn-sm svg { width: 12px; height: 12px; }

.w-btn-primary {
  background: var(--w-brand-dim);
  color: #ddd6fe;
  border-color: var(--w-border-hi);
}
.w-btn-primary:hover { background: var(--w-brand-hover); }

.w-btn-ghost {
  background: transparent;
  color: var(--w-text-2);
  border-color: var(--w-border-mid);
}
.w-btn-ghost:hover { background: var(--w-surface-3); color: var(--w-text); }

.w-btn-danger {
  background: var(--w-red-bg);
  color: var(--w-red);
  border-color: var(--w-red-border);
}
.w-btn-danger:hover { border-color: var(--w-red); }

.w-btn-success {
  background: var(--w-green-bg);
  color: var(--w-green);
  border-color: var(--w-green-border);
}
.w-btn-success:hover { border-color: var(--w-green); }

button:disabled, .w-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* --- Site rows ---------------------------------------------- */
.w-site-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--w-border);
  transition: background 0.1s;
}

.w-site-row:last-child { border-bottom: none; }
.w-site-row:hover { background: rgba(139, 92, 246, 0.04); }

.w-site-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.w-site-thumb {
  width: 72px;
  height: 44px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid var(--w-border-mid);
  flex-shrink: 0;
  background: var(--w-surface-3);
  cursor: pointer;
  transition: opacity 0.12s;
}
.w-site-thumb:hover { opacity: 0.8; }

.w-site-info {
  flex: 1;
  min-width: 0;
}

.w-site-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--w-text);
  text-decoration: none;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.1s;
}
.w-site-name:hover { color: var(--w-brand-text); }

.w-site-url {
  font-size: 11px;
  color: var(--w-text-3);
  display: block;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  transition: color 0.1s;
}
.w-site-url:hover { color: var(--w-blue); }

.w-site-meta {
  font-size: 11px;
  color: var(--w-text-3);
  margin-top: 2px;
}

/* --- Score pills -------------------------------------------- */
.w-scores { display: flex; gap: 4px; flex-shrink: 0; }

.w-score {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
}

.w-score-green  { background: var(--w-green-bg);  color: var(--w-green);  }
.w-score-yellow { background: var(--w-yellow-bg); color: var(--w-yellow); }
.w-score-red    { background: var(--w-red-bg);    color: var(--w-red);    }
.w-score-violet { background: var(--w-surface-3); color: var(--w-brand-text); }
.w-score-none   { color: var(--w-text-3); font-size: 11px; }

/* --- Badges -------------------------------------------------- */
.w-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.w-badge-green  { background: var(--w-green-bg);  color: var(--w-green);  }
.w-badge-red    { background: var(--w-red-bg);    color: var(--w-red);    }
.w-badge-yellow { background: var(--w-yellow-bg); color: var(--w-yellow); }
.w-badge-blue   { background: var(--w-blue-bg);   color: var(--w-blue);   }
.w-badge-violet { background: var(--w-surface-3); color: var(--w-brand-text); }
.w-badge-gray   { background: transparent;        color: var(--w-text-3); }

/* --- HTTP / scan status colour helpers (used by JS too) ----- */
.http-200, .status-ok  { color: var(--w-green); }
.http-300              { color: var(--w-blue);  }
.http-400, .http-500   { color: var(--w-red);   }
.http-0                { color: var(--w-text-3);}
.status-flagged        { color: var(--w-red);   }
.status-error          { color: var(--w-yellow);}
.status-pending        { color: var(--w-text-3);}

/* Tailwind compat: classes set dynamically by JS */
.text-green-400  { color: var(--w-green);  }
.text-red-400    { color: var(--w-red);    }
.text-yellow-400 { color: var(--w-yellow); }
.text-blue-400   { color: var(--w-blue);   }
.text-gray-400   { color: var(--w-text-2); }
.text-gray-500   { color: var(--w-text-3); }
.animate-pulse   { animation: w-pulse 2s cubic-bezier(0.4,0,0.6,1) infinite; }
@keyframes w-pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* --- Pagination --------------------------------------------- */
.w-page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--w-text-2);
  background: var(--w-surface);
  border: 1px solid var(--w-border);
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
}

.w-page-link:hover { background: var(--w-surface-3); color: var(--w-text); }
.w-page-link.active { background: var(--w-brand-dim); color: var(--w-brand-text); border-color: var(--w-border-hi); }

/* --- Alert / flash messages --------------------------------- */
.w-alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid;
}

.w-alert-red    { background: var(--w-red-bg);    color: var(--w-red);    border-color: var(--w-red-border);    }
.w-alert-green  { background: var(--w-green-bg);  color: var(--w-green);  border-color: var(--w-green-border);  }
.w-alert-yellow { background: var(--w-yellow-bg); color: var(--w-yellow); border-color: var(--w-yellow-border); }
.w-alert-blue   { background: var(--w-blue-bg);   color: var(--w-blue);   border-color: var(--w-blue-border);   }

/* --- Login page --------------------------------------------- */
.w-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.w-login-card {
  width: 100%;
  max-width: 400px;
  background: var(--w-surface);
  border-radius: 14px;
  border: 1px solid var(--w-border-mid);
  padding: 36px 32px;
}

.w-login-card a {
  color: var(--w-brand-text);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.1s;
}

.w-login-card a:hover { color: var(--w-text); }

/* --- Scrollbar ---------------------------------------------- */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 92, 246, 0.18) transparent;
}
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.18); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(139,92,246,0.35); }

/* --- Responsive --------------------------------------------- */
@media (max-width: 900px) {
  .w-sidebar { display: none; }
}

@media (max-width: 700px) {
  .w-site-thumb { display: none; }
  .w-scores { display: none; }
  .w-content { padding: 16px; }
}
