/* =======================================================
   SUCODE Industries - Loading & Dashboard Stylesheet
   ======================================================= */

/* Global Reset & Base Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-color: #ffffff;
  --yellow-color: #ffef40; /* High vibrance solid yellow matching the design */
  --yellow-accent: #fcd34d;
  --black-color: #000000;
  --text-muted: #6b7280;
  --bar-height: 15px; /* Lebar ke atas (tebal) */
  --font-main: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Oswald', 'Montserrat', sans-serif;
}

body {
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-color);
  font-family: var(--font-main);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
}

.main-container {
  width: 100vw;
  height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Topographic Background Pattern */
.topographic-bg {
  position: absolute;
  top: -4%;
  left: -4%;
  width: 108vw;
  height: 108vh;
  background-image: url('topography.svg');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  opacity: 0.10;
  pointer-events: none;
  z-index: 0; /* Lapisan terbawah */
  will-change: transform;
}

/* Screen Views Container */
.screen-view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.screen-view.active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

/* =======================================================
   1. LOADING SCREEN
   ======================================================= */
.loading-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  perspective: 1200px;
  transform-style: preserve-3d;
}

/* Brand Logo (Center) */
.logo-wrapper {
  position: absolute;
  top: 43%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  will-change: transform;
  transform-style: preserve-3d;
  transition: opacity 0.3s ease;
}

.brand-logo {
  width: clamp(230px, 22vw, 320px);
  height: auto;
  display: block;
}

/* Dual Sided Loading Track */
.loader-track-container {
  position: absolute;
  top: 67%;
  left: 0;
  width: 100vw;
  height: 54px;
  display: flex;
  align-items: flex-end;
  pointer-events: none;
  z-index: 10; /* Berada di atas background agar warna kuning solid 100% */
  will-change: transform;
}

/* Progress Arms */
.progress-arm {
  position: absolute;
  bottom: 0;
  height: var(--bar-height);
  display: flex;
  align-items: center;
}

/* Left Arm: starts at Left 0, extends to the right */
.left-arm {
  left: 0;
  justify-content: flex-end;
}

/* Right Arm: starts at Right 0, extends to the left */
.right-arm {
  right: 0;
  justify-content: flex-start;
}

/* 
  Slope calculation for Height = 15px, dx = 7px.
  Angle is arctan(7/15) ≈ 25°.
*/
.left-arm .bar-fill {
  height: 100%;
  flex: 1 1 auto;
  background-color: var(--yellow-color);
  clip-path: polygon(0 0, 100% 0, calc(100% - 7px) 100%, 0 100%);
  transition: clip-path 0.3s ease;
}

.chevron {
  transition: opacity 0.3s ease, width 0.3s ease, margin 0.3s ease;
}

.left-arm .chevron-1 {
  width: 13px; /* 6px content + 7px slant */
  height: 100%;
  margin-left: -3px; /* Gap 4px: (4 - 7 = -3px) */
  background-color: var(--yellow-color);
  clip-path: polygon(7px 0, 100% 0, calc(100% - 7px) 100%, 0 100%);
  flex-shrink: 0;
}

.left-arm .chevron-2 {
  width: 11px; /* 4px content + 7px slant */
  height: 100%;
  margin-left: -3px;
  background-color: var(--yellow-color);
  clip-path: polygon(7px 0, 100% 0, calc(100% - 7px) 100%, 0 100%);
  flex-shrink: 0;
}

/* Right Arm Elements */
.right-arm .chevron-2 {
  width: 11px; /* 4px content + 7px slant */
  height: 100%;
  background-color: var(--yellow-color);
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 100%, 7px 100%);
  flex-shrink: 0;
}

.right-arm .chevron-1 {
  width: 13px; /* 6px content + 7px slant */
  height: 100%;
  margin-left: -3px;
  background-color: var(--yellow-color);
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 100%, 7px 100%);
  flex-shrink: 0;
}

.right-arm .bar-fill {
  height: 100%;
  flex: 1 1 auto;
  margin-left: -3px;
  background-color: var(--yellow-color);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 7px 100%);
  transition: clip-path 0.3s ease;
}

/* Percentage Labels (Left & Right) */
.percent-label {
  position: absolute;
  bottom: calc(var(--bar-height) + 7px);
  font-size: 14px;
  font-weight: 800;
  color: var(--black-color);
  letter-spacing: -0.2px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.25s ease;
}

.left-arm .percent-label {
  right: 8px;
  transform: translateX(0);
}

.right-arm .percent-label {
  left: 8px;
  transform: translateX(0);
}

