/* Dashboard.module.css - Brand Blue/Indigo, Full Page & Responsive */

/* ==== GLOBAL FULL-HEIGHT ==== */
html, body, #root {
  height: 100%;
}
* { box-sizing: border-box; }

/* ==== Palette & Tokens ==== */
:root {
  /* Brand */
  --brand-primary: #2961eb;      /* blue-600 */
  --brand-primary-700: #1d4ed8;  /* blue-700 */
  --brand-secondary: #4f46e5;    /* indigo-600 */
  --brand-secondary-700: #4338ca;/* indigo-700 */
  --brand-gradient: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));

  /* Gradients for cards */
  --card-grad-1: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  --card-grad-2: linear-gradient(135deg, #4f46e5 0%, #2563eb 100%);
  --card-grad-3: linear-gradient(135deg, #2563eb 10%, #4338ca 100%);
  

  /* Neutral */
  --neutral-25: #fcfcfd;
  --neutral-50: #f9fafb;
  --neutral-100: #f3f4f6;
  --neutral-200: #e5e7eb;
  --neutral-300: #d1d5db;
  --neutral-400: #9ca3af;
  --neutral-600: #475569;
  --neutral-800: #1f2937;
  --white: #ffffff;

  /* Text */
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-on-brand: #ffffff;

  /* Borders & Shadows */
  --border-light: #e5e7eb;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 10px rgba(2,6,23,.08);
  --shadow-lg: 0 12px 22px rgba(2,6,23,.12);

  /* States */
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, .18);

  /* Semantic */
  --error-red: #ef4444;
}

/* ==== Base ==== */
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--neutral-50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Root container: full width & height */
.dashboardContainer {
  min-height: 100dvh;   /* support mobile dynamic viewport */
  width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--neutral-50);
}

/* ==== Header ==== */
.dashboardHeader {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.5rem;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border-light);
  width: 100%;
}

.logoAndTitle { display: flex; align-items: center; gap: .75rem; flex-shrink: 0; }
.logoAndTitle img { width: 2.8rem; height: 2.8rem; object-fit: cover; border-radius: .6rem; box-shadow: var(--shadow-sm); }

.h1 {
  margin: 0;
  font-size: clamp(1.25rem, 1.2vw + 1rem, 2rem);
  font-weight: 800; letter-spacing: -.02em;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.h1Accent {
  background: linear-gradient(135deg, var(--brand-secondary), var(--brand-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.orgBadge {
  margin-left: .75rem;
  padding: .25rem .6rem;
  font-size: .75rem; font-weight: 700;
  color: var(--text-on-brand);
  background: var(--brand-secondary);
  border-radius: .5rem;
  border: 1px solid rgba(255,255,255,.5);
}

/* ==== Dropdown ==== */
.dropdownContainer { position: relative; display: flex; align-items: center; gap: .5rem; }
.dropdownToggle {
  min-width: 2.5rem; height: 2.5rem;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: .6rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
}
.dropdownToggle:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); border-color: var(--neutral-300); }
.dropdownToggle:focus { outline: none; box-shadow: var(--focus-ring); }

.dropdownMenu {
  position: absolute; right: 0; top: calc(100% + .5rem);
  min-width: 10rem; padding: .5rem;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: .75rem;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: .25rem;
}

.dropdownItem {
  border: 0; background: transparent; text-align: left; cursor: pointer;
  padding: .65rem .75rem; border-radius: .5rem;
  font-size: .95rem; font-weight: 600; color: var(--neutral-800);
  transition: background .15s ease, transform .06s ease;
}
.dropdownItem:hover { background: rgba(37,99,235,.08); transform: translateY(-1px); }

/* ==== Main: FULL WIDTH ==== */
.mainContent {
  flex: 1 1 auto;
  width: 100%;
  padding: 2rem 1.5rem;
  margin: 0;                 /* remove center constraint */
  display: flex; flex-direction: column; gap: 2rem;
  min-width: 0;              /* prevent overflow causing shrink */
}

/* Summary Cards */
.summaryCardsContainer {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); /* prevent too-small cards */
  gap: 1rem;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}

/* Gradient cards (3 variasi) */
.summaryCard {
  position: relative;
  overflow: hidden;
  background: var(--card-grad-1);
  color: var(--text-on-brand);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  min-height: 120px;
  box-shadow: 0 10px 20px rgba(37,99,235,.15);
  transition: box-shadow .2s ease, transform .12s ease, background-position .4s ease, filter .2s ease;
  background-size: 140% 140%;
  background-position: 0% 50%;
}
.summaryCardsContainer .summaryCard:nth-child(1) { background: var(--card-grad-1); }
.summaryCardsContainer .summaryCard:nth-child(2) { background: var(--card-grad-2); }
.summaryCardsContainer .summaryCard:nth-child(3) { background: var(--card-grad-3); }

.summaryCard::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 60% at 10% -10%, rgba(255,255,255,.25) 0%, rgba(255,255,255,0) 55%),
    radial-gradient(90% 50% at 90% -10%, rgba(255,255,255,.18) 0%, rgba(255,255,255,0) 60%);
  pointer-events: none;
}

