/* =========================================================
   PerfectReport / assets/styles.css
   THEME: Obsidian Green (#344532)
   ========================================================= */

/* ---------- Palette ---------- */
:root {
  --obsidian: #344532;   /* พื้นหลังหลัก */
  --obsidian-2: #2c3a2c; /* เฉดเข้ม */
  --obsidian-3: #3d523e; /* เฉดสว่าง */

  --bg: var(--obsidian);
  --card: #2f4131;
  --card-2: #2a3b2d;

  --ink: #ffffff;        /* ข้อความหลัก */
  --ink-soft: #e6f0ea;
  --muted: #b9c9bf;

  --accent: #2f8f6b;     /* ปุ่ม/จุดเน้น */
  --accent-2: #9ed0b9;

  --line: #445949;
  --ok: #79c092;
  --warn: #d3b765;
  --bad: #c97d7d;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.theme-perfectdays {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Sarabun', system-ui, -apple-system, Segoe UI, Roboto, 'Helvetica Neue', Arial, sans-serif;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: none; filter: brightness(1.05); }

.container { max-width: 1200px; margin: 0 auto; padding: 16px; }
.card {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 20px rgba(0,0,0,.3);
}

/* ---------- Toolbar (แผนก+เดือน) ---------- */
.toolbar { margin-bottom: 28px; }
.toolbar-form {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: nowrap; white-space: nowrap;
}
.toolbar-form label { font-size: 14px; color: var(--muted); }

/* ✔ ให้แผนกและเดือนเท่ากัน */
.toolbar-form .select,
.toolbar-form .month-input {
  min-width: 400px;   /* ✔ ขยายกว้างขึ้นกว่าเดิม */
  width: 300px;
  font-size: 1.0rem;  /* ✔ ใหญ่ขึ้นเท่ากับตัว Content */
  font-family: inherit; /* ✔ ใช้ฟอนต์เดียวกับ body (Sarabun) */
  line-height: 1.6;
  padding: 14px 16px; /* ✔ ช่อง input สูงขึ้น กดง่ายขึ้น */
  border-radius: 12px;
  background: #223226;
  border: 1px solid var(--line);
  color: #fff;
}


@media (max-width: 720px) {
  .toolbar-form { flex-wrap: wrap; white-space: normal; }
  .toolbar-form .select,
  .toolbar-form .month-input {
    min-width: 100%;
    width: 100%;
  }
}

/* ---------- Inputs ---------- */
.input, .select, .month-input {
  padding: 10px 12px;
  border-radius: 10px;
  background: #223226;
  border: 1px solid var(--line);
  color: #fff;
}
.input::placeholder { color: #c9d5ce; }
.input:focus, .select:focus, .month-input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(158,208,185,.18);
}

/* ---------- KPI / Rows ---------- */
.row { display: grid; gap: 20px; margin-bottom: 28px; }
.row:last-child { margin-bottom: 0; }

.kpi-row { display: grid; gap: 16px; }
.kpi {
  padding: 14px; border-radius: 14px;
  background: linear-gradient(180deg,#2b3d2f,#243326);
  border: 1px solid var(--line);
}
.kpi .big { font-size: 26px; font-weight: 800; color: #fff; }
.kpi .sub { font-size: 16px; color: var(--muted); }

@media (min-width:1201px){ .kpi-row{grid-template-columns:repeat(5,1fr);} }
@media (max-width:1200px) and (min-width:801px){ .kpi-row{grid-template-columns:repeat(3,1fr);} }
@media (max-width:800px){ .kpi-row{grid-template-columns:repeat(2,1fr);} }
@media (max-width:520px){ .kpi-row{grid-template-columns:1fr;} }

/* ---------- Emotions ---------- */
.emotion-grid { grid-template-columns: repeat(5,1fr); }
@media (max-width:1200px){ .emotion-grid{grid-template-columns:repeat(3,1fr);} }
@media (max-width:800px){ .emotion-grid{grid-template-columns:repeat(2,1fr);} }
@media (max-width:520px){ .emotion-grid{grid-template-columns:1fr;} }

.emobox {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 16px;
  border-radius: 14px;
  background: linear-gradient(180deg,#2b3d2f,#243326);
  border: 1px solid var(--line);
}
.emo-img { width: 72px; height: 72px; margin-bottom: 8px; }
.emo-val { font-size: 22px; font-weight: 800; }

/* ---------- Table ---------- */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.table th, .table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
}
.table th {
  background: #2a3b2d;
  color: var(--muted);
  text-align: left;
}
.table tr:hover td { background: #233327; }

/* ---------- Utility ---------- */
.subtle { color: var(--muted); font-size: 14px; }

/* === Flatpickr monthSelect: แสดงครบ 12 เดือนแบบ 4 คอลัมน์ === */
.toolbar.card { overflow: visible; }
.flatpickr-calendar { z-index: 9999; }
.flatpickr-calendar .flatpickr-monthSelect-months {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 8px !important;
  padding: 10px;
  box-sizing: border-box;
}
.flatpickr-monthSelect-month {
  width: auto !important;
  margin: 0 !important;
  line-height: 2.2em;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
}


/* ---------- ปรับเฉพาะช่องเลือกแผนก ---------- */
.select-dept {
  min-width: 400px;   /* ขยายกว้างขึ้นตามต้องการ */
  width: 400px;       /* จะ fix ไว้ก็ได้ */
  font-size: 16px;    /* ให้ font เท่ากับ content */
  font-weight: 600;
}