/* Unified Center Percentage Label (Hanya 1 angka saat 100%) */
.center-percent-label {
  position: absolute;
  bottom: calc(var(--bar-height) + 7px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  font-size: 14px;
  font-weight: 800;
  color: var(--black-color);
  letter-spacing: -0.2px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 12;
}

/* Completion State: Bar Menyatu Jadi 1 Solid Garis Penuh */
.loader-track-container.completed .center-percent-label {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.loader-track-container.completed .left-arm .percent-label,
.loader-track-container.completed .right-arm .percent-label {
  opacity: 0;
}

.loader-track-container.completed .left-arm .bar-fill,
.loader-track-container.completed .right-arm .bar-fill {
  clip-path: none;
  margin: 0;
}

.loader-track-container.completed .chevron {
  width: 0 !important;
  margin: 0 !important;
  opacity: 0 !important;
  clip-path: none !important;
}

/* =======================================================
   2. TRANSITION CURTAIN (Melebar ke Atas & Bawah)
   ======================================================= */
.transition-curtain {
  position: fixed;
  left: 0;
  width: 100vw;
  background-color: var(--yellow-color);
  z-index: 100;
  pointer-events: none;
  display: none;
  opacity: 0;
  /* Dimulai tepat pada posisi bar kuning loading (top: 67% + margin, height: 15px) */
  top: calc(67% + 39px);
  height: var(--bar-height);
  transition: 
    top 0.75s cubic-bezier(0.77, 0, 0.175, 1),
    height 0.75s cubic-bezier(0.77, 0, 0.175, 1),
    opacity 0.4s ease,
    transform 0.6s cubic-bezier(0.77, 0, 0.175, 1);
}

.transition-curtain.active {
  display: block;
  opacity: 1;
}

/* Melebar ke atas dan kebawah menutupi seluruh layar */
.transition-curtain.expanding {
  top: 0 !important;
  height: 100vh !important;
}

/* Wipe up / fade out reveal untuk menampilkan dashboard */
.transition-curtain.revealing {
  transform: translateY(-100%);
  opacity: 0.95;
}

/* =======================================================
   3. DASHBOARD SCREEN
   ======================================================= */
.dashboard-screen {
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  background-color: transparent;
}

.dashboard-screen.active {
  display: flex;
}

/* Sidebar Navigation (Left Floating Card) */
.sidebar-panel {
  position: absolute;
  left: clamp(20px, 3.5vw, 60px);
  top: 50%;
  transform: translateY(-50%) translateX(-20px);
  width: clamp(140px, 12.5vw, 175px);
  background-color: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  z-index: 20;
  opacity: 0;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s ease;
  overflow: hidden;
}

.dashboard-screen.active .sidebar-panel {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.nav-menu {
  display: flex;
  flex-direction: column;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  position: relative;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.nav-item:hover {
  background-color: #f3f4f6;
  color: #111827;
}

.nav-item.active {
  background-color: #ebebeb;
  color: #000000;
}

.active-indicator {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3.5px;
  background-color: #000000;
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-item.active .nav-icon {
  color: #000000;
}

.nav-item:not(.active) .nav-icon {
  color: #9ca3af;
}

.nav-label {
  white-space: nowrap;
  transition: opacity 0.5s ease;
}

/* Metrics Pillars Container (4 Pillars Layout) */
.metrics-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2.2vw, 36px);
  height: 100vh;
  width: 100%;
  padding-left: clamp(140px, 13vw, 200px);
  padding-right: clamp(16px, 2.5vw, 40px);
  perspective: 1200px;
  transform-style: preserve-3d;
}

/* Each Metric Pillar */
.metric-pillar {
  width: clamp(110px, 11.5vw, 175px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(35px);
  transition: transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.6s ease;
  transform-style: preserve-3d;
  will-change: transform;
}

.dashboard-screen.active .metric-pillar {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered entrance animations */
.dashboard-screen.active .pillar-suhu {
  transition-delay: 0.1s;
}
.dashboard-screen.active .pillar-ph {
  transition-delay: 0.2s;
}
.dashboard-screen.active .pillar-tds {
  transition-delay: 0.3s;
}
.dashboard-screen.active .pillar-udara {
  transition-delay: 0.4s;
}

/* Specific heights matching the design rhythm */
.pillar-suhu {
  height: 76vh;
}

.pillar-ph {
  height: 87vh; /* Paling tinggi, menjulang ke atas dan ke bawah */
}

.pillar-tds {
  height: 72vh; /* Sedikit lebih pendek */
}

.pillar-udara {
  height: 78vh; /* Sejajar proporsional di samping TDS */
}

/* Pillar Gradient Shading: transparan -> hitam solid di tengah -> transparan */
.pillar-gradient {
  width: 100%;
  height: 100%;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.5) 15%,
    rgba(0, 0, 0, 0.95) 28%,
    rgba(0, 0, 0, 1) 36%,
    rgba(0, 0, 0, 1) 64%,
    rgba(0, 0, 0, 0.95) 72%,
    rgba(0, 0, 0, 0.5) 85%,
    rgba(0, 0, 0, 0) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
}

.pillar-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #ffffff;
  padding: 10px;
  transform-style: preserve-3d;
  will-change: transform;
}

/* Judul Metrik: Putih bersih solid (tanpa glow), berjarak lega tidak nempel */
.metric-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 2.8vw, 38px);
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  line-height: 1.35; /* Spasi antar baris SUHU dan AIR/UDARA agar tidak nempel */
  letter-spacing: 2px; /* Jarak antar huruf agar lega */
  text-transform: uppercase;
  margin-bottom: 22px; /* Jarak ke nilai angka di bawahnya agar melayang bebas */
  transition: opacity 0.5s ease;
}

/* Nilai Metrik: Putih bersih solid (tanpa glow) dan berjarak proporsional */
.metric-value {
  font-family: var(--font-display);
  font-size: clamp(30px, 3.4vw, 48px);
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  line-height: 1.2;
  letter-spacing: 1.5px;
  font-variant-numeric: tabular-nums;
  transition: opacity 0.5s ease;
}



/* Responsive Layout */
@media (max-width: 768px) {
  :root {
    --bar-height: 12px;
  }
  .sidebar-panel {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90vw;
  }
  .dashboard-screen.active .sidebar-panel {
    transform: translateX(-50%);
  }
  .nav-menu {
    flex-direction: row;
    justify-content: space-around;
  }
  .nav-item.active .active-indicator {
    width: 100%;
    height: 3px;
    top: auto;
    bottom: 0;
    left: 0;
  }
  .metrics-container {
    padding-left: 20px;
    padding-right: 20px;
    gap: 12px;
  }
  .metric-title {
    font-size: 20px;
  }
  .metric-value {
    font-size: 24px;
  }
}
