/* RaysX WAF -- 2026 modern UI layer (bento grid, soft cards, refined chrome).
   Loaded after the base theme; scoped to avoid breaking existing components. */

:root {
  --waf-accent: #14b8a6;          /* teal */
  --waf-accent-strong: #0d9488;
  --waf-ink: #0f172a;
  --waf-muted: #64748b;
  --waf-line: #eef1f5;
  --waf-bg: #f7f8fa;
  --waf-card-radius: 18px;
  --waf-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .04);
  --waf-shadow-md: 0 6px 24px -8px rgba(16, 24, 40, .12), 0 2px 6px rgba(16, 24, 40, .05);
}

/* ---- Canvas ---- */
body { background: var(--waf-bg); color: var(--waf-ink); -webkit-font-smoothing: antialiased; }
.app-content { background: radial-gradient(1200px 600px at 100% -10%, rgba(20,184,166,.05), transparent 60%), var(--waf-bg); }
main.p-6 { padding: 1.5rem 1.75rem; }

/* ---- Sidebar ---- */
.app-menu {
  background: #fff;
  border-right: 1px solid var(--waf-line);
  display: flex;
  flex-direction: column;
}

.logo-box {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--waf-line);
  flex-shrink: 0;
  display: block;
}

.app-menu > .logo-box {
  height: auto;
  min-height: 72px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.brand-wordmark {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--waf-ink);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
}

.brand-lockup--sidebar {
  width: 100%;
}

.brand-lockup--sidebar .brand-logo-image {
  width: 2.5rem !important;
  height: 2.5rem !important;
  max-width: 2.5rem !important;
  max-height: 2.5rem !important;
}

.brand-lockup--sidebar .brand-wordmark {
  max-width: 160px;
  font-size: .86rem;
  line-height: 1.15;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.brand-lockup--compact .brand-wordmark {
  max-width: 180px;
  font-size: .9rem;
}

.brand-logo-image {
  display: block;
  height: 2.25rem;
  max-width: 3rem;
  object-fit: contain;
  object-position: left center;
  flex: 0 0 auto;
}

.brand-logo-image--login {
  height: 3rem;
  max-width: 220px;
}

.brand-login-lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  text-align: center;
}

.brand-mark {
  flex: 0 0 auto;
}

.sidebar-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.sidebar-shell [data-simplebar] {
  flex: 1;
}

.menu {
  padding: 0.35rem 0 0.75rem;
}

.menu > .menu-item {
  padding: 0 0.75rem !important;
}

.menu-title {
  font-size: .65rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #94a3b8;
  font-weight: 600;
  padding: 0.85rem 1rem 0.3rem;
  margin: 0;
}

.menu .menu-item .menu-link {
  position: relative;
  border-radius: 10px;
  margin: 1px 0;
  padding: 0.55rem 0.75rem 0.55rem 0.9rem;
  gap: 0.65rem;
  color: #64748b !important;
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.25;
  background-color: transparent !important;
  transition: background .15s ease, color .15s ease;
}

.menu .menu-item .menu-link:hover,
.menu > .menu-item > .menu-link:hover {
  background-color: #f8fafc !important;
  color: var(--waf-ink) !important;
}

.menu .menu-item .menu-link .menu-icon {
  width: 1.35rem;
  height: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.menu .menu-item .menu-link .menu-icon i {
  font-size: 1.15rem;
  color: #94a3b8;
  transition: color .15s ease;
}

.menu .menu-item .menu-link:hover .menu-icon i {
  color: #64748b;
}

/* Active: soft gray + left accent (moodboard style) */
.menu .menu-item .menu-link.active,
.menu > .menu-item > .menu-link.active {
  background-color: #f1f5f9 !important;
  color: var(--waf-ink) !important;
  font-weight: 600;
}

.menu .menu-item .menu-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--waf-accent-strong);
}

.menu .menu-item .menu-link.active .menu-icon i {
  color: var(--waf-accent-strong) !important;
}

.sidebar-footer {
  flex-shrink: 0;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--waf-line);
  background: #fff;
}

.sidebar-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: rgba(20, 184, 166, .12);
  color: var(--waf-accent-strong);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ---- Topbar ---- */
.app-header {
  background: rgba(255,255,255,.8); backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--waf-line);
}

