/**
 * ============================================================
 * MENTAYA — Screen & Layout Styles
 * File    : css/screens.css
 * Purpose : Gaya layout untuk setiap screen dan komponen besar
 *           yang spesifik untuk halaman tertentu:
 *           - Login screen
 *           - Top navigation
 *           - Bottom tab navigation
 *           - App content wrapper
 *           - Screen: Beranda, Checklist, Riwayat, Admin
 * Audit   : Pisahkan dari components.css agar perubahan layout
 *           tidak mempengaruhi komponen reusable.
 * ============================================================
 */

/* ══════════════════════════════════════════════════════
   SCREEN SYSTEM
   Setiap layar besar adalah .screen. Hanya satu yang
   .screen--active pada satu waktu, diatur oleh auth.js.
   ══════════════════════════════════════════════════════ */

.screen {
  display: none;
  min-height: 100vh;
}

.screen--active {
  display: flex;
  flex-direction: column;
}

/* ══════════════════════════════════════════════════════
   LOGIN SCREEN
   ══════════════════════════════════════════════════════ */

.login-screen {
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background: var(--color-forest);
  padding: var(--space-6);
}

/* Latar gradien organik */
.login-screen__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 15% 85%, rgba(74, 171, 109, 0.22) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 85% 15%, rgba(45, 122, 79, 0.28) 0%, transparent 55%),
    radial-gradient(ellipse 50% 50% at 50% 50%, rgba(26, 77, 46, 0.5) 0%, transparent 70%),
    linear-gradient(155deg, #0c2218 0%, #1a4d2e 45%, #123421 100%);
}

/* Dekorasi bentuk daun di sudut */
.login-screen__deco {
  position: absolute;
  pointer-events: none;
  opacity: 0.06;
}

.login-screen__deco--tl {
  top: -80px;
  left: -60px;
  width: 340px;
  height: 340px;
}

.login-screen__deco--br {
  bottom: -100px;
  right: -50px;
  width: 300px;
  height: 300px;
  transform: rotate(35deg);
}

/* Kartu login */
.login-card {
  position: relative;
  z-index: var(--z-base);
  background: var(--color-warm);
  border-radius: var(--radius-xl);
  padding: var(--space-12) var(--space-10);
  width: 100%;
  max-width: 430px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(255, 255, 255, 0.08);
  animation: cardEntrance 0.75s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Branding atas kartu login */
.login-brand {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: var(--space-8);
}

.login-brand__name {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: var(--weight-bold);
  color: var(--color-forest);
  letter-spacing: 0;
  line-height: 1.1;
}

.login-brand__sub {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-top: 3px;
}

.login-card__title {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-1);
}

.login-card__subtitle {
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin-bottom: var(--space-6);
  line-height: 1.55;
}

.login-footer {
  margin-top: var(--space-5);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--color-muted);
  line-height: 1.7;
}

.login-footer strong {
  color: var(--color-leaf);
}

/* ══════════════════════════════════════════════════════
   APP LAYOUT (setelah login)
   ══════════════════════════════════════════════════════ */

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 60% at 15% 85%, rgba(74, 171, 109, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 85% 15%, rgba(45, 122, 79, 0.24) 0%, transparent 55%),
    linear-gradient(155deg, #0c2218 0%, #1a4d2e 48%, #123421 100%);
}

/* ── TOP NAVIGATION ── */

