/* AI Hub POC — SPA scaffold styles
 * Brand tokens copied from Joujik/ai-hub:src/ui/styles.css.html (production).
 * RTL Hebrew first.
 */

:root {
  --pink: #FF6B9D;
  --purple: #C471ED;
  --pink-deep: #E94B8A;
  --purple-deep: #A855F7;
  --grad: linear-gradient(135deg, #FF6B9D 0%, #C471ED 100%);
  --grad-soft: linear-gradient(135deg, #FFE4F0 0%, #F3E5FF 100%);

  --bg: #FDF2F8;
  --surface: #FFFFFF;
  --surface-2: #FCEAF3;
  --ink: #1F1530;
  --ink-soft: #4A3859;
  --muted: #7C6B8E;
  --line: rgba(196, 113, 237, 0.18);

  --danger: #d83b3b;
  --success: #2e8b57;

  --shadow-rosy: 0 14px 40px -16px rgba(233, 75, 138, 0.32);
  --shadow-tight: 0 2px 8px rgba(31, 21, 48, 0.06);

  --radius: 14px;
  --gap: 16px;

  --hebrew: 'Heebo', 'Assistant', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; color: var(--ink); }
body {
  font-family: var(--hebrew);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    radial-gradient(ellipse 80% 60% at 80% 0%, rgba(196, 113, 237, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse 70% 50% at 0% 100%, rgba(255, 107, 157, 0.16) 0%, transparent 55%),
    var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Floating mesh blobs */
.bg-blobs { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.blob {
  position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: 0.45;
  animation: drift 18s ease-in-out infinite alternate;
}
.blob.b1 { width: 460px; height: 460px; background: var(--pink);   top: -120px; right: -80px; }
.blob.b2 { width: 380px; height: 380px; background: var(--purple); bottom: -140px; left: -100px; animation-duration: 22s; animation-delay: -4s; }
@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(40px, -30px) scale(1.08); }
  100% { transform: translate(-30px, 40px) scale(0.96); }
}

/* ───────── Login screen ───────── */
.login-screen, .forbidden-screen {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 48px 40px;
  max-width: 460px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-rosy);
}
.login-mascot {
  width: 96px; height: 96px;
  border-radius: 50%;
  margin-bottom: 14px;
  box-shadow: var(--shadow-rosy);
}
.login-card h1 {
  margin: 0 0 6px;
  font-size: 28px; font-weight: 800;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.login-sub { color: var(--ink-soft); margin: 0 0 24px; font-size: 14px; }
.login-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 28px; border-radius: 999px;
  background: var(--grad); color: #fff; border: 0;
  font-family: inherit; font-weight: 800; font-size: 15px;
  cursor: pointer;
  box-shadow: var(--shadow-rosy);
  transition: transform 0.2s;
}
.login-btn:hover { transform: translateY(-2px); }
.login-btn.outlined { background: transparent; color: var(--ink); border: 1.5px solid var(--line); box-shadow: none; }
.login-btn .arr { transition: transform 0.2s; }
.login-btn:hover .arr { transform: translateX(-3px); }
.login-hint { color: var(--muted); font-size: 12px; margin: 18px 0 0; }
.login-status { color: var(--danger); font-size: 13px; min-height: 18px; margin: 12px 0 0; }
.forbidden-note { color: var(--ink-soft); font-size: 13px; margin: 14px 0 22px; }

/* ───────── App shell ───────── */
.app-shell {
  position: relative; z-index: 1;
  display: grid;
  grid-template-rows: 64px 1fr;
  grid-template-columns: 240px 1fr;
  grid-template-areas: "header header" "nav main";
  min-height: 100vh;
}

/* Glass header */
.app-header {
  grid-area: header;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  background: rgba(253, 242, 248, 0.78);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px dashed var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: -0.02em; font-size: 16px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 11px;
  object-fit: cover;
  box-shadow: var(--shadow-rosy);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text small { font-weight: 600; color: var(--muted); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }

.header-controls { display: flex; align-items: center; gap: 14px; }

.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 14px 5px 5px;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  box-shadow: var(--shadow-tight);
  color: var(--ink-soft); font-size: 13px; font-weight: 600;
}
.user-chip__avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 14px;
  background: var(--grad);
  flex-shrink: 0;
  text-transform: uppercase;
}
.user-chip__role {
  font-size: 11px; padding: 3px 10px; border-radius: 999px;
  background: var(--grad); color: #fff; font-weight: 800; letter-spacing: 0.04em;
}
.icon-btn {
  width: 38px; height: 38px;
  border: 1px solid var(--line); background: #fff;
  border-radius: 50%; cursor: pointer;
  font-size: 16px; color: var(--ink-soft);
  transition: background 0.18s, transform 0.18s;
}
.icon-btn:hover { background: var(--surface-2); transform: rotate(8deg); }

/* Side nav */
.app-nav {
  grid-area: nav;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-left: 1px dashed var(--line);
  padding: 20px 14px;
}
.nav-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  padding: 10px 14px; border-radius: 10px;
  cursor: pointer; color: var(--ink-soft); font-weight: 600;
  transition: background 0.18s ease, color 0.18s ease;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--grad); color: #fff; box-shadow: var(--shadow-rosy); }