/* ---- Cards (bento) ---- */
.card, .bento-card {
  background: #fff; border: 1px solid var(--waf-line);
  border-radius: var(--waf-card-radius); box-shadow: var(--waf-shadow);
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.bento-card { padding: 1.15rem 1.25rem; }
.bento-card.interactive:hover { box-shadow: var(--waf-shadow-md); transform: translateY(-2px); border-color: #e3e8ef; }
.card-title { font-weight: 600; color: var(--waf-ink); }

/* ---- Login ---- */
.login-page {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(20, 184, 166, .11), transparent 60%),
    linear-gradient(180deg, #f8fafc 0%, var(--waf-bg) 100%);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--waf-ink);
}

.login-shell {
  min-height: 100vh;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 3rem 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-card {
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--waf-line);
  border-radius: 24px;
  box-shadow: 0 20px 60px -32px rgba(15, 23, 42, .45), var(--waf-shadow);
  padding: 2rem;
}

.login-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.login-brand a {
  color: inherit;
}

.login-brand .brand-login-lockup {
  gap: .55rem;
}

.login-brand .brand-logo-image--login {
  height: 3.25rem;
  max-width: 5rem;
}

.login-brand .brand-wordmark {
  max-width: 320px;
  white-space: normal;
  font-size: .95rem;
  line-height: 1.25;
}

.login-heading {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-heading h1 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.15;
  letter-spacing: -.03em;
  font-weight: 750;
}

.login-heading p {
  margin: .55rem auto 0;
  max-width: 340px;
  color: var(--waf-muted);
  font-size: .9rem;
  line-height: 1.5;
}

.login-alert {
  border: 1px solid rgba(244, 63, 94, .18);
  background: rgba(255, 241, 242, .95);
  color: #be123c;
  border-radius: 14px;
  padding: .75rem .85rem;
  margin-bottom: 1rem;
  font-size: .88rem;
  font-weight: 500;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-field label {
  display: block;
  margin-bottom: .45rem;
  color: #334155;
  font-size: .84rem;
  font-weight: 650;
}

.login-form .form-input {
  width: 100%;
  height: 2.85rem;
  border: 1px solid #dbe4ee;
  border-radius: 14px;
  background: #f8fafc;
  color: var(--waf-ink);
  padding: .65rem .85rem;
  font-size: .95rem;
  outline: none;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.login-form .form-input:focus {
  background: #fff;
  border-color: rgba(13, 148, 136, .55);
  box-shadow: 0 0 0 4px rgba(20, 184, 166, .12);
}

.login-field-error {
  margin: .4rem 0 0;
  color: #e11d48;
  font-size: .8rem;
}

.login-submit {
  width: 100%;
  height: 2.95rem;
  margin-top: .25rem;
  border: 0;
  border-radius: 14px;
  background: var(--waf-accent-strong);
  color: #fff;
  font-size: .95rem;
  font-weight: 750;
  cursor: pointer;
  box-shadow: 0 12px 24px -14px rgba(13, 148, 136, .8);
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.login-submit:hover {
  opacity: .95;
  transform: translateY(-1px);
  box-shadow: 0 16px 28px -16px rgba(13, 148, 136, .9);
}

.login-footer {
  margin: 1.25rem 0 0;
  color: #94a3b8;
  font-size: .78rem;
  text-align: center;
}

@media (max-width: 520px) {
  .login-shell {
    padding: 1rem;
    justify-content: flex-start;
  }

  .login-card {
    padding: 1.4rem;
    border-radius: 20px;
  }
}

/* ---- Domain detail ---- */
.domain-hero {
  background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
  border: 1px solid var(--waf-line);
  border-radius: 22px;
  box-shadow: var(--waf-shadow);
  padding: 1.15rem;
}

.domain-hero__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.domain-eyebrow {
  margin: 0 0 .25rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--waf-muted);
}

.domain-title {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.1;
  letter-spacing: -.03em;
  font-weight: 750;
  color: var(--waf-ink);
}

.domain-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .85rem;
  margin-top: .65rem;
  color: var(--waf-muted);
  font-size: .85rem;
}

.domain-meta span {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-width: 0;
  max-width: 100%;
}

.domain-action {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  border: 1px solid #dbe4ee;
  border-radius: 999px;
  background: #fff;
  color: var(--waf-ink);
  font-weight: 650;
  font-size: .85rem;
  padding: .55rem .8rem;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.domain-action:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.domain-status-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  margin-top: 1rem;
}

.domain-status-pill {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  border-radius: 999px;
  padding: .35rem .65rem;
  font-size: .76rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.domain-status-dot {
  width: .45rem;
  height: .45rem;
  border-radius: 999px;
  background: currentColor;
}

.domain-status-pill--info {
  background: rgba(59, 130, 246, .09);
  border-color: rgba(59, 130, 246, .14);
  color: #2563eb;
}

.domain-status-pill--success {
  background: rgba(16, 185, 129, .1);
  border-color: rgba(16, 185, 129, .18);
  color: #059669;
}

.domain-status-pill--danger {
  background: rgba(239, 68, 68, .1);
  border-color: rgba(239, 68, 68, .18);
  color: #dc2626;
}

.domain-status-pill--muted {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #64748b;
}

.domain-tabs {
  display: flex;
  gap: .35rem;
  margin-top: 1rem;
  padding: .35rem;
  border: 1px solid #e8edf4;
  border-radius: 16px;
  background: #f1f5f9;
  overflow-x: auto;
  scrollbar-width: thin;
}

.domain-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 12px;
  color: #64748b;
  font-size: .84rem;
  font-weight: 650;
  padding: .55rem .75rem;
  white-space: nowrap;
}

.domain-tab:hover {
  color: var(--waf-ink);
  background: rgba(255, 255, 255, .65);
}

.domain-tab.active {
  background: #fff;
  color: var(--waf-accent-strong);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
}

.domain-detail-content {
  padding: .25rem;
}

@media (max-width: 720px) {
  .domain-hero__top {
    flex-direction: column;
  }

  .domain-action {
    width: 100%;
    justify-content: center;
  }
}

/* ---- Bento grid ---- */
.bento-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1rem; }
.col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; } .col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; } .col-8 { grid-column: span 8; } .col-12 { grid-column: span 12; }
@media (max-width: 1100px) {
  .col-3, .col-4, .col-5 { grid-column: span 6; }
  .col-6, .col-7, .col-8 { grid-column: span 12; }
}
@media (max-width: 640px) { .bento-grid > * { grid-column: span 12 !important; } }

