/* RESET */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Archivo Black', sans-serif;
}

body {
  background: #0f172a;
  color: #ffffff;
  overflow-x: hidden;
}

/* CONTAINER */
.wrap {
  max-width: 1100px;
  margin: auto;
  padding: 10px 20px 20px;
  overflow: hidden; /* 🔥 cegah zoom ke samping */
}

/* NAVBAR */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: rgba(30,41,59,0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100; /* turunin aja biar aman */
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.brand span {
  font-size: 18px;
}

.nav-links {
  display: flex;
  gap: 20px;
}

.nav-item {
  cursor: pointer;
  opacity: 0.8;
  transition: 0.3s;
}

.nav-item:hover {
  opacity: 1;
  color: #7c3aed;
}

/* GRID */
.grid {
  display: grid;
  gap: 20px; /* 🔥 lebih lega */
  margin-top: 0;
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* CARD */
.card {
  background: #1e293b;
  padding: 22px;
  border-radius: 22px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  transition: 0.25s;
}

.card:hover {
  transform: translateY(-2px);
}

/* TEXT */
h1 {
  font-size: 32px;
  line-height: 1.3;
  margin-bottom: 12px;
}

h2 {
  margin-bottom: 10px;
}

.muted {
  color: #94a3b8;
  margin-bottom: 15px;
  font-size: 14px;
  text-decoration: none;
}

/* BUTTON */
.btn {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  border: none;
  padding: 12px;
  border-radius: 14px;
  color: white;
  cursor: pointer;
  width: 100%;
  margin-top: 12px;
  transition: 0.25s;
}

.btn:hover {
  transform: scale(1.03);
}

/* SECONDARY BUTTON */
.btn-secondary {
  background: #334155;
  border: none;
  padding: 12px;
  border-radius: 14px;
  color: white;
  width: 100%;
  margin-top: 10px;
  cursor: pointer;
  transition: 0.3s;
}

.btn-secondary:hover {
  background: #475569;
}

/* INPUT */
.input {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: none;
  background: #0f172a;
  color: white;
  margin-top: 10px;
  outline: none;
  cursor: pointer;
}

.input::placeholder {
  color: #64748b;
}

input, select, textarea {
  font-size: 16px;
}

/* OPTION */
.option {
  display: flex;
  gap: 12px;
  background: #0f172a;
  padding: 14px;
  border-radius: 16px;
  margin-top: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: 0.2s;
  position: relative;
  overflow: visible;
  transition: all 0.25s ease;
}

.option:hover {
  border: 1px solid #334155;
}

.option.active {
  border: 1px solid #7c3aed;
  background: #020617;
}

.option input {
  display: none;
}

.logo {
  width: 40px;
  height: 40px;
}

.full {
  width: 100%;
}

.opt-title {
  font-size: 16px;
  margin-bottom: 4px;
}

.opt-desc {
  font-size: 12px;
  color: #94a3b8;
}

/* DROPDOWN */
.dropdown-menu {
  display: none;
  background: #020617;
  border-radius: 12px;
  margin-top: 6px;
  border: 1px solid #334155;
  position: absolute; /* 🔥 FIX dropdown nabrak */
  z-index: 999;
  left: 0;
  right: 0;
  top: 100%;
}

.dropdown-menu div {
  padding: 10px;
  cursor: pointer;
  transition: 0.2s;
}

.dropdown-menu div:hover {
  background: #7c3aed;
}

/* TOTAL BOX */
.totalbox {
  margin-top: 12px;
  font-size: 18px;
  font-weight: bold;
}

/* MINI TEXT */
.mini {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 10px;
}

/* TABLE FIX (🔥 INI YANG PALING PENTING) */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

#historyTable {
  width: 100%;
  min-width: 500px;
  border-collapse: collapse;
}

#historyTable th,
#historyTable td {
  padding: 8px;
  font-size: 12px;
  text-align: left;
  word-break: break-word;
}

th {
  color: #94a3b8;
}

tr {
  border-bottom: 1px solid #334155;
}

/* 🔥 cegah table bikin zoom */
#history {
  overflow: hidden;
}


/* =========================================================
   MOBILE
========================================================= */

@media(max-width:480px){

  .popup-box{

    padding:18px;

    border-radius:24px;

    max-width:100%;

  }

  .popup-actions button{

    height:44px;

    font-size:14px;

  }

}

/* LOADER */
#loader {
  position: fixed;
  inset: 0;
  background: #020617;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loader-box {
  text-align: center;
}

.rocket {
  width: 80px;
  animation: float 0.8s infinite ease-in-out;
}

.loading-text {
  margin-top: 10px;
  color: #94a3b8;
}

