/* =====================================================
   Project Tracker — Custom styles
   Extends Tailwind CDN utilities with reusable classes.
   ===================================================== */

/* ---------- Global interactive cursor ---------- */
button,
a,
summary,
label,
select,
[role="button"],
[role="link"],
[role="tab"],
[role="menuitem"],
[role="option"],
[role="checkbox"],
[role="radio"],
[role="switch"],
[onclick],
[data-clickable],
input[type="button"],
input[type="submit"],
input[type="reset"],
input[type="checkbox"],
input[type="radio"],
input[type="file"] {
  cursor: pointer;
}
button:disabled,
a[aria-disabled="true"],
input:disabled,
select:disabled,
[disabled] {
  cursor: not-allowed;
}

/* ---------- Form primitives ---------- */
.lbl {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
  letter-spacing: .01em;
}
.fld {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  font-size: 14px;
  color: #0f172a;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.fld:focus {
  border-color: #6089ff;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(96, 137, 255, .18);
}
textarea.fld {
  height: auto;
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
  min-height: 80px;
}
select.fld {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

/* ---------- Checkbox pill ---------- */
.chk {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  color: #334155;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.chk:hover { border-color: #cbd5e1; }
.chk input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #2748e0;
  cursor: pointer;
}
.chk input[type="checkbox"]:checked + span {
  color: #1c3195;
  font-weight: 500;
}
.chk:has(input:checked) {
  background: #eef4ff;
  border-color: #93b3ff;
}

/* ---------- Sidebar nav ---------- */
.nav-link.active {
  background: linear-gradient(to right, #eef4ff, #ffffff);
  color: #1f38b8;
  font-weight: 600;
  box-shadow: inset 3px 0 0 #2748e0;
}
.nav-link.active svg { color: #2748e0; }

/* ---------- Section nav (project editor) ---------- */
.sec-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  color: #475569;
  border-radius: 8px;
  white-space: nowrap;
  transition: background .15s, color .15s;
  cursor: pointer;
}
.sec-link:hover { background: #f1f5f9; color: #1e293b; }
.sec-link.active {
  background: #eef4ff;
  color: #1f38b8;
}
.sec-num {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.sec-link.active .sec-num {
  background: #2748e0;
  color: #fff;
}

/* ---------- Form sections (project editor) ---------- */
.form-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15,23,42,.04), 0 8px 24px -12px rgba(15,23,42,.08);
  scroll-margin-top: 88px;
  overflow: hidden;
}
.form-section-head {
  padding: 20px 24px;
  border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(to bottom, #fbfcfe, #ffffff);
}
.form-section-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -.01em;
}
.form-section-desc {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

/* ---------- Stat card ---------- */
.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(15,23,42,.04), 0 8px 24px -12px rgba(15,23,42,.08);
}
.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.stat-body { min-width: 0; flex: 1; }
.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.1;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Layout switcher / segmented control ---------- */
.layout-btn {
  color: #475569;
  transition: color .15s, background .15s, box-shadow .15s;
  cursor: pointer;
}
.layout-btn:hover { color: #1f38b8; }
.layout-btn.active {
  background: #fff;
  color: #1f38b8;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}
.mfilter-btn {
  color: #64748b;
  transition: color .15s, background .15s;
  cursor: pointer;
}
.mfilter-btn.active {
  background: #eef4ff;
  color: #1f38b8;
}

/* ---------- Status pill ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: .8;
}
.pill-progress   { background: #fef3c7; color: #92400e; }
.pill-live       { background: #d1fae5; color: #065f46; }
.pill-hold       { background: #ffe4e6; color: #9f1239; }
.pill-review     { background: #ede9fe; color: #5b21b6; }
.pill-notstarted { background: #f1f5f9; color: #475569; }
.pill-design     { background: #cffafe; color: #155e75; }
.pill-dev        { background: #dbe6ff; color: #1c3195; }
.pill-test       { background: #fef3c7; color: #78350f; }
.pill-cancel     { background: #fee2e2; color: #991b1b; }

/* Project-category pills */
.pill-ongoing    { background: #d1fae5; color: #065f46; }
.pill-pending    { background: #fef3c7; color: #92400e; }
.pill-hold-cat   { background: #ffe4e6; color: #9f1239; }
.pill-dead       { background: #e2e8f0; color: #334155; }

/* ---------- Recent project row (dashboard, upcoming) ---------- */
.recent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background .15s;
}
.recent-row:hover { background: #f8fafc; }
.avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .02em;
}

/* ---------- Project table row ---------- */
.proj-row td { padding: 14px 16px; vertical-align: middle; }
.proj-row:hover { background: #f8fafc; cursor: pointer; }
.proj-name { font-weight: 600; color: #0f172a; }
.proj-sub  { font-size: 12px; color: #64748b; margin-top: 2px; }
.proj-row a { color: inherit; text-decoration: none; }

/* Dates should never wrap inside a cell */
.date-cell {
  display: inline-block;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: #334155;
}

/* ---------- Platform distribution bars ---------- */
.dist-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.dist-bar {
  grid-column: span 2;
  height: 6px;
  border-radius: 999px;
  background: #f1f5f9;
  overflow: hidden;
}
.dist-fill {
  height: 100%;
  background: linear-gradient(to right, #6089ff, #2748e0);
  border-radius: 999px;
  transition: width .4s;
}

/* ---------- Card layout for projects ---------- */
.pcard {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  box-shadow: 0 1px 2px rgba(15,23,42,.03);
}
.pcard:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  box-shadow: 0 8px 24px -12px rgba(15,23,42,.15);
}

/* ---------- Line clamp fallback ---------- */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Toast ---------- */
#__toast {
  transform: translateY(20px);
  opacity: 0;
  transition: transform .25s, opacity .25s;
}
#__toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ---------- Scrollbar tidy ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; border: 2px solid #f8fafc; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* =====================================================
   Charts
   ===================================================== */

.chart-empty {
  padding: 40px 16px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
  font-style: italic;
}

/* ---------- Donut chart ---------- */
.donut-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 20px;
}
.donut-graphic {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 0 auto;
}
.donut-svg {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.donut-slice {
  transition: opacity .18s ease;
  cursor: default;
}
.donut-svg:hover .donut-slice { opacity: .5; }
.donut-svg .donut-slice:hover { opacity: 1; }
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.donut-total {
  font-size: 28px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.donut-sublabel {
  font-size: 10px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: 4px;
  font-weight: 600;
}
.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid #f1f5f9;
}
.legend-item {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  padding: 4px 0;
}
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}
.legend-label {
  color: #334155;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.legend-value {
  color: #64748b;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  white-space: nowrap;
}

/* ---------- Bar chart (vertical) ---------- */
.chart-svg {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
.chart-svg text {
  font-family: Inter, system-ui, sans-serif;
}
.chart-svg .bar {
  transition: opacity .18s ease;
}
.chart-svg .bar-group:hover .bar {
  opacity: .78;
}

/* ---------- Horizontal bars ---------- */
.hbar-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.hbar-row { min-width: 0; }
.hbar-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}
.hbar-label {
  font-size: 13px;
  color: #334155;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.hbar-value {
  font-size: 12px;
  color: #475569;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.hbar-track {
  height: 8px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
}
.hbar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}

/* Clickable horizontal bar (used for Managers on Dashboard) */
button.hbar-clickable {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: background .15s, border-color .15s;
}
button.hbar-clickable:hover {
  background: #f8fafc;
  border-color: #e2e8f0;
}
button.hbar-clickable:focus-visible {
  outline: none;
  border-color: #6089ff;
  box-shadow: 0 0 0 3px rgba(96,137,255,.18);
}
/* Slightly reduce the vertical gap since buttons already carry padding. */
.hbar-list:has(button.hbar-clickable) { gap: 6px; }

/* Manager modal project row */
.mgr-proj-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background .15s;
}
.mgr-proj-row:hover { background: #f8fafc; }

/* Active filter chip on Projects page */
.active-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px 5px 12px;
  background: #eef4ff;
  color: #1c3195;
  border: 1px solid #bfd2ff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.active-chip b { font-weight: 700; }
.active-chip button {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: transparent;
  color: #1c3195;
  cursor: pointer;
  transition: background .15s;
  border: 0;
}
.active-chip button:hover { background: #dbe6ff; }

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .fld { font-size: 16px; } /* prevent iOS zoom on focus */
}
@media (max-width: 1023px) {
  .sec-link { flex: 0 0 auto; }
}
