/* Custom Styles & Print Styles for KasirKu POS & Akuntansi */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --secondary: #0ea5e9;
  --accent: #10b981;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: #1e293b;
  background-color: #f8fafc;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Glassmorphism */
.glass-header {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Smooth Tab Transitions */
.tab-content {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}
.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* POS Product Card */
.pos-card {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.pos-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

/* Struk Kasir Thermal Print Styling */
.receipt-paper {
  background: #ffffff;
  color: #000000;
  font-family: 'Courier New', Courier, monospace;
  padding: 14px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
  border-top: 4px dashed #6366f1;
  transition: width 0.2s;
}

.receipt-paper.paper-58mm {
  width: 58mm;
  max-width: 58mm;
  font-size: 11px;
  padding: 8px 6px;
}

.receipt-paper.paper-80mm {
  width: 80mm;
  max-width: 80mm;
  font-size: 12px;
  padding: 14px 10px;
}

.receipt-dashed {
  border-top: 1px dashed #6b7280;
  margin: 6px 0;
}

@media print {
  @page {
    margin: 0;
    size: auto;
  }
  body {
    background: white !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  body * {
    visibility: hidden;
  }
  #printable-receipt-area, #printable-receipt-area * {
    visibility: visible;
  }
  #printable-receipt-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    background: white;
  }
  .no-print {
    display: none !important;
  }
}

/* Pulse animation for live sync badge */
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
}
.live-dot {
  animation: pulseGlow 2s infinite;
}

/* ==========================================================
   BEGINNER-FRIENDLY UI
   ========================================================== */
html {
  scroll-behavior: smooth;
}
body {
  overflow-x: hidden;
}