/* ---- KPI ---- */
.kpi-label { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--waf-muted); font-weight: 600; }
.kpi-value { font-size: 1.9rem; line-height: 1.1; font-weight: 700; letter-spacing: -.02em; color: var(--waf-ink); }
.kpi-icon { height: 40px; width: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.pill { display: inline-flex; align-items: center; gap: .3rem; font-size: .7rem; font-weight: 600; padding: .15rem .5rem; border-radius: 999px; }
.pill-up { background: rgba(16,185,129,.12); color: #059669; }
.pill-down { background: rgba(239,68,68,.12); color: #dc2626; }
.pill-neutral { background: #f1f5f9; color: #64748b; }

/* ---- Heatmap ---- */
.heatmap { display: flex; gap: 4px; }
.heatmap-col { display: flex; flex-direction: column; gap: 4px; }
.heatmap-cell { width: 13px; height: 13px; border-radius: 4px; background: #eef1f5; }
.heatmap-cell[data-l="1"] { background: rgba(20,184,166,.25); }
.heatmap-cell[data-l="2"] { background: rgba(20,184,166,.45); }
.heatmap-cell[data-l="3"] { background: rgba(20,184,166,.7); }
.heatmap-cell[data-l="4"] { background: var(--waf-accent-strong); }

/* ---- Misc ---- */
.soft-divider { height: 1px; background: var(--waf-line); border: 0; }
.tag { font-size: .68rem; font-weight: 600; padding: .12rem .5rem; border-radius: 8px; }
.tag-crs { background: rgba(99,102,241,.1); color: #4f46e5; }
.tag-rule { background: rgba(14,165,233,.1); color: #0284c7; }
.tag-bot { background: rgba(168,85,247,.1); color: #9333ea; }
.tag-ddos { background: rgba(239,68,68,.1); color: #dc2626; }
.tag-ratelimit { background: rgba(245,158,11,.1); color: #d97706; }
.tag-iplist { background: rgba(100,116,139,.12); color: #475569; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d8dee7; border-radius: 999px; border: 3px solid var(--waf-bg); }
::-webkit-scrollbar-thumb:hover { background: #c4ccd8; }

/* Buttons get a slightly softer radius to match the bento language */
.btn { border-radius: 12px; }
.form-input, .form-select { border-radius: 10px; }
