/* ═══════════════════════════════════════════════════════════════════════════
   User Dashboard — Pro Layout
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Auth screens ─────────────────────────────────────────────────────────── */

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
}

.auth-wrap::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle at center, rgba(239, 68, 68, 0.08) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ─── Split-layout auth (login, register, forgot, reset, setup) ────────────── */

.auth-wrap-split {
  align-items: stretch;
  padding: 0;
  min-height: 100vh;
  overflow: hidden;
}

.auth-wrap-split::before {
  width: 900px;
  height: 900px;
  background: radial-gradient(circle at center, rgba(239, 68, 68, 0.1) 0%, transparent 55%);
}

/* Left side: hero / marketing */
.auth-hero {
  flex: 1 1 50%;
  position: relative;
  display: flex;
  align-items: center;
  padding: 60px 70px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg2) 0%, var(--bg) 100%);
  border-right: 1px solid var(--border);
}

.auth-hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.auth-hero-bg::before,
.auth-hero-bg::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  animation: float 14s ease-in-out infinite;
}

.auth-hero-bg::before {
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.4) 0%, transparent 70%);
  top: -100px;
  left: -50px;
}

.auth-hero-bg::after {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.25) 0%, transparent 70%);
  bottom: -80px;
  right: 40px;
  animation-delay: -7s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(20px, -30px) scale(1.1); }
}

.auth-hero-content {
  position: relative;
  z-index: 1;
  max-width: 520px;
  width: 100%;
  animation: fadeInLeft 600ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.hero-title {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -1.5px;
  line-height: 1.1;
  margin-bottom: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #a1a1aa 110%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  font-size: 15px;
  color: var(--text2);
  line-height: 1.65;
  margin-bottom: 32px;
  max-width: 460px;
}

.hero-bullets {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.hero-bullet {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  color: var(--text2);
  letter-spacing: -0.1px;
}

.hero-bullet-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 2px 8px rgba(239, 68, 68, 0.4);
}

.hero-services {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.hero-service-pill {
  font-size: 11px;
  font-family: var(--mono);
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  letter-spacing: -0.1px;
  box-shadow: var(--hl-top);
  transition: all var(--tr);
}
.hero-service-pill:hover {
  border-color: var(--border3);
  background: var(--bg4);
  transform: translateY(-1px);
}
.hero-service-pill span {
  color: var(--text4);
  font-weight: 500;
}

/* Right side: form */
.auth-form-side {
  flex: 1 1 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 50px;
  position: relative;
}

.auth-wrap-split .auth-card {
  max-width: 420px;
  width: 100%;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  animation: fadeInRight 600ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.auth-wrap-split .auth-card::before { display: none; }

@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.auth-card-head { margin-bottom: 28px; }

.auth-wrap-split .auth-title {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.8px;
  margin-bottom: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #d4d4d8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-wrap-split .auth-sub {
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 0;
}

/* Forgot link inline above password field */
.forgot-link {
  font-size: 11.5px;
  color: var(--red-bright);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--tr);
}
.forgot-link:hover { color: var(--red); }

/* Old (non-split) card kept for fallback */
.auth-card {
  background: var(--surface-2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  animation: cardIn 400ms cubic-bezier(0.16, 1, 0.3, 1) both;
  box-shadow: var(--shadow-xl), var(--hl-top);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(239, 68, 68, 0.5) 50%, transparent 100%);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.auth-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.6px;
  margin-bottom: 6px;
}

.auth-sub {
  color: var(--text2);
  font-size: 13.5px;
  margin-bottom: 26px;
  line-height: 1.55;
}

.auth-link-text {
  text-align: center;
  margin-top: 24px;
  font-size: 13px;
  color: var(--text2);
}
.auth-link-text a {
  color: var(--red-bright);
  font-weight: 600;
  transition: color var(--tr);
}
.auth-link-text a:hover { color: var(--red); }

/* Responsive: collapse to single column on small screens */
@media (max-width: 980px) {
  .auth-wrap-split {
    flex-direction: column;
    align-items: stretch;
  }
  .auth-hero {
    padding: 50px 40px;
    flex: 0 0 auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .hero-title { font-size: 32px; }
  .auth-form-side {
    padding: 40px 32px;
    flex: 1;
  }
}

@media (max-width: 560px) {
  .auth-hero { padding: 36px 24px; }
  .hero-title { font-size: 26px; }
  .hero-sub { font-size: 13.5px; }
  .auth-form-side { padding: 28px 20px; }
  .auth-wrap-split .auth-title { font-size: 24px; }
}

/* ─── Dashboard ────────────────────────────────────────────────────────────── */

#app {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* On auth screens, #app holds a single auth-wrap which must fill the viewport */
#app > .auth-wrap { flex: 1; }

.dash-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

/* Service card */
.service-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--tr);
  margin-bottom: 12px;
  box-shadow: var(--shadow), var(--hl-top);
}
.service-card:hover {
  border-color: var(--border3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--hl-top);
}

.service-logo {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--bg4) 0%, var(--bg3) 100%);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--red-bright);
  flex-shrink: 0;
  border: 1px solid var(--border2);
  font-size: 19px;
  letter-spacing: -1px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.service-info { flex: 1; min-width: 0; }