/* Contextual help banner shown at the top of each module */
.beginner-help {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid #c7d2fe;
  background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
  color: #312e81;
  box-shadow: 0 6px 18px -12px rgba(79, 70, 229, 0.45);
}
.beginner-help .help-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #e0e7ff;
  color: #4338ca;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.beginner-help .help-title {
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 2px;
}
.beginner-help .help-text {
  font-size: 12px;
  line-height: 1.55;
  color: #4338ca;
}
.beginner-help .help-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 6px;
}
.beginner-help .help-step {
  font-size: 11px;
  font-weight: 600;
  color: #4f46e5;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.beginner-help .help-step b {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #4f46e5;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
}
.beginner-help .help-close {
  margin-left: auto;
  color: #818cf8;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.beginner-help .help-close:hover {
  background: #e0e7ff;
  color: #4338ca;
}
.beginner-help .help-link {
  color: #4338ca;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}
.beginner-help .help-link:hover {
  color: #312e81;
}

/* Onboarding checklist */
.onboarding-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 30px -22px rgba(15, 23, 42, 0.35);
}
.onboarding-header {
  background: linear-gradient(120deg, #312e81 0%, #4f46e5 55%, #7c3aed 100%);
  color: #fff;
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}
.onboarding-header::after {
  content: '';
  position: absolute;
  right: -40px;
  top: -60px;
  width: 180px;
  height: 180px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}
.onboarding-progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
}
.onboarding-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: #34d399;
  transition: width 0.4s ease;
}
.onboarding-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: #fff;
  text-align: left;
  transition: all 0.18s ease;
  width: 100%;
}
.onboarding-step:hover {
  border-color: #a5b4fc;
  background: #f5f7ff;
  transform: translateY(-1px);
}
.onboarding-step .step-dot {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
  flex-shrink: 0;
}
.onboarding-step.done {
  background: #ecfdf5;
  border-color: #a7f3d0;
}
.onboarding-step.done .step-dot {
  background: #10b981;
  color: #fff;
}
.onboarding-step.next {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

/* Interactive tour highlight */
.tour-highlight {
  position: relative !important;
  z-index: 65 !important;
  outline: 3px solid #818cf8;
  outline-offset: 3px;
  border-radius: 12px;
  scroll-margin: 120px;
  animation: tourPulse 1.8s ease-in-out infinite;
  background-color: rgba(99, 102, 241, 0.12) !important;
}
@keyframes tourPulse {
  0%, 100% { outline-color: #818cf8; box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.35); }
  50% { outline-color: #4f46e5; box-shadow: 0 0 0 8px rgba(99, 102, 241, 0); }
}

/* Guide accordions */
.guide-card {
  border-radius: 0;
}
.guide-card > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  transition: background 0.15s ease;
}
.guide-card > summary::-webkit-details-marker {
  display: none;
}
.guide-card > summary:hover {
  background: #f8fafc;
}
.guide-card[open] > summary {
  background: #f8fafc;
}
.guide-card .guide-chevron {
  transition: transform 0.2s ease;
}
.guide-card[open] .guide-chevron {
  transform: rotate(180deg);
}
.guide-step-number {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  flex-shrink: 0;
}

/* FAQ */
.faq-item > summary {
  list-style: none;
  cursor: pointer;
  padding: 15px 20px;
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.faq-item > summary::-webkit-details-marker {
  display: none;
}
.faq-item > summary:hover {
  background: #f8fafc;
}
.faq-item[open] > summary {
  background: #f8fafc;
}
.faq-item .faq-answer {
  padding: 0 20px 16px 20px;
  font-size: 12px;
  line-height: 1.65;
  color: #475569;
}

/* Welcome modal animation */
#modal-welcome > div,
#tour-card {
  animation: popIn 0.22s ease-out;
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Small screens: make tables and action bars breathe */
@media (max-width: 640px) {
  .receipt-paper.paper-58mm,
  .receipt-paper.paper-80mm {
    max-width: 100%;
  }
  .beginner-help {
    padding: 12px;
  }
  .beginner-help .help-steps {
    display: none;
  }
}

/* ==========================================================
   MOBILE VIEWPORT / SAFE AREA
   Keep bottom actions above phone browser and home-indicator bars.
   ========================================================== */
@supports (height: 100dvh) {
  html, body { min-height: 100dvh; }
  body, #app-shell { height: 100dvh; }
}

#app-main {
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

#sidebar > div:last-child {
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
}

@media (max-width: 1023.98px) {
  #sidebar {
    height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom);
  }
  #sidebar nav {
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
  }
  #tour-card {
    bottom: calc(1rem + env(safe-area-inset-bottom));
  }
  #toast-container {
    top: calc(4.75rem + env(safe-area-inset-top));
    right: 1rem;
  }
  /* Keep modal content inside the visual viewport, not behind mobile chrome. */
  #dynamic-modals > div,
  #modal-auth,
  #modal-product,
  #modal-welcome,
  #modal-receipt {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom)) !important;
  }
  #dynamic-modals > div > div,
  #modal-auth > div,
  #modal-welcome > div,
  #modal-receipt > div {
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 1.25rem);
  }
  #modal-product > div {
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 1.25rem);
    display: flex;
    flex-direction: column;
  }
  #modal-product > div > form {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (display-mode: standalone) {
  #app-shell > header {
    padding-top: env(safe-area-inset-top);
    height: calc(4rem + env(safe-area-inset-top));
  }
  #sidebar {
    padding-top: env(safe-area-inset-top);
  }
}

/* Phones: keep the header within the visual viewport and modals fully visible. */
@media (max-width: 767.98px) {
  #app-shell > header {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    gap: 0.25rem;
  }
  #app-shell > header > div:last-child {
    gap: 0.25rem;
  }
  #app-shell > header button[onclick="switchView('guide')"],
  #header-install-app {
    display: none !important;
  }
  #modal-welcome > div,
  #modal-auth > div,
  #modal-product > div,
  #modal-receipt > div,
  #dynamic-modals > div > div {
    max-width: calc(100vw - 2rem) !important;
  }
  #modal-welcome > div {
    width: calc(100vw - 2rem);
  }
}