.nav-item .badge {
  background: var(--danger); color: #fff;
  border-radius: 999px; padding: 2px 8px;
  font-size: 11px; font-weight: 800;
}
.nav-item.active .badge { background: #fff; color: var(--pink-deep); }

/* Hide admin-only UI for non-admins */
body[data-role="user"] .admin-only { display: none !important; }

/* Main */
.app-main {
  grid-area: main;
  padding: 28px 36px 80px;
  overflow-x: hidden;
}
.view { animation: fade-in 0.25s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.view-toolbar { display: flex; align-items: center; justify-content: space-between; margin: 0 0 22px; }
.view-toolbar h2 { font-size: 22px; font-weight: 800; margin: 0; letter-spacing: -0.02em; }

.btn-primary {
  background: var(--grad); color: #fff; border: 0;
  padding: 9px 18px; border-radius: 999px;
  font-family: inherit; font-weight: 800; font-size: 13px;
  cursor: pointer; box-shadow: var(--shadow-rosy);
  transition: transform 0.2s;
}
.btn-primary:hover { transform: translateY(-2px); }

/* Grid + cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.loading {
  grid-column: 1/-1;
  padding: 16px;
  color: var(--muted);
  font-size: 14px;
}
.empty {
  grid-column: 1/-1;
  text-align: center;
  padding: 56px 16px;
  color: var(--muted);
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.4);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty__avatar {
  width: 96px; height: 96px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow-rosy);
  border: 3px solid #fff;
  background: var(--grad-soft);
}
.empty__title { color: var(--ink); font-weight: 700; font-size: 16px; }
.empty__hint { color: var(--muted); font-size: 13px; max-width: 320px; }

/* Card */
.card {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow-tight);
  display: flex; flex-direction: column; gap: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover { transform: translateY(-2px); border-color: rgba(196, 113, 237, 0.4); box-shadow: var(--shadow-rosy); }
.card__status-row { margin: -2px 0 6px; }
.card__status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.04em;
}
.card__status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }
.card__status-pill--pending { background: rgba(251, 188, 4, 0.18); color: #B07700; }
.card__status-pill--pending::before { background: #FBBC04; }
.card--pending {
  border-left: 3px solid #FBBC04;
  background: linear-gradient(180deg, rgba(255, 248, 226, 0.6), #fff 24%);
}
.card__title { font-weight: 700; font-size: 15px; color: var(--ink); }
.card__desc { color: var(--muted); font-size: 13px; min-height: 36px; margin: 0; }
.card__meta { color: var(--muted); font-size: 12px; display: flex; gap: 10px; align-items: center; }
.card__creator { display: inline-flex; align-items: center; gap: 6px; }
.card__creator-dot {
  width: 18px; height: 18px; border-radius: 50%;
  display: inline-grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 10px;
  flex-shrink: 0; text-transform: uppercase;
}
.card__like-btn {
  border: none; background: transparent; padding: 4px;
  color: var(--muted); cursor: pointer; font: inherit;
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 999px;
}
.card__like-btn:hover { color: var(--pink-deep); }
.card__like-btn.is-liked { color: var(--pink-deep); }
.card__actions { display: flex; gap: 8px; margin-top: auto; align-items: center; flex-wrap: wrap; }
.card__actions-spacer { flex: 1; }

/* Btn (used inside cards + modals) */
.btn {
  border: 1px solid var(--line); background: #fff;
  padding: 9px 16px; border-radius: 999px;
  font: inherit; font-weight: 700; color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-tight);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 14px -8px rgba(196, 113, 237, .35); }
.btn--primary {
  background: var(--grad); color: #fff; border-color: transparent;
  box-shadow: var(--shadow-rosy);
}
.btn--primary:hover { box-shadow: 0 18px 40px -14px rgba(233, 75, 138, 0.55); }
.btn--danger { color: var(--danger); border-color: var(--danger); background: #fff; }

.muted { color: var(--muted); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(31, 21, 48, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: #fff; border-radius: var(--radius);
  padding: 28px; min-width: 420px; max-width: 600px;
  box-shadow: 0 32px 80px rgba(31, 21, 48, 0.25);
}
.modal__title {
  font-weight: 800; font-size: 18px; margin: 0 0 16px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.modal__field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.modal__field label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.modal__field small { font-size: 11.5px; }
.modal__field[hidden] { display: none; }
.modal__actions { display: flex; gap: 8px; justify-content: flex-start; margin-top: 18px; }

.input, .textarea, .select {
  border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; font: inherit; background: #fff;
  width: 100%; color: var(--ink);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--purple);
  box-shadow: 0 0 0 4px rgba(196, 113, 237, 0.14);
}
.textarea { min-height: 120px; resize: vertical; font-family: 'SF Mono', Menlo, monospace; }

.detail__meta {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  margin: -4px 0 12px;
  color: var(--muted); font-size: 12.5px;
}
.detail__pill {
  background: var(--grad-soft); color: var(--purple-deep);
  padding: 2px 10px; border-radius: 999px; font-weight: 700;
}
.detail__desc { margin: 0 0 14px; line-height: 1.6; }
.detail__body {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px;
  font-family: 'SF Mono', Menlo, monospace; font-size: 12.5px;
  color: var(--ink); white-space: pre-wrap; word-break: break-word;
  max-height: 320px; overflow: auto;
  margin: 0 0 14px;
}

/* Admin allow-list view */
.admin-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  max-width: 1080px;
}
.admin-card { padding: 22px; }
.admin-card h3 { margin: 0 0 10px; font-size: 15px; font-weight: 800; color: var(--ink); }
.allowed-list {
  list-style: none; padding: 0; margin: 8px 0 0;
  display: flex; flex-direction: column; gap: 6px;
  max-height: 360px; overflow: auto;
}
.allowed-list li {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface-2);
  border-radius: 10px; padding: 8px 12px;
  font-size: 13px; color: var(--ink);
}
.allowed-list li.muted { background: transparent; color: var(--muted); justify-content: flex-start; }
.allowed-list .remove-btn {
  border: 0; background: transparent;
  color: var(--danger); cursor: pointer;
  font-size: 16px; padding: 4px 8px; border-radius: 50%;
  font-family: inherit;
}
.allowed-list .remove-btn:hover { background: rgba(216, 59, 59, 0.12); }
.allowed-list .self-tag {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--grad); color: #fff; font-weight: 800;
}
@media (max-width: 760px) {
  .admin-grid { grid-template-columns: 1fr; }
}

/* Hero (about view) */
.hero h1 { font-size: 32px; font-weight: 800; margin: 0 0 10px; letter-spacing: -0.02em; }
.hero h1 span {
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { color: var(--ink-soft); font-size: 15px; margin: 0 0 28px; max-width: 600px; }
.hero-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  max-width: 800px;
}
.hero-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 20px;
  text-align: start;
  cursor: pointer;
  font-family: inherit;
  display: flex; flex-direction: column; gap: 6px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.hero-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-rosy); border-color: transparent; }
.hero-card__icon { font-size: 28px; }
.hero-card strong { font-size: 16px; font-weight: 800; }
.hero-card span:not(.hero-card__icon) { color: var(--muted); font-size: 13px; }

/* Toast stack */
.toast-stack {
  position: fixed; bottom: 24px; left: 24px; right: auto;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 100;
  pointer-events: none;
}
.toast {
  background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-rosy);
  pointer-events: auto;
  animation: toast-in 0.25s ease;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }
@keyframes toast-in { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Mobile */
@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; grid-template-areas: "header" "nav" "main"; }
  .app-nav { border-left: 0; border-bottom: 1px dashed var(--line); padding: 12px; }
  .nav-list { flex-direction: row; overflow-x: auto; gap: 6px; }
  .nav-item { white-space: nowrap; }
  .app-main { padding: 18px 16px 64px; }
}