.service-name { font-weight: 600; margin-bottom: 3px; font-size: 14px; letter-spacing: -0.2px; }
.service-meta { font-size: 11.5px; color: var(--text4); }

/* Session row */
.session-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  transition: background var(--tr);
}
.session-row:last-child { border-bottom: none; }
.session-row:hover { background: rgba(255, 255, 255, 0.015); }

.session-icon {
  width: 36px;
  height: 36px;
  background: var(--bg3);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.session-info { flex: 1; min-width: 0; }
.session-device {
  font-weight: 500;
  font-size: 13px;
  letter-spacing: -0.1px;
}
.session-meta {
  font-size: 11.5px;
  color: var(--text4);
  margin-top: 3px;
  font-family: var(--mono);
}

/* QR */
.qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 16px 0;
}
.qr-wrap img {
  background: #fff;
  padding: 12px;
  border-radius: var(--radius);
  width: 200px;
  height: 200px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}
.qr-secret {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text2);
  background: var(--bg);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  word-break: break-all;
  text-align: center;
  border: 1px solid var(--border2);
  letter-spacing: 0.5px;
}

/* ─── Overview hero ────────────────────────────────────────────────────────── */

.overview-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px;
  background:
    linear-gradient(135deg, rgba(239, 68, 68, 0.06) 0%, transparent 60%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 22px;
  box-shadow: var(--shadow), var(--hl-top);
  position: relative;
  overflow: hidden;
}

.overview-hero::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.overview-greeting { position: relative; z-index: 1; }
.overview-greeting-label {
  font-size: 12px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
  font-weight: 600;
}
.overview-greeting-name {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.8px;
  background: linear-gradient(180deg, #ffffff 0%, #d4d4d8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.overview-status {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  z-index: 1;
}
.overview-status-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: var(--text2);
}
.overview-status-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.overview-status-icon.ok   { background: var(--success-dim); color: #4ade80; border: 1px solid rgba(16,185,129,0.3); }
.overview-status-icon.warn { background: var(--warn-dim); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.overview-status-icon.dim  { background: var(--bg3); color: var(--text4); border: 1px solid var(--border2); }

@media (max-width: 600px) {
  .overview-hero { flex-direction: column; align-items: flex-start; padding: 22px; }
  .overview-greeting-name { font-size: 26px; }
}

/* ─── Overview warnings / tips ────────────────────────────────────────────── */

.overview-warning,
.overview-tip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.overview-warning {
  background: var(--warn-dim);
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.overview-tip {
  background: var(--info-dim);
  border: 1px solid rgba(59, 130, 246, 0.25);
}
.warn-icon, .tip-icon {
  font-size: 20px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}
.warn-content, .tip-content { flex: 1; }
.warn-title, .tip-title {
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: 2px;
  color: var(--text);
}
.warn-msg { color: #fbbf24; font-size: 12.5px; }
.tip-msg  { color: #93c5fd; font-size: 12.5px; }

/* ─── Services grid on overview ───────────────────────────────────────────── */

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 18px 20px;
}

.service-card-overview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--tr);
}
.service-card-overview:hover {
  background: var(--bg4);
  border-color: var(--border2);
  transform: translateY(-1px);
}

.service-card-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background-color: var(--bg4);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid var(--border2);
  flex-shrink: 0;
  box-shadow: var(--hl-top);
}
.service-card-logo-text {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg4) 0%, var(--bg3) 100%);
  color: var(--red-bright);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.5px;
}

.service-card-info { flex: 1; min-width: 0; }
.service-card-name {
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.service-card-meta {
  font-size: 11px;
  color: var(--text4);
  margin-top: 2px;
}

/* ─── Role badge ──────────────────────────────────────────────────────────── */

.role-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-family: var(--mono);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.role-superadmin { background: linear-gradient(180deg, rgba(239,68,68,0.25), rgba(239,68,68,0.1)); color: var(--red-bright); border: 1px solid rgba(239,68,68,0.4); }
.role-admin      { background: var(--warn-dim); color: #fbbf24; border: 1px solid rgba(245,158,11,0.35); }
.role-moderator  { background: var(--purple-dim); color: #c084fc; border: 1px solid rgba(168,85,247,0.35); }
.role-user       { background: var(--bg4); color: var(--text3); border: 1px solid var(--border2); }
.go-admin-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  background: linear-gradient(135deg, var(--red-dim) 0%, rgba(239, 68, 68, 0.05) 100%);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12.5px;
  color: var(--red-bright);
  font-weight: 600;
  letter-spacing: -0.1px;
  transition: all var(--tr);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 16px rgba(239, 68, 68, 0.1);
}
.go-admin-btn:hover {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25) 0%, rgba(239, 68, 68, 0.1) 100%);
  border-color: rgba(239, 68, 68, 0.6);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 6px 16px rgba(239, 68, 68, 0.25);
}
.go-admin-btn svg { opacity: 1; }
