/* ─────────────────────────────────────────────────────────────────────────────
   app.css — shared styles for "מתחם למידה חוויתי" (RTL, mobile-first)
   ───────────────────────────────────────────────────────────────────────────── */
:root {
  --accent: #4f46e5;
  --accent-dark: #3730a3;
  --bg: #eef2ff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Segoe UI', 'Rubik', Arial, sans-serif;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-tap-highlight-color: rgba(79, 70, 229, 0.12);
  line-height: 1.5;
}

img { max-width: 100%; height: auto; }

/* tap targets + iOS double-tap delay */
button, .btn-primary, .btn-secondary, .btn-logout, .gbtn, .tile {
  touch-action: manipulation;
}
button, input, select, textarea { font-family: inherit; font-size: 16px; }

a { color: var(--accent); }

/* ─── Auth pages (login / pending) ─── */
.page-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, var(--bg) 0%, #fff 100%);
}
.auth-wrap { width: 100%; display: flex; justify-content: center; }
.card {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
  padding: 40px 28px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}
.brand { font-size: 44px; margin-bottom: 6px; }
.card h1 { margin: 0 0 8px; color: var(--accent); font-size: 24px; }
.sub { color: var(--muted); font-size: 15px; margin: 0 0 26px; }

.gbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff;
  color: var(--text);
  border: 1px solid #dadce0;
  border-radius: 10px;
  padding: 13px 22px;
  min-height: 48px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow 0.2s;
  width: 100%;
}
.gbtn:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); }
.gbtn:disabled { opacity: 0.6; cursor: wait; }
.gbtn svg { width: 20px; height: 20px; flex-shrink: 0; }

.msg {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  display: none;
  text-align: right;
}
.msg.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.msg.pending { background: #fefce8; color: #854d0e; border: 1px solid #fde68a; }
.msg.success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

.dev-note {
  margin-top: 16px; padding: 10px 12px; border-radius: 10px;
  background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa;
  font-size: 13px;
}
.legal { margin-top: 22px; font-size: 12px; color: #9ca3af; line-height: 1.6; }

.btn-secondary {
  display: inline-block; margin-top: 14px; padding: 12px 20px;
  min-height: 44px; border-radius: 10px; border: 1px solid var(--border);
  color: var(--accent); text-decoration: none; font-weight: 600;
}

/* ─── Top bar (home / admin) ─── */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  flex-wrap: wrap;
}
.logo { font-weight: 700; font-size: 18px; color: var(--accent); }
.user-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-tag { color: var(--muted); font-size: 13px; word-break: break-all; }
.nav-admin {
  text-decoration: none; font-weight: 600; font-size: 14px;
  padding: 8px 12px; min-height: 44px; display: inline-flex; align-items: center;
}
.btn-logout {
  background: #fff; color: var(--danger);
  border: 1px solid #fecaca; border-radius: 9px;
  padding: 9px 16px; min-height: 44px; font-weight: 600; cursor: pointer;
}
.btn-logout:hover { background: #fef2f2; }

/* ─── Home ─── */
.container { max-width: 880px; margin: 24px auto; padding: 0 16px; }
.welcome { text-align: center; margin-bottom: 28px; }
.welcome h1 { font-size: 26px; margin: 0 0 8px; }
.lead { color: var(--muted); font-size: 16px; margin: 0 auto; max-width: 600px; }

.tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.tile {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.12s, box-shadow 0.12s;
}
.tile:not(.disabled):hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.07); }
.tile.disabled { opacity: 0.55; cursor: default; }
.tile-icon { font-size: 34px; }
.tile-title { font-weight: 700; font-size: 16px; }
.tile-sub { font-size: 12px; color: var(--muted); }

/* ─── Admin panels ─── */
.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 18px;
}
.panel h2 { margin: 0 0 14px; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.badge {
  background: var(--accent); color: #fff; border-radius: 999px;
  font-size: 13px; padding: 2px 9px; min-width: 22px; text-align: center;
}
.rows { display: flex; flex-direction: column; gap: 8px; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

.urow {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 11px 12px; border: 1px solid var(--border);
  border-radius: 10px; flex-wrap: wrap;
}
.urow .email { font-weight: 600; direction: ltr; text-align: left; word-break: break-all; }
.urow .meta { font-size: 12px; color: var(--muted); }
.urow .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tag-lock { font-size: 12px; color: var(--muted); }
.tag-role { font-size: 11px; background: #eef2ff; color: var(--accent); padding: 2px 8px; border-radius: 999px; }

.btn-primary {
  background: var(--accent); color: #fff; border: none; border-radius: 9px;
  padding: 10px 16px; min-height: 44px; font-weight: 600; cursor: pointer;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-approve { background: var(--ok); color: #fff; border: none; border-radius: 9px; padding: 9px 14px; min-height: 44px; font-weight: 600; cursor: pointer; }
.btn-reject, .btn-revoke { background: #fff; color: var(--danger); border: 1px solid #fecaca; border-radius: 9px; padding: 9px 14px; min-height: 44px; font-weight: 600; cursor: pointer; }

.add-row { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.add-row input { flex: 1; min-width: 200px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 9px; }

.rows.log .urow { font-size: 13px; }
.log .status-success { color: var(--ok); font-weight: 600; }
.log .status-fail { color: var(--danger); font-weight: 600; }
.log .ua { font-size: 11px; color: var(--muted); word-break: break-all; }

/* ─── Breakpoints: 768 / 540 / 380 ─── */
@media (max-width: 768px) {
  .container { margin: 16px auto; }
  .welcome h1 { font-size: 23px; }
}
@media (max-width: 540px) {
  .topbar-inner { padding: 10px 12px; }
  .logo { font-size: 16px; }
  .card { padding: 32px 20px; }
  .card h1 { font-size: 21px; }
  .welcome h1 { font-size: 20px; }
  .urow { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 380px) {
  .tiles { grid-template-columns: 1fr; }
  .user-tag { display: none; }
  .tile { min-height: 100px; }
}
