/* ====================================================
   MATCHAJI — PROCESS 3D STYLING (PREMIUM GLASSMORPHISM)
   ==================================================== */

html {
  scroll-snap-type: none !important; /* Override global scroll-snap to prevent bouncing */
}

:root {
  --sidebar-w: 420px;
  --accent-light: #4A6E56;
  --accent-glow: rgba(45, 76, 56, 0.15);
  --success: #2e7d32;
  --card-bg: rgba(253, 251, 247, 0.85);
  --glass-border: rgba(0, 0, 0, 0.06);
}

body {
  background: var(--bg);
  scroll-snap-type: none !important;
}

/* CONTAINER LAYOUT */
.process-container {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding-top: 5rem; /* Space for fixed nav */
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

/* TIMELINE TOPBAR */
.process-timeline-wrapper {
  width: 100%;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  z-index: 50;
  display: flex;
  justify-content: center;
}

.process-timeline {
  display: flex;
  width: 100%;
  max-width: 1100px;
  justify-content: space-between;
  position: relative;
}

.process-timeline::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
  transform: translateY(-50%);
  z-index: 1;
}

.timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
  cursor: pointer;
  background: var(--bg);
  padding: 0 1rem;
  transition: all 0.4s var(--ease);
}

.timeline-step .step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg2);
  border: 2px solid var(--border);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  transition: all 0.4s var(--ease);
}

.timeline-step .step-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.4s var(--ease);
}

/* Active State */
.timeline-step.active .step-num {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  box-shadow: 0 0 0 6px var(--accent-glow);
  transform: scale(1.1);
}

.timeline-step.active .step-label {
  color: var(--accent);
  font-weight: 800;
}

/* Completed State */
.timeline-step.completed .step-num {
  background: var(--accent-light);
  border-color: var(--accent-light);
  color: var(--bg);
}

/* VIEWPORT CONTAINER */
.experience-viewport {
  flex: 1;
  display: flex;
  position: relative;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}

/* 3D CANVAS */
#canvas-container {
  flex: 1;
  height: 100%;
  position: relative;
  background: #EAE6DF; /* Premium warm clay/mist studio background */
  touch-action: none; /* Prevent touch drag from causing browser scroll bounce */
}

.canvas-loader {
  position: absolute;
  inset: 0;
  background: #EAE6DF;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  z-index: 100;
  transition: opacity 0.5s ease, visibility 0.5s;
}

.canvas-loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.canvas-loader span {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.05em;
}

/* SIDEBAR CARD */
.info-sidebar {
  width: var(--sidebar-w);
  height: 100%;
  display: flex;
  padding: 1.5rem;
  box-sizing: border-box;
  z-index: 10;
  position: relative;
}

.sidebar-card {
  width: 100%;
  height: 100%;
  background: var(--card-bg);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 2rem;
  box-shadow: 0 30px 70px -10px rgba(45, 76, 56, 0.12), 
              inset 0 1px 0 rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-sizing: border-box;
  transition: all 0.4s var(--ease);
}

.step-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.step-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 0.35rem 0.8rem;
  border-radius: 9999px;
  text-transform: uppercase;
}

.mini-progress-track {
  width: 100px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.mini-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.6s var(--ease);
}

.step-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 0.2rem;
}

.step-subtitle {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.text-separator {
  width: 40px;
  height: 2px;
  background: var(--accent);
  margin: 1.2rem 0;
}

.step-description {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #333333;
}

/* CONTROLS AREA */
.step-controls-wrap {
  margin: 2rem 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.control-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
  display: block;
}

.step-controls-inner {
  position: relative;
  flex: 1;
}

.step-control-panel {
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.step-control-panel.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* PREMIUM SLIDERS */
.slider-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.6rem;
}

.premium-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  margin-bottom: 1.2rem;
  transition: all 0.3s;
}

.premium-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(45, 76, 56, 0.3);
  transition: transform 0.2s, background-color 0.2s;
}

.premium-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: var(--accent-light);
}

.premium-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(45, 76, 56, 0.3);
  transition: transform 0.2s, background-color 0.2s;
}

.premium-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
  background: var(--accent-light);
}

/* HELPER MESSAGES */
.control-info-msg {
  display: flex;
  gap: 0.6rem;
  background: var(--bg2);
  padding: 0.8rem 1rem;
  border-radius: 12px;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--muted);
  border-left: 3px solid var(--accent);
}

.control-info-msg svg {
  flex-shrink: 0;
  color: var(--accent);
  margin-top: 0.1rem;
}

/* BUTTONS */
.btn-interactive {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.6rem 1.2rem;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s var(--ease);
}

.btn-interactive:hover {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.btn-interactive.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.flex-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.indicator-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.ind-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
}

