/* ============================================================
   NCBS Learner Portal — Design System CSS
   ─────────────────────────────────────────────────────────
   ไฟล์นี้คือ Design System ของ Learner Portal (Product)
   ใช้เฉพาะใน ncbs/learner/** pages เท่านั้น

   LOAD ORDER ใน <head>:
     1. design-tokens.css   ← CSS variables (shared)
     2. learner-portal.css  ← THIS FILE — Learner product components
     3. learner-nav.css     ← Navigation (topnav, sidebar, bottom nav)
     4. states.css          ← 4-state pattern + toast (shared utility)

   ห้าม load styles.css ใน Learner Portal pages
   styles.css = prototype admin/backoffice infrastructure เท่านั้น
   ============================================================ */

/* ─── Layout ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: var(--font-thai);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--gray-50);
  line-height: var(--line-height);
  margin: 0;
}

/* Shell layout: topnav (60px) + sidebar + main */
.learner-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.learner-body {
  display: flex;
  flex: 1;
  padding-top: 56px; /* topnav height */
}
.learner-main {
  flex: 1;
  min-width: 0;
  padding: 28px 32px 60px;
  margin-left: 270px; /* sidebar width */
}
@media (max-width: 768px) {
  .learner-main { margin-left: 0; padding: 16px 16px 80px; }
}

/* ─── Typography ──────────────────────────────────────── */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.3; color: var(--text-primary); margin: 0 0 8px; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
p  { margin: 0 0 12px; color: var(--text-secondary); }

/* ─── Cards ───────────────────────────────────────────── */
.lp-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.lp-card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}

/* ─── KPI Cards ───────────────────────────────────────── */
.lp-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.lp-kpi {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.lp-kpi-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.lp-kpi-val { font-size: 24px; font-weight: 700; line-height: 1; color: var(--text-primary); }
.lp-kpi-lbl { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ─── Buttons ─────────────────────────────────────────── */
.btn-lp-primary {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary); color: var(--white);
  border: none; border-radius: var(--radius-full);
  padding: 10px 20px; font-size: 14px; font-weight: 600;
  font-family: var(--font-thai); cursor: pointer; text-decoration: none;
  transition: background .15s;
}
.btn-lp-primary:hover { background: var(--primary-hover); }

.btn-lp-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--white); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius-full);
  padding: 9px 20px; font-size: 14px; font-weight: 500;
  font-family: var(--font-thai); cursor: pointer; text-decoration: none;
  transition: border-color .15s;
}
.btn-lp-secondary:hover { border-color: var(--primary); color: var(--primary); }

/* ─── Badges ──────────────────────────────────────────── */
.badge-lp { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge-lp-green  { background: var(--green-50);  color: var(--green-600); }
.badge-lp-blue   { background: var(--blue-25);   color: var(--primary); }
.badge-lp-orange { background: var(--orange-50); color: var(--orange-600); }
.badge-lp-gray   { background: var(--gray-100);  color: var(--gray-600); }
.badge-lp-red    { background: var(--red-50);    color: var(--red-600); }

/* ─── Form Elements ───────────────────────────────────── */
.lp-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.lp-input, .lp-select, .lp-textarea {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; font-family: var(--font-thai); color: var(--text-primary);
  background: var(--white); transition: border-color .15s;
}
.lp-input:focus, .lp-select:focus, .lp-textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.lp-input[readonly], .lp-input:disabled { background: var(--gray-50); color: var(--text-secondary); cursor: not-allowed; }

/* ─── Progress Bar ────────────────────────────────────── */
.lp-progress-wrap { background: var(--gray-100); border-radius: 999px; height: 6px; overflow: hidden; }
.lp-progress-bar  { background: var(--primary); height: 100%; border-radius: 999px; transition: width .3s; }

/* ─── Section Title ───────────────────────────────────── */
.lp-section-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.lp-divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ─── Responsive grid ─────────────────────────────────── */
.lp-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.lp-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 768px) {
  .lp-grid-2, .lp-grid-3 { grid-template-columns: 1fr; }
  .lp-kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* ─── Footer ──────────────────────────────────────────── */
.lp-footer { text-align: center; padding: 24px 0 8px; font-size: 12px; color: var(--text-muted); }