@keyframes float {
  0% { transform: translateY(0px);}
  50% { transform: translateY(-10px);}
  100% { transform: translateY(0px);}
}

/* RULES */
#rules {
  display: none;
  margin-top: 10px;
  background: #020617;
  padding: 10px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.6;
}

/* RESPONSIVE */
@media (max-width: 600px) {
  h1 {
    font-size: 24px;
  }

  .navbar {
    flex-direction: column;
    gap: 10px;
    transition: transform 0.3s ease;
  }

  .nav-links {
    justify-content: center;
  }
}

#adminPanel {
  z-index: 1000; /* harus LEBIH RENDAH dari popup */
}



.chat-header{

  padding:16px;

  background:
    linear-gradient(
      135deg,
      #7c3aed,
      #4f46e5
    );

  color:white;

  font-weight:bold;

  font-size:15px;

  border-bottom:
    1px solid rgba(255,255,255,.1);
}

.chat-body{

  flex:1;

  overflow-y:auto;

  padding:15px;

  display:flex;

  flex-direction:column;

  gap:12px;

  scroll-behavior:smooth;
}

/* SCROLLBAR */

.chat-body::-webkit-scrollbar{

  width:4px;

}

.chat-body::-webkit-scrollbar-thumb{

  background:#334155;
  border-radius:10px;

}

/* BOT MESSAGE */

.bot-message{

  background:#1e293b;

  padding:12px 14px;

  border-radius:16px;

  color:white;

  font-size:13px;

  line-height:1.7;

  width:fit-content;

  max-width:88%;

  animation:fadeBubble .2s ease;
}

/* USER MESSAGE */

.user-message{

  background:
    linear-gradient(
      135deg,
      #7c3aed,
      #4f46e5
    );

  padding:12px 14px;

  border-radius:16px;

  color:white;

  font-size:13px;

  width:fit-content;

  max-width:88%;

  margin-left:auto;

  animation:fadeBubble .2s ease;
}

@keyframes fadeBubble{

  from{
    opacity:0;
    transform:translateY(6px);
  }

  to{
    opacity:1;
    transform:translateY(0);
  }

}

/* KEYWORDS */

.chat-keywords{

  padding:12px;

  border-top:1px solid #334155;

  display:flex;

  flex-wrap:wrap;

  gap:8px;

  background:#020617;
}

.chat-keywords button{

  background:#1e293b;

  color:white;

  border:none;

  border-radius:12px;

  padding:10px 12px;

  cursor:pointer;

  font-size:12px;

  transition:.2s;
}

.chat-keywords button:hover{

  background:#7c3aed;

  transform:translateY(-1px);

}

/* =========================
TYPING ANIMATION
========================= */

.typing{

  display:flex;

  align-items:center;

  gap:5px;

  background:#1e293b;

  width:fit-content;

  padding:12px 14px;

  border-radius:16px;
}

.typing span{

  width:7px;
  height:7px;

  background:white;

  border-radius:50%;

  animation:typingBounce 1s infinite;
}

.typing span:nth-child(2){

  animation-delay:.2s;

}

.typing span:nth-child(3){

  animation-delay:.4s;

}

@keyframes typingBounce{

  0%{
    transform:translateY(0);
    opacity:.5;
  }

  50%{
    transform:translateY(-5px);
    opacity:1;
  }

  100%{
    transform:translateY(0);
    opacity:.5;
  }

}

/* =========================================================
   POPUP
========================================================= */

.popup{
  position:fixed;
  inset:0;
  display:none;
  justify-content:center;
  align-items:center;
  padding:20px;
  background:rgba(0,0,0,.72);
  backdrop-filter:blur(5px);
  z-index:9999;
  overflow-y:auto;
}

.popup.show{
  display:flex;
}

/* =========================================================
   POPUP BOX
========================================================= */

.popup-box{
  width:100%;
  max-width:380px;
  background:#0f172a;
  border:1px solid #1e293b;
  border-radius:24px;
  padding:20px;
  max-height:88vh;
  overflow-y:auto;
  box-sizing:border-box;
  box-shadow:0 25px 80px rgba(0,0,0,.55);
  position:relative;
  z-index:10000;
  animation:scalePopup .2s ease;
}

.popup-box::-webkit-scrollbar{
  width:4px;
}

.popup-box::-webkit-scrollbar-thumb{
  background:#334155;
  border-radius:999px;
}

.popup-title{
  font-size:18px;
  font-weight:900;
  margin-bottom:14px;
}

.popup-content{
  font-size:14px;
  line-height:1.7;
  color:#cbd5e1;
}

