/* ============================================================================
   css/components/cards.css — Card & Container Components (v1)
   ----------------------------------------------------------------------------
   Every "boxed content" pattern in the app: dashboard stat cards, list-item
   cards, the shared entity-card layout (Student/Category rows), empty
   states, loading skeletons, the login screen's stacked card sections, the
   detail-page (student-view) hero card, and the settings page sections.
   ============================================================================ */

/* ── Home screen card ── */
/* ══════════════════════════════════════════════
   HOME / DASHBOARD PAGE
══════════════════════════════════════════════ */
.home-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--app-bg);
}

.home-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 32px 26px 28px;
  box-shadow: var(--shadow-float);
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.home-card h1 {
  font-size: 20px;
  margin: 0 0 18px;
  color: var(--app-theme-color);
  font-weight: 700;
  letter-spacing: -.02em;
}
.home-card .greeting {
  font-size: 13px;
  color: #aaa;
  margin: -10px 0 16px;
  font-weight: 500;
}


/* ══════════════════════════════════════════════
   STAT GRID — reusable responsive card grid
   ──────────────────────────────────────────────
   Powers the Dashboard cards today, and is built to be reused as-is for
   any future Statistics, Summary, or Quick Actions card row — just give
   the wrapper class="stat-grid" (or class="dashboard-cards stat-grid").
   No column count is hardcoded: auto-fit + minmax lets the browser fit
   as many cards per row as comfortably fit the available width, from a
   single phone column up to 4+ on a wide desktop, with no breakpoint
   needed to "turn on" responsiveness. --stat-card-min is the only knob;
   breakpoints.css nudges it wider on bigger screens so cards don't grow
   too large at high zoom, not to hardcode a column count.
══════════════════════════════════════════════ */
:root {
  --stat-card-min: 128px; /* smallest comfortable card width before wrapping */
}
.dashboard-cards,
.stat-grid,
.summary-grid,
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(var(--stat-card-min), 100%), 1fr));
  gap: 12px;
  margin: 0 0 24px;
  padding: 16px 20px;
}
.dash-card {
  background: #fff;
  border: 1px solid #e8e5f0;
  border-radius: var(--radius-md);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
}
.dash-card:hover { box-shadow: var(--shadow-float); transform: translateY(-2px); }
.dash-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--app-theme-color);
}
.dash-label {
  font-size: 11px;
  color: #999;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: 4px;
  font-weight: 600;
}


/* ── List item card (base) ── */
.list-dis {
  list-style: none;
  padding: 12px 14px;
  margin: 0 0 10px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
  position: relative;
  transition: box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
}
.list-dis:active {
  transform: scale(.988);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.list-dis li { list-style: none; }


/* ══════════════════════════════════════════════
   ENTITY CARD — shared list-item layout
   ──────────────────────────────────────────────
   Reusable header/actions/meta rows for any list card built on top of
   .list-dis (Student, Category, and future list pages). Originally only
   existed as inline styles duplicated inside Student.script.js's card
   template; pulled out here so every list page shares one definition
   instead of re-implementing it.
══════════════════════════════════════════════ */
.entity-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 700;
  color: #222;
}
.entity-card-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.entity-card-actions {
  flex-shrink: 0;
  font-size: 16px;
  display: flex;
  align-items: center;
}
.entity-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #555;
  margin-top: 6px;
}
.entity-card-meta i {
  width: 16px;
  color: #888;
  text-align: center;
  flex-shrink: 0;
}
/* Entity card gains a left accent + indent affordance once its parent
   page wires up bulk-select (today: Student only — Category inherits
   the same hook for free if it adopts bulk-select later). */
