/* Dashboard — Native SaaS shell (study.quizzman.com/my-dashboard) */

:root {
  --dash-header-h: var(--qmf-header-h, 60px);
  --dash-bg: #faf8f5;
  --dash-surface: #ffffff;
  --dash-text: #1c1917;
  --dash-muted: #78716c;
  --dash-accent: #0d9488;
  --dash-accent-2: #6366f1;
  --dash-warm: #d97706;
  --dash-radius: 20px;
}

body.has-qmf-header {
  background: var(--dash-bg);
}

body.has-qmf-header .qmf-background {
  display: none !important;
}

/* ── Boot loading ── */
.fc-load {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: 'Inter', system-ui, sans-serif;
}

.fc-load--boot {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(254, 243, 199, 0.55), transparent 55%),
    var(--dash-bg);
}

.fc-load--boot.fade-out {
  animation: dashLoadOut 0.35s ease-out forwards;
  pointer-events: none;
}

@keyframes dashLoadOut {
  to { opacity: 0; visibility: hidden; }
}

.fc-load__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(100%, 320px);
  padding: 28px 24px 32px;
  border-radius: 20px;
  background: linear-gradient(165deg, #fff 0%, #fffbeb 45%, #f0fdfa 100%);
  border: 2px solid rgba(180, 83, 9, 0.16);
  box-shadow: 0 8px 0 rgba(180, 83, 9, 0.1), 0 20px 48px rgba(28, 25, 23, 0.08);
}

.fc-load__badge {
  width: 72px;
  height: 72px;
  padding: 6px;
  border-radius: 18px;
  background: #fff;
  border: 2px solid #d97706;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.25), 0 4px 0 rgba(217, 119, 6, 0.25);
  animation: dashLoadBadge 2.4s ease-in-out infinite;
}

@keyframes dashLoadBadge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.fc-load__logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 12px;
}

.fc-load__brand {
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #92400e;
}

.fc-load__map {
  display: block;
  width: 100%;
  height: 72px;
}

.fc-load__path-bg {
  fill: none;
  stroke: rgba(120, 113, 108, 0.16);
  stroke-width: 4;
  stroke-linecap: round;
}

.fc-load__path-fill {
  fill: none;
  stroke: url(#dashLoadGradBoot);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: dashLoadPath 2.4s ease-in-out infinite;
}

@keyframes dashLoadPath {
  0% { stroke-dashoffset: 100; opacity: 0.5; }
  45% { stroke-dashoffset: 0; opacity: 1; }
  55% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: -100; opacity: 0.5; }
}

.fc-load__node {
  fill: #d6d3d1;
  stroke: #fff;
  stroke-width: 2;
  animation: dashLoadNode 2.4s ease-in-out infinite;
}

.fc-load__node--d1 { animation-delay: 0.35s; }
.fc-load__node--d2 { animation-delay: 0.7s; }
.fc-load__node--d3 { animation-delay: 1.05s; }

@keyframes dashLoadNode {
  0%, 100% { fill: #d6d3d1; }
  25%, 45% { fill: #0d9488; }
  55% { fill: #fbbf24; }
}

.fc-load__msg {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 800;
  color: #57534e;
  animation: dashLoadMsg 1.6s ease-in-out infinite;
}

@keyframes dashLoadMsg {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

/* ── App shell ── */
.dash-app {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 16px 56px;
  min-height: calc(100dvh - var(--dash-header-h));
}

.dash-app__ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 50% at 15% 0%, rgba(251, 191, 36, 0.1), transparent 55%),
    radial-gradient(ellipse 60% 45% at 90% 8%, rgba(13, 148, 136, 0.08), transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(99, 102, 241, 0.06), transparent 50%);
}

.dash-app > * {
  position: relative;
  z-index: 1;
}

.dash-main {
  padding-top: 0 !important;
  min-height: auto !important;
}

.dash-container {
  max-width: none !important;
  padding: 0 !important;
}

/* ── Auth gate ── */
.dash-auth-gate {
  background: rgba(250, 248, 245, 0.92) !important;
  backdrop-filter: blur(12px);
}

.dash-auth-card {
  border-radius: var(--dash-radius) !important;
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.04), 0 20px 48px rgba(28, 25, 23, 0.08) !important;
}

.dash-auth-icon svg {
  stroke: var(--dash-accent);
}

/* ── Hero card ── */
.dash-shell-card {
  border-radius: var(--dash-radius);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(120, 113, 108, 0.1);
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.04), 0 16px 40px rgba(28, 25, 23, 0.06);
  overflow: hidden;
  margin-bottom: 16px;
}

.dash-hero {
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  backdrop-filter: none !important;
  padding: 20px 20px 16px !important;
  margin-bottom: 0 !important;
}