.popup-actions{
  display:flex;
  gap:10px;
  margin-top:20px;
}

.popup-actions button{
  flex:1;
}

/* =========================================================
   CHAT TOGGLE
========================================================= */

.chat-toggle{
  position:fixed;
  right:20px;
  bottom:20px;
  width:58px;
  height:58px;
  border-radius:50%;
  background:linear-gradient(
    135deg,
    #7c3aed,
    #4f46e5
  );
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:26px;
  cursor:pointer;
  z-index:9999;
  box-shadow:0 10px 25px rgba(0,0,0,.4);
  transition:.25s;
}

.chat-toggle:hover{
  transform:scale(1.05);
}

/* =========================================================
   CHATBOT
========================================================= */

.chatbot{
  display:none;
  position:fixed;
  right:20px;
  bottom:90px;
  width:320px;
  height:420px;
  background:#0f172a;
  border:1px solid #1e293b;
  border-radius:18px;
  flex-direction:column;
  overflow:hidden;
  transform:scale(.9);
  opacity:0;
  transition:.25s ease;
  z-index:9999;
}

.chatbot.show{
  display:flex;
  transform:scale(1);
  opacity:1;
}

/* =========================================================
   CHAT OVERLAY
========================================================= */

.chat-overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.2);
  backdrop-filter:blur(4px);
  z-index:9998;
}

/* =========================================================
   INVOICE
========================================================= */

.invoice-box{
  display:flex;
  flex-direction:column;
  gap:14px;
}

.invoice-header{
  font-size:18px;
  font-weight:900;
}

.invoice-row{
  display:flex;
  justify-content:space-between;
  gap:10px;
  font-size:14px;
}

.invoice-link{
  max-width:160px;
  overflow:hidden;
  text-overflow:ellipsis;
  text-align:right;
  word-break:break-word;
}

.invoice-line{
  height:1px;
  background:#334155;
}

.invoice-total{
  display:flex;
  justify-content:space-between;
  align-items:center;
}

.invoice-price{
  font-size:28px;
  font-weight:900;
  color:#7c3aed;
}

.invoice-check{
  display:flex;
  align-items:center;
  gap:10px;
  font-size:13px;
}

.invoice-rules{
  background:#020617;
  border:1px solid #334155;
  border-radius:16px;
  padding:14px;
  font-size:12px;
  line-height:1.7;
  color:#cbd5e1;
}

/* =========================================================
   ANIMATION
========================================================= */

@keyframes scalePopup{

  from{
    transform:scale(.92);
    opacity:0;
  }

  to{
    transform:scale(1);
    opacity:1;
  }

}

/* =========================================================
   MOBILE
========================================================= */

@media(max-width:500px){

  .chatbot{
    width:92%;
    right:4%;
    bottom:82px;
    height:440px;
  }

  .popup-box{
    max-width:100%;
    border-radius:22px;
    padding:18px;
  }

  .invoice-price{
    font-size:24px;
  }

}

.receipt-item{
  display:flex;
  justify-content:space-between;
  gap:15px;
  padding:14px 0;
  border-bottom:1px solid rgba(255,255,255,.08);
}

.receipt-item span{
  color:#94a3b8;
  font-size:14px;
}

.receipt-item b{
  color:white;
  font-size:14px;
  text-align:right;
}

body.chat-active {
  overflow: hidden;
}

/* BLUR BACKGROUND */
body.chat-active .wrap,
body.chat-active .navbar {
  filter: blur(6px);
  transition: 0.25s ease;
}

/* CHAT ANIMATION */
.chatbot {
  display: none;
  position: fixed;
  right: 20px;
  bottom: 80px;
  width: 320px;
  height: 420px;
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 16px;
  flex-direction: column;
  overflow: hidden;

  transform: scale(0.9);
  opacity: 0;
  transition: 0.25s ease;
  z-index: 9999;
}

.chatbot.show {
  display: flex;
  transform: scale(1);
  opacity: 1;
}

/* OVERLAY CLICK OUTSIDE */
.chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.2);
  backdrop-filter: blur(4px);
  z-index: 9998;
}


/* =========================================================
   MOBILE
========================================================= */

@media(max-width:480px){

  .invoice-header{
    font-size:16px;
  }

  .invoice-row{
    font-size:13px;
  }

  .invoice-total span:first-child{
    font-size:20px;
  }

  .invoice-price{
    font-size:24px;
  }

  .invoice-rules{
    font-size:12px;
    padding:14px;
  }

}

/* =========================================================
   HIDE CHAT WHEN POPUP OPEN
========================================================= */

.popup.show ~ .chat-toggle,
.popup.show ~ .chatbot{

  display:none !important;

  }
  