.summaryCard:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(37,99,235,.22);
  filter: saturate(1.05);
  background-position: 100% 50%;
}

.summaryCard h3 {
  margin: 0 0 .5rem 0;
  font-size: 1rem; letter-spacing: .06em; text-transform: uppercase;
  color: rgba(255,255,255,.92);
  font-weight: 800;
}
.summaryCard p {
  margin: 0; line-height: 1;
  font-size: clamp(2rem, 2vw + .5rem, 2.2rem);
  font-weight: 900; color: #fff;
  background: none !important;
  -webkit-background-clip: initial !important;
  -webkit-text-fill-color: #fff !important;
  text-shadow: 0 1px 1px rgba(0,0,0,.15);
}

/* Grid: Form & Chart */
.dashboardGrid {
  display: grid;
  grid-template-columns: 1fr;  /* mobile: 1 kolom */
  gap: 2rem;
  flex-grow: 1;
  min-width: 0;
}

.formSection, .chartSection {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: 1rem;
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  min-width: 0;
}

.formSection h2, .chartSection h2 {
  margin: 0 0 1rem 0;
  font-size: clamp(1.05rem, .9vw + .7rem, 1.35rem);
  font-weight: 800; letter-spacing: -.015em;
  color: var(--neutral-800);
}

/* Form */
.form label {
  display: block; margin-bottom: 1rem;
  font-size: .95rem; font-weight: 700; color: var(--neutral-800);
}
.form input[type="text"],
.form input[type="password"],
.form select {
  width: 100%; margin-top: .35rem;
  padding: .7rem 1rem;
  font-size: .95rem; color: var(--neutral-800);
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: .55rem;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.form input[type="text"]:focus,
.form input[type="password"]:focus,
.form select:focus {
  outline: none; border-color: var(--brand-primary);
  box-shadow: var(--focus-ring);
}

/* Buttons */
.submitButton {
  width: 100%;
  display: inline-flex; align-items: center; justify-content: center;
  padding: .9rem 1.2rem;
  border: none; border-radius: .6rem; cursor: pointer;
  font-size: 1rem; font-weight: 800; letter-spacing: .02em;
  color: var(--text-on-brand);
  background: var(--brand-primary);
  box-shadow: 0 6px 18px rgba(37,99,235,.18);
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
}
.submitButton:hover { transform: translateY(-1px); background: var(--brand-primary-700); box-shadow: 0 8px 22px rgba(37,99,235,.22); }
.submitButton:active { transform: translateY(0); }
.submitButton:focus { outline: none; box-shadow: var(--focus-ring); }

/* Messages */
.success, .warning {
  margin-top: 1rem; padding: .85rem 1rem;
  border-radius: .6rem; font-size: .92rem; font-weight: 700;
  border: 1px solid transparent;
}
.success {
  color: var(--brand-primary);
  background: rgba(37,99,235,.08);
  border-color: rgba(37,99,235,.18);
}
.warning {
  color: var(--brand-secondary);
  background: rgba(79,70,229,.08);
  border-color: rgba(79,70,229,.18);
}
.error {
  margin-top: 1rem; padding: .85rem 1rem;
  border-radius: .6rem; font-size: .92rem; font-weight: 700;
  color: var(--error-red);
  background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.18);
}

/* Footer */
.footer {
  margin-top: auto;
  text-align: center;
  padding: 1rem;
  font-size: .85rem;
  color: var(--text-secondary);
  background: var(--white);
  border-top: 1px solid var(--border-light);
}

/* Chart placeholder (kalau perlu) */
.chartPlaceholder {
  height: 20rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--neutral-50);
  border: 2px dashed var(--border-light);
  border-radius: .75rem;
  color: var(--text-secondary);
  font-style: italic; font-size: .95rem;
}