.topnav {
  background: rgba(12, 34, 24, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  height: var(--nav-height);
  padding: 0 var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.topnav__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.topnav__name {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  color: #fff;
  letter-spacing: 0;
}

.topnav__right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.topnav__role-badge {
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.88);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

/* Hanya tampil di layar lebih lebar */
@media (max-width: 400px) {
  .topnav__role-badge {
    display: none;
  }
}

.topnav__avatar {
  width: 38px;
  height: 38px;
  background: var(--color-sage);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: #fff;
  cursor: pointer;
  transition: background var(--transition-fast);
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.topnav__avatar:hover {
  background: var(--color-leaf);
}

.topnav__logout {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: rgba(255, 255, 255, 0.78);
  font-size: var(--text-xs);
  font-family: var(--font-body);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.topnav__logout:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* ── MAIN CONTENT AREA ── */

.app-content {
  flex: 1;
  padding: var(--space-6) var(--space-5);
  padding-bottom: calc(var(--bottomnav-height) + var(--space-6));
  max-width: var(--content-max-width);
  margin: 0 auto;
  width: 100%;
  position: relative;
  z-index: var(--z-base);
  color: rgba(255, 255, 255, 0.92);
}

.app-content > .tab-pane > .section-title,
.app-content > .tab-pane > .section-title h1,
.app-content > .tab-pane > .section-title h2 {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

.app-content > .tab-pane > [id$="-list-count"],
#admin-list-count {
  color: rgba(255, 255, 255, 0.78) !important;
}

.app-content > .tab-pane > .empty-state,
.app-content > .tab-pane > .empty-state .empty-state__title,
.app-content > .tab-pane > .empty-state .empty-state__desc {
  color: rgba(255, 255, 255, 0.82);
}

#cat-breakdown > .empty-state__desc,
#history-list > .empty-state,
#history-list .empty-state__title,
#history-list .empty-state__desc,
#admin-participation > .empty-state,
#admin-participation .empty-state__title,
#admin-participation .empty-state__desc,
#admin-password-requests > .empty-state,
#admin-password-requests .empty-state__title,
#admin-password-requests .empty-state__desc {
  color: rgba(255, 255, 255, 0.84);
}

/* ── BOTTOM TAB NAVIGATION ── */

.bottomnav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(12, 34, 24, 0.94);
  border-top: 1px solid rgba(255,255,255,0.14);
  display: flex;
  height: var(--bottomnav-height);
  z-index: var(--z-sticky);
  box-shadow: var(--shadow-xs);
  /* Dukungan iOS safe area (notch) */
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: rgba(255, 255, 255, 0.68);
  transition: color var(--transition-fast);
  gap: 4px;
  position: relative;
}

.tab-btn__label {
  line-height: 1;
  letter-spacing: 0;
}

/* State aktif pada tab */
.tab-btn--active {
  color: #fff;
}

/* Indikator titik di atas tab aktif */
.tab-btn--active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 3px;
  background: var(--color-mint);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

/* ══════════════════════════════════════════════════════
   TAB PANE SYSTEM
   Setiap konten tab adalah .tab-pane, hanya satu
   yang .tab-pane--active pada satu waktu.
   ══════════════════════════════════════════════════════ */

.tab-pane {
  display: none;
}

.tab-pane--active {
  display: block;
  animation: fadeUp 0.35s ease both;
}

/* ══════════════════════════════════════════════════════
   SCREEN: BERANDA
   ══════════════════════════════════════════════════════ */

/* Kartu sapaan utama — banner atas beranda */
.greeting-card {
  background: linear-gradient(135deg, var(--color-forest) 0%, var(--color-leaf) 100%);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  padding-bottom: var(--space-8);
  color: #fff;
  margin-bottom: var(--space-5);
  position: relative;
  overflow: hidden;
}

.greeting-card::before {
  display: none;
}

.greeting-card__period {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 1.4px;
  opacity: 0.72;
  margin-bottom: var(--space-2);
  font-weight: var(--weight-medium);
  position: relative;
}

.greeting-card__name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  line-height: 1.25;
  margin-bottom: var(--space-4);
  color: #fff;
  position: relative;
}

.greeting-card__status {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 7px 16px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.3px;
}

.greeting-card__status--done {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
}

.greeting-card__status--pending {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.28);
}

/* Grid statistik 2 kolom */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

/* Bar chart tren — container */
.trend-chart-card {
  background: var(--color-warm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}

.trend-chart-card__subtitle {
  font-size: var(--text-xs);
  color: var(--color-muted);
  margin-bottom: var(--space-3);
}

.trend-chart__bars {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  height: 110px;
  padding: var(--space-2) 0;
}

.trend-chart__bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  height: 100%;
  justify-content: flex-end;
}