.dash-avatar {
  width: 52px !important;
  height: 52px !important;
  border-radius: 16px !important;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(13, 148, 136, 0.12)) !important;
  border: 2px solid rgba(99, 102, 241, 0.2);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.08) !important;
  color: var(--dash-accent-2) !important;
}

.dash-hero-title {
  font-size: 1.25rem !important;
  letter-spacing: -0.02em;
}

.dash-hero-title span {
  background: linear-gradient(135deg, #6366f1, #0d9488) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
}

.dash-hero-sub {
  font-size: 0.8rem !important;
  color: var(--dash-muted) !important;
}

.dash-hero-stats {
  gap: 10px !important;
}

.dash-stat {
  min-width: 68px !important;
  padding: 8px 14px !important;
  border-radius: 14px !important;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(13, 148, 136, 0.05)) !important;
  border: 1px solid rgba(99, 102, 241, 0.1);
}

.dash-stat-value {
  font-size: 1.35rem !important;
  background: linear-gradient(135deg, #6366f1, #0d9488);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Tabs ── */
.dash-tabs {
  border: none !important;
  border-top: 1px solid rgba(120, 113, 108, 0.08) !important;
  border-radius: 0 !important;
  background: rgba(250, 250, 249, 0.6) !important;
  padding: 8px !important;
  margin-bottom: 0 !important;
  position: sticky;
  top: calc(var(--dash-header-h) + 4px);
  z-index: 90;
}

.dash-tab {
  border-radius: 12px !important;
  font-size: 0.82rem !important;
}

.dash-tab.active {
  background: linear-gradient(135deg, #6366f1, #0d9488) !important;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25) !important;
}

.dash-tab svg {
  flex-shrink: 0;
}

/* ── Panels ── */
.dash-panel-wrap {
  padding: 16px 0 0;
}

.dash-panel-toolbar {
  margin-bottom: 12px;
}

.dash-select,
.dash-search-box {
  border-radius: 12px !important;
  background: #fafaf9 !important;
  border-color: rgba(120, 113, 108, 0.14) !important;
}

.qmf-btn-primary {
  border-radius: 12px !important;
  background: linear-gradient(135deg, #6366f1, #0d9488) !important;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.22);
}

/* ── Item cards ── */
.dash-item-card {
  border-radius: 16px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  border-color: rgba(120, 113, 108, 0.1) !important;
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.03);
}

.dash-item-card:hover {
  border-color: rgba(99, 102, 241, 0.35) !important;
  box-shadow: 0 8px 24px rgba(28, 25, 23, 0.08) !important;
}

.dash-item-icon {
  border-radius: 14px !important;
}

.dash-item-icon.icon-exam {
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.15), rgba(99, 102, 241, 0.1)) !important;
}

.dash-item-icon.icon-exam svg {
  stroke: #0d9488;
}

.dash-item-icon.icon-key {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(217, 119, 6, 0.12)) !important;
}

.dash-item-icon.icon-key svg {
  stroke: #d97706;
}

.dash-item-icon.icon-key-used {
  background: rgba(120, 113, 108, 0.08) !important;
}

.dash-item-icon.icon-support {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(59, 130, 246, 0.08)) !important;
}

.dash-item-icon.icon-support svg {
  stroke: #6366f1;
}

.dash-level-tag {
  border-radius: 8px !important;
  background: rgba(99, 102, 241, 0.1) !important;
  color: #6366f1 !important;
}

.dash-key-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dash-key-meta svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.dash-btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 10px !important;
}

.dash-btn-copy svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ── Key CTA ── */
.dash-key-cta {
  border-radius: var(--dash-radius) !important;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.12), rgba(217, 119, 6, 0.06)) !important;
  border-color: rgba(217, 119, 6, 0.2) !important;
}

.dash-key-cta-icon svg {
  stroke: #d97706;
}

/* ── Support form ── */
.dash-support-form-wrapper {
  border-radius: var(--dash-radius) !important;
  background: rgba(255, 255, 255, 0.94) !important;
}

.dash-support-form-header svg {
  stroke: #6366f1;
}

.dash-input,
.dash-textarea {
  border-radius: 12px !important;
  background: #fafaf9 !important;
}

/* ── Empty states ── */
.dash-empty svg {
  opacity: 0.7;
}

.dash-empty svg path,
.dash-empty svg polyline,
.dash-empty svg circle {
  stroke: #6366f1;
}

@media (max-width: 768px) {
  .dash-app {
    padding: 8px 12px 48px;
  }

  .dash-hero {
    padding: 16px !important;
  }

  .dash-tab span:not(.dash-tab-count) {
    display: none;
  }
}