.ind-val {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.text-success {
  color: var(--success) !important;
}

/* HARVEST EXTRA */
.harvest-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.status-counter {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
}

.basket-track {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  margin-bottom: 1.5rem;
}

.basket-fill {
  background: linear-gradient(90deg, var(--accent-light), var(--accent));
}

/* GRINDING PROGRESS */
.grind-track {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  margin-bottom: 1.5rem;
  background: var(--border);
}

.grind-fill {
  background: #8da47e;
  transition: width 0.1s linear;
}

/* NAV FOOTER */
.sidebar-nav-footer {
  display: flex;
  gap: 1rem;
  margin-top: auto;
}

.sidebar-nav-footer button {
  flex: 1;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  box-sizing: border-box;
}

.nav-btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.nav-btn-secondary:hover:not(:disabled) {
  background: var(--bg2);
  border-color: var(--text);
}

.nav-btn-secondary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.nav-btn-primary {
  background: var(--text);
  color: var(--bg);
  border: 1px solid var(--text);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

.nav-btn-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 12px 25px var(--accent-glow);
}

/* SUCCESS OVERLAY */
.success-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 18, 0.7);
  backdrop-filter: blur(15px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s;
}

.success-overlay.active {
  opacity: 1;
  visibility: visible;
}

.success-modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 32px;
  padding: 3rem;
  max-width: 500px;
  width: 90%;
  text-align: center;
  box-shadow: 0 40px 100px -10px rgba(0,0,0,0.3);
  transform: scale(0.85);
  transition: transform 0.5s var(--ease);
}

.success-overlay.active .success-modal {
  transform: scale(1);
}

.success-icon-wrap {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--accent-glow);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}

.success-icon-wrap svg {
  width: 32px;
  height: 32px;
}

.success-modal h2 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 1rem;
}

.success-modal p {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 2.2rem;
}

.success-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.success-buttons button, .success-buttons a {
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 9999px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary-light {
  background: var(--accent);
  color: var(--bg);
  border: 1px solid var(--accent);
}

.btn-primary-light:hover {
  background: var(--text);
  border-color: var(--text);
}

.btn-secondary-light {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary-light:hover {
  background: var(--bg2);
}

/* RESPONSIVE DESIGN & MOBILE UX OPTIMIZATIONS */
@media (max-width: 1024px) {
  .process-timeline-wrapper {
    overflow-x: auto;
    padding: 0.6rem 1rem;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
  }
  
  .process-timeline {
    width: 600px;
    margin: 0;
  }

  .experience-viewport {
    flex-direction: column;
    height: calc(100dvh - 88px - 58px); /* total height minus nav & timeline */
    overflow: hidden;
  }

  #canvas-container {
    height: 38%; /* Fixed top split viewport */
    width: 100%;
    flex: none;
  }

  .info-sidebar {
    height: 62%; /* Bottom sheet */
    width: 100%;
    flex: none;
    padding: 0.6rem;
    box-sizing: border-box;
  }

  .sidebar-card {
    height: 100%;
    padding: 1.2rem;
    padding-bottom: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 18px;
    box-shadow: 0 15px 40px -10px rgba(45, 76, 56, 0.1);
  }
  
  .step-controls-wrap {
    margin: 1.2rem 0;
  }

  .sidebar-nav-footer {
    margin-top: 1rem;
    padding-top: 0.6rem;
    padding-bottom: 0.8rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
  }
}

@media (max-width: 600px) {
  .process-container {
    padding-top: 5.5rem; /* nav is at top:1.5rem + ~50px height = ~74px; use 88px to be safe */
  }
  
  .process-timeline-wrapper {
    padding: 0.5rem 0.8rem;
  }

  .process-timeline {
    width: 500px;
  }

  .timeline-step .step-num {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
    border-width: 1.5px;
    margin-bottom: 0.2rem;
  }

  .timeline-step .step-label {
    font-size: 0.6rem;
  }

  .timeline-step.active .step-num {
    box-shadow: 0 0 0 4px var(--accent-glow);
  }

  .step-title {
    font-size: 1.3rem;
  }

  .step-subtitle {
    font-size: 0.75rem;
  }

  .text-separator {
    margin: 0.8rem 0;
  }

  .step-description {
    font-size: 0.82rem;
    line-height: 1.5;
  }

  .step-controls-wrap {
    margin: 1rem 0;
  }

  .control-section-title {
    font-size: 0.7rem;
    margin-bottom: 0.6rem;
  }

  /* Make sliders extremely finger-friendly on mobile touchscreens */
  .premium-slider {
    height: 8px; /* Taller track */
  }

  .premium-slider::-webkit-slider-thumb {
    width: 24px; /* Larger hit target */
    height: 24px;
    box-shadow: 0 4px 12px rgba(45, 76, 56, 0.4);
  }

  .premium-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    box-shadow: 0 4px 12px rgba(45, 76, 56, 0.4);
  }

  .btn-interactive {
    padding: 0.7rem 1.2rem; /* Larger tap target */
    font-size: 0.85rem;
  }

  .sidebar-nav-footer button {
    height: 46px;
    font-size: 0.82rem;
  }

  .success-modal {
    padding: 2rem 1.5rem;
    border-radius: 24px;
  }

  .success-modal h2 {
    font-size: 1.4rem;
  }

  .success-modal p {
    font-size: 0.85rem;
    margin-bottom: 1.8rem;
  }
}