.entity-card .bulk-checkbox {
  display: none;
  position: absolute;
  top: 10px;
  left: 8px;
  z-index: 2;
  pointer-events: none;
}
.entity-card .entity-card-head {
  padding-left: 0;
  transition: padding-left 0.15s;
}
.bulk-multiselect-active .entity-card .entity-card-head {
  padding-left: 28px;
}
.entity-card.bulk-checked,
.entity-card.bulk-selected {
  border-left: 4px solid var(--app-theme-color, #1976d2) !important;
  background: #e8f0fe !important;
}


/* ══════════════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: #999;
  animation: fadeUp .3s ease both;
}
@keyframes fadeUp {
  from { opacity:0; transform:translateY(10px); }
  to   { opacity:1; transform:translateY(0); }
}
.empty-state-icon { font-size: 46px; margin-bottom: 14px; }
.empty-state-text { font-size: 15px; font-weight: 700; color: #555; margin: 0 0 6px; }
.empty-state-hint { font-size: 13px; color: #aaa; margin: 0; cursor: pointer; }
.empty-state-hint:hover strong { text-decoration: underline; }
.empty-state-retry {
  margin-top: 18px;
  padding: 9px 24px;
  border: none;
  border-radius: 20px;
  background: var(--app-theme-color);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity var(--transition);
}
.empty-state-retry:hover { opacity: .85; }


/* ══════════════════════════════════════════════
   THEME PICKER
══════════════════════════════════════════════ */
.theme-picker { margin-top: 22px; }
.theme-picker-label {
  font-size: 11px;
  font-weight: 700;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 0 0 10px;
}
.theme-swatches {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.theme-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform var(--transition), border-color var(--transition);
}
.theme-swatch:hover { transform: scale(1.15); }
.theme-swatch.selected {
  border-color: #333;
  box-shadow: 0 0 0 2px #fff inset;
}
.theme-swatch-auto {
  background: linear-gradient(135deg, #FFFFFF 50%, #1E1B2E 50%);
  border: 1.5px solid #ccc;
}


/* ===== Performance skeletons (perf-skeleton.js) ===== */
#perf_skeletons { padding: 4px 8px; }
.perf-skel-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 12px; margin: 8px 0;
  background: #fff; border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.perf-skel-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(90deg,#eceff1 0%,#f5f7f8 50%,#eceff1 100%);
  background-size: 200% 100%;
  animation: perfShimmer 1.2s ease-in-out infinite;
  flex-shrink: 0;
}
.perf-skel-lines { flex: 1; }
.perf-skel-line {
  height: 12px; border-radius: 6px; margin: 6px 0;
  background: linear-gradient(90deg,#eceff1 0%,#f5f7f8 50%,#eceff1 100%);
  background-size: 200% 100%;
  animation: perfShimmer 1.2s ease-in-out infinite;
}
.perf-skel-line-lg { width: 60%; }
.perf-skel-line-md { width: 40%; height: 10px; }
@keyframes perfShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}


/* ══════════════════════════════════════════════
   LOGIN — stacked card sections
   (moved from css/login.css — shares the card pattern above)
══════════════════════════════════════════════ */
.wrapper {
  width: 100%;
  max-width: 390px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.logo-box {
  background: #fff;
  border-radius: var(--radius, 14px);
  padding: 26px 24px 20px;
  text-align: center;
  box-shadow: var(--shadow, 0 16px 48px rgba(43,38,64,.12));
}
.logo-icon {
  width: 58px; height: 58px;
  background: linear-gradient(135deg, var(--brand, #2B2640) 0%, var(--accent, #6C63FF) 100%);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.logo-icon svg { width: 28px; height: 28px; fill: #fff; }
.logo-box h1 { font-size: 19px; color: var(--brand, #2B2640); font-weight: 700; letter-spacing: -.02em; }
.logo-box p  { font-size: 12.5px; color: #aaa; margin-top: 3px; }

.tab-box {
  background: #fff;
  border-radius: var(--radius, 14px);
  padding: 5px;
  box-shadow: var(--shadow, 0 16px 48px rgba(43,38,64,.12));
  display: flex;
  gap: 4px;
}

.form-box {
  background: #fff;
  border-radius: var(--radius, 14px);
  padding: 22px 20px;
  box-shadow: var(--shadow, 0 16px 48px rgba(43,38,64,.12));
  display: none;
  flex-direction: column;
  gap: 14px;
  animation: slideUp .22s ease both;
}
.form-box.active { display: flex; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.form-box h2 { font-size: 16px; color: var(--brand, #2B2640); font-weight: 700; letter-spacing: -.01em; }
.form-box .sub { font-size: 12px; color: #bbb; margin-top: -8px; }

.bio-box {
  background: #fff;
  border-radius: var(--radius, 14px);
  padding: 18px 20px;
  box-shadow: var(--shadow, 0 16px 48px rgba(43,38,64,.12));
  display: flex; flex-direction: column;
  align-items: center; gap: 9px;
}
.bio-box p { font-size: 12px; color: #bbb; }

.divider {
  display: flex; align-items: center; gap: 8px;
  color: #ddd; font-size: 11.5px;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: #eee;
}

.strength-row { display: flex; gap: 4px; }
.seg { flex: 1; height: 4px; border-radius: 4px; background: #eee; transition: background .3s; }
.s-label { font-size: 11px; color: #bbb; text-align: right; }

/* ══════════════════════════════════════════════
   SETTINGS — section cards
   (moved from inline <style> in settings.html)
══════════════════════════════════════════════ */
.settings-body { max-width: 480px; padding: 24px 20px 60px; }
.settings-section {
  margin-bottom: 28px;
  background: #fff;
  border-radius: 12px;
  padding: 18px 18px 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,.07);
}
.settings-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #999;
  margin: 0 0 14px;
  font-weight: 700;
}

/* ══════════════════════════════════════════════
   DETAIL HERO CARD (student-view "dcard")
   (moved from inline <style> in student-view.html)
══════════════════════════════════════════════ */
#detail-card { display: none; max-width: 720px; margin: 0 auto; padding: 1rem 1rem 4rem; }
.dcard {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
  margin-top: 1rem;
}
.dcard-hero {
  background: linear-gradient(135deg, var(--theme, var(--app-theme-color)) 0%, var(--accent, #6C5CE7) 100%);
  padding: 24px 20px 20px;
  text-align: center;
  color: #fff;
}
.dcard-avatar {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 10px;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700;
  border: 2px solid rgba(255,255,255,.35);
}
.dcard-name { font-size: 20px; font-weight: 700; margin: 0 0 6px; }
.dcard-fields { padding: 0 20px 4px; }
.dfield {
  display: flex; align-items: flex-start; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid #f4f2fb;
}
.dfield:last-child { border-bottom: none; }
.dfield-ico {
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(108,92,231,.08);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--accent, #6C5CE7); flex-shrink: 0; margin-top: 1px;
}
.dfield-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: #aaa; margin: 0 0 2px;
}
.dfield-value { font-size: 14px; font-weight: 600; color: #222; word-break: break-word; }
.dfield-value a { color: var(--accent, #6C5CE7); text-decoration: none; }

/* Action grid container (see components/buttons.css for .daction buttons) */
.dactions {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 10px;
  padding: 14px 16px 16px; border-top: 1px solid #f4f2fb;
}
@media (max-width: 640px) {
  .dactions { grid-template-columns: repeat(4,1fr); gap: 6px; padding: 10px 12px 12px; }
}

/* Detail page skeleton shimmer (first-paint loading state) */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skel {
  background: linear-gradient(90deg,#e8e5f5 25%,#d8d4f0 50%,#e8e5f5 75%);
  background-size: 400px 100%;
  animation: shimmer 1.3s infinite linear;
  border-radius: 8px;
}
.skel-hero { height: 140px; border-radius: 16px; margin: 1rem 1rem 0; }
.skel-card {
  background: #fff; border-radius: 12px; padding: 14px 16px; margin: .75rem 1rem 0;
  display: flex; gap: 12px; align-items: center;
}
.skel-ico   { width: 32px; height: 32px; flex-shrink: 0; border-radius: 8px; }
.skel-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.skel-line  { height: 13px; border-radius: 6px; }