.trend-chart__bar {
  width: 100%;
  border-radius: 5px 5px 0 0;
  position: relative;
  animation: barGrow 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.trend-chart__bar-label {
  font-size: 9px;
  font-weight: var(--weight-semibold);
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.trend-chart__bar-value {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: var(--weight-bold);
  color: var(--color-forest);
  white-space: nowrap;
}

/* Daftar kategori breakdown */
.cat-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

/* ══════════════════════════════════════════════════════
   SCREEN: CHECKLIST
   ══════════════════════════════════════════════════════ */

/* Header checklist dengan progress circle */
.checklist-header {
  background: var(--color-warm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.checklist-header__title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--color-forest);
  margin-bottom: 3px;
}

.checklist-header__meta {
  font-size: var(--text-xs);
  color: var(--color-muted);
}

/* Grup pertanyaan per kategori */
.question-group {
  margin-bottom: var(--space-5);
}

.question-group__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.question-group__title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
}

/* Item pertanyaan */
.q-item {
  background: var(--color-warm);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-2);
  transition:
    border-color var(--transition-base),
    background var(--transition-base),
    box-shadow var(--transition-base);
}

.q-item--ya {
  border-color: var(--color-leaf);
  background: #e4f6eb;
  box-shadow: inset 0 0 0 1px rgba(45, 122, 79, 0.18);
}

.q-item--tidak {
  border-color: #8b8f8d;
  background: #f8f9f8;
}

.q-item__number {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-muted);
  margin-bottom: var(--space-2);
}

.q-item__text {
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--color-text);
  margin-bottom: var(--space-3);
}

.q-item__options {
  display: flex;
  gap: var(--space-2);
}

.opt-btn {
  flex: 1;
  padding: 9px var(--space-3);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--color-cream);
  color: var(--color-muted);
}

.opt-btn:hover:not(.opt-btn--selected) {
  border-color: var(--color-sage);
  color: var(--color-forest);
}

.opt-btn--ya.opt-btn--selected {
  background: var(--color-leaf);
  border-color: var(--color-forest);
  color: #fff;
}

.opt-btn--tidak.opt-btn--selected {
  background: #5f6662;
  border-color: #5f6662;
  color: #fff;
}

/* Tombol submit sticky di atas bottom nav */
.checklist-submit-bar {
  position: sticky;
  bottom: calc(var(--bottomnav-height) + var(--space-3));
  padding: var(--space-3) 0 0;
}

/* ══════════════════════════════════════════════════════
   SCREEN: RIWAYAT
   ══════════════════════════════════════════════════════ */

.history-item {
  background: var(--color-warm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.history-item:hover {
  box-shadow: var(--shadow-sm);
  transform: translateX(2px);
}

.history-item__month-badge {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--color-leaf), var(--color-forest));
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.history-item__month-badge .mo {
  font-size: 10px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.8;
}

.history-item__month-badge .yr {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  line-height: 1;
}

.history-item__info {
  flex: 1;
  min-width: 0;
}

.history-item__label {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  margin-bottom: 3px;
}

.history-item__meta {
  font-size: var(--text-xs);
  color: var(--color-muted);
}

.history-item__score {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-forest);
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════
   SCREEN: ADMIN / PIMPINAN
   ══════════════════════════════════════════════════════ */

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

@media (max-width: 380px) {
  .admin-stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.participation-row {
  background: var(--color-warm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 13px var(--space-4);
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  transition: background var(--transition-fast);
}

.participation-row:hover {
  background: var(--color-cream);
}

.participation-row__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--color-forest);
  flex-shrink: 0;
}

.participation-row__name {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text);
}

/* ══════════════════════════════════════════════════════
   RESPONSIF
   ══════════════════════════════════════════════════════ */

@media (max-width: 380px) {
  .login-card {
    padding: var(--space-8) var(--space-6);
  }

  .app-content {
    padding: var(--space-4) var(--space-4);
    padding-bottom: calc(var(--bottomnav-height) + var(--space-4));
  }

  .stats-grid {
    gap: var(--space-2);
  }
}

@media (min-width: 700px) {
  .app-content {
    padding: var(--space-8) var(--space-6);
    padding-bottom: calc(var(--bottomnav-height) + var(--space-8));
  }
}