/* Officers List */
.officerListContainer {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: .8rem;
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}
.officerList {
  max-height: 300px; overflow-y: auto;
  list-style: none; margin: 0; padding: 0;
  border: 1px solid var(--border-light);
  border-radius: .6rem; background: var(--white);
}
.officerItem {
  display: flex; align-items: center; justify-content: space-between;
  padding: .95rem 1rem;
  border-bottom: 1px solid var(--border-light);
  transition: background .15s ease;
}
.officerItem:last-child { border-bottom: 0; }
.officerItem:hover { background: rgba(79,70,229,.05); }
.officerInfo { display: flex; align-items: center; gap: .75rem; flex: 1; }
.officerIcon { width: 24px; height: 24px; display: grid; place-items: center; font-size: 18px; }
.officerDetails { display: flex; flex-direction: column; gap: 2px; }
.officerName { font-weight: 800; color: var(--neutral-800); font-size: .98rem; }
.officerRole { font-size: .85rem; color: var(--text-secondary); text-transform: capitalize; font-style: italic; }
.deleteButton {
  background: transparent; border: 0; cursor: pointer;
  font-size: .85rem; padding: .45rem .65rem; border-radius: .4rem;
  color: var(--error-red);
  transition: background .15s ease, transform .06s ease;
  opacity: .9;
}
.deleteButton:hover { background: rgba(239,68,68,.08); transform: translateY(-1px); }
.deleteButton:focus { outline: none; box-shadow: var(--focus-ring); }
.emptyState { text-align: center; padding: 36px 18px; color: var(--text-secondary); }
.emptyState span { display: block; font-size: 32px; margin-bottom: .5rem; }
.separator { border: 0; border-top: 1px solid var(--border-light); margin: 20px 0; }

/* Scrollbar */
.officerList::-webkit-scrollbar { width: 8px; }
.officerList::-webkit-scrollbar-track { background: var(--neutral-100); border-radius: 4px; }
.officerList::-webkit-scrollbar-thumb { background: var(--neutral-300); border-radius: 4px; }
.officerList::-webkit-scrollbar-thumb:hover { background: var(--neutral-400); }

/* ==== Responsive ==== */
@media (min-width: 768px) {
  .dashboardHeader { padding: 1rem 2rem; }
  .logoAndTitle img { width: 3rem; height: 3rem; }

  .mainContent { padding: 2.25rem 2rem; gap: 2rem; }
  .dashboardGrid { grid-template-columns: 1.1fr 2fr; gap: 2rem; } /* 2 kolom, tetap lega */
}

@media (min-width: 1280px) {
  .mainContent { padding: 2.5rem 2.25rem; gap: 2.25rem; }
  .dashboardGrid { grid-template-columns: 1fr 2fr; gap: 2.25rem; }
}

/* ==== FIX: jika hanya ada 1 section, lebarkan full ==== */
.dashboardGrid > *:only-child {
  grid-column: 1 / -1;
  width: 100%;
}

/* Pastikan chart section benar-benar membentang */
.chartSection {
  width: 100%;
  min-width: 0;                /* cegah overflow anak bikin kontainer menyempit */
}

/* Rapikan baris kartu ringkasan */
.summaryCardsContainer {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: stretch;
  justify-items: stretch;
  gap: 1.25rem;
}

/* Tinggi & padding kartu konsisten + bayangan lebih halus */
.summaryCard {
  min-height: 110px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 8px 18px rgba(37,99,235,.12);
}

/* Judul chart dan box warning sedikit lebih rapat */
.chartSection h2 { margin-bottom: .75rem; }
.warning { margin-top: .75rem; }

/* Header biar konten tidak terlalu mepet tepi di layar lebar */
@media (min-width: 1280px) {
  .dashboardHeader { padding-left: 2rem; padding-right: 2rem; }
  .mainContent { padding-left: 2rem; padding-right: 2rem; }
}

/* (Opsional) Kalau tetap terlihat terlalu ke kiri,
   kamu bisa center-kan isi utama tanpa mengubah full width list dokumen */
@media (min-width: 1024px) {
  .mainContent { max-width: 1280px; margin-left: auto; margin-right: auto; }
}

.dashboard {
  font-family: sans-serif;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: #ffffff;
  border-bottom: 1px solid #e5e5e5;
}

.logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: bold;
  color: #333;
}

.menuWrapper {
  position: relative;
}

.menuButton {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}

.menuButton:hover {
  background: #f2f2f2;
}

.dropdownMenu {
  position: absolute;
  right: 0;
  top: 45px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  padding: 8px;
  width: 220px;
  z-index: 1000;
}

.dropdownItem,
.dropdownItemStatic {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
}

.dropdownItem:hover {
  background: #f5f5f5;
}

.dropdownItemStatic {
  cursor: default;
  background: #fafafa;
  display: block;
}

.dropdownIcon {
  flex-shrink: 0;
  color: #444;
}

.dropdownText {
  display: flex;
  flex-direction: column;
}

.orgName {
  font-size: 12px;
  color: #666;
}
