@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap");

:root {
  --emerald-glow: rgba(16, 185, 129, 0.15);
  --card-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
  --card-shadow-hover: 0 8px 30px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  --card-radius: 1.25rem;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: "Inter", sans-serif;
  background: linear-gradient(135deg, #f0f4f8 0%, #f8fafc 50%, #f0f2f5 100%);
  overflow: hidden;
}

/* ===== Premium Loader ===== */
.loader {
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top: 3px solid #10b981;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== Scrollbars ===== */
.hide-scroll::-webkit-scrollbar { display: none; }
.hide-scroll { -ms-overflow-style: none; scrollbar-width: none; }

.table-scroll::-webkit-scrollbar { width: 4px; height: 6px; }
.table-scroll::-webkit-scrollbar-track { background: transparent; }
.table-scroll::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 10px; }
.table-scroll::-webkit-scrollbar-thumb:hover { background: #a1a1aa; }

.custom-scroll::-webkit-scrollbar { width: 4px; height: 4px; }
.custom-scroll::-webkit-scrollbar-track { background: transparent; }
.custom-scroll::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 10px; }
.custom-scroll::-webkit-scrollbar-thumb:hover { background: #a1a1aa; }

/* ===== Navigation ===== */
.nav-active {
  background: linear-gradient(135deg, rgba(16,185,129,0.15), rgba(16,185,129,0.05)) !important;
  color: #ffffff !important;
  box-shadow: inset 3px 0 0 #10b981, 0 0 20px rgba(16,185,129,0.05);
  border-radius: 0 0.75rem 0.75rem 0;
}
.nav-active i {
  color: #34d399 !important;
  opacity: 1 !important;
  filter: drop-shadow(0 0 4px rgba(52,211,153,0.4));
}

/* ===== Form Inputs — Premium ===== */
input, select, textarea {
  transition: var(--transition-smooth);
}

@media screen and (max-width: 768px) {
  input, select, textarea { font-size: 16px !important; }
}

/* ===== SweetAlert Premium ===== */
.swal2-container {
  z-index: 99999 !important;
  padding-bottom: 85px !important; /* Mencegah tertutup navbar bawah */
}
.swal2-popup {
  border-radius: 1.5rem !important;
  padding: 1.5rem !important;
  box-shadow: 0 25px 60px rgba(0,0,0,0.15) !important;
  max-height: calc(100vh - 120px) !important;
  overflow-y: auto !important;
}
.swal2-html-container {
  overflow-y: auto !important;
  padding-right: 4px;
}
.swal2-input-custom {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid #e4e4e7;
  border-radius: 0.8rem;
  background-color: #fafafa;
  font-size: 0.875rem;
  transition: all 0.2s;
  outline: none;
}
.swal2-input-custom:focus {
  border-color: #10b981;
  background-color: #ffffff;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

/* ===== Custom SweetAlert Buttons ===== */
.btn-wa-bot {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
  color: white !important;
  border-radius: 0.75rem !important;
  padding: 0.75rem 1.5rem !important;
  margin: 0.35rem !important;
  border: none !important;
  font-weight: 600 !important;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4) !important;
  transition: all 0.2s ease !important;
}
.btn-wa-bot:hover { opacity: 0.9 !important; transform: translateY(-1px) !important; }

.btn-wa-manual {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: white !important;
  border-radius: 0.75rem !important;
  padding: 0.75rem 1.5rem !important;
  margin: 0.35rem !important;
  border: none !important;
  font-weight: 600 !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4) !important;
  transition: all 0.2s ease !important;
}
.btn-wa-manual:hover { opacity: 0.9 !important; transform: translateY(-1px) !important; }

.btn-wa-cancel {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  color: white !important;
  border-radius: 0.75rem !important;
  padding: 0.75rem 1.5rem !important;
  margin: 0.35rem !important;
  border: none !important;
  font-weight: 600 !important;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4) !important;
  transition: all 0.2s ease !important;
}
.btn-wa-cancel:hover { opacity: 0.9 !important; transform: translateY(-1px) !important; }

/* ===== Glass Panels ===== */
.glass-panel {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
.dark-glass {
  background: rgba(9, 9, 11, 0.92);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ===== Premium Stat Cards ===== */
.stat-card {
  background: white;
  border: 1px solid rgba(0,0,0,0.04);
  border-radius: var(--card-radius);
  padding: 1rem;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  border-radius: 0 0 0 100%;
  opacity: 0.07;
  transition: var(--transition-smooth);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
}
.stat-card:hover::before {
  opacity: 0.12;
  width: 100px;
  height: 100px;
}

.stat-card.emerald::before { background: #10b981; }
.stat-card.blue::before { background: #3b82f6; }
.stat-card.red::before { background: #ef4444; }
.stat-card.amber::before { background: #f59e0b; }
.stat-card.orange::before { background: #f97316; }
.stat-card.teal::before { background: #14b8a6; }

.stat-card .stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: var(--transition-smooth);
}
.stat-card:hover .stat-icon {
  transform: scale(1.1) rotate(-3deg);
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
}

.stat-card .stat-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.5;
}

/* ===== Premium Page Containers ===== */
.page-container {
  background: white;
  border-radius: var(--card-radius);
  border: 1px solid rgba(0,0,0,0.04);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.page-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.page-header-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

/* ===== Premium Buttons ===== */
.btn-primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  font-weight: 700;
  padding: 0.625rem 1.25rem;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  transition: var(--transition-smooth);
  box-shadow: 0 2px 8px rgba(16,185,129,0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(16,185,129,0.35);
  transform: translateY(-1px);
}

.btn-dark {
  background: linear-gradient(135deg, #18181b 0%, #27272a 100%);
  color: white;
  font-weight: 700;
  padding: 0.625rem 1.25rem;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  transition: var(--transition-smooth);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.btn-dark:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  font-weight: 700;
  padding: 0.625rem 1.25rem;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  transition: var(--transition-smooth);
  box-shadow: 0 2px 8px rgba(239,68,68,0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.btn-danger:hover {
  box-shadow: 0 4px 16px rgba(239,68,68,0.35);
  transform: translateY(-1px);
}

/* ===== Table Upgrades ===== */
#mainContent table th,
#mainContent table td {
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
}

#mainContent table tbody tr {
  transition: var(--transition-smooth);
}
#mainContent table tbody tr:hover {
  background-color: rgba(16,185,129,0.03) !important;
}

.responsive-table thead { display: none; }

@media (max-width: 768px) {
  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }
  .responsive-table tr {
    margin-bottom: 0.75rem;
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 1rem;
    background-color: #ffffff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    padding: 0.75rem;
  }
  .responsive-table td {
    border: none !important;
    padding: 0.5rem !important;
    text-align: left !important;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }
  .responsive-table td:first-child {
    flex-direction: row;
    align-items: center;
    border-bottom: 1px solid #f4f4f5 !important;
    padding-bottom: 0.6rem !important;
    margin-bottom: 0.25rem;
  }
}

/* ===== Print ===== */
@media print {
  body * { visibility: hidden; }
  #cetakStrukContainer, #cetakStrukContainer * { visibility: visible; }
  #cetakStrukContainer { position: absolute; left: 0; top: 0; width: 100%; margin: 0; padding: 0; }
  @page { margin: 0; }
}

/* ===== Login Page ===== */
.jago-bg {
  background: linear-gradient(180deg, #fffdf0 0%, #ffdf85 40%, #ff9a15 100%);
  position: relative;
  overflow: hidden;
}

.jago-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(8px);
  opacity: 0.85;
}

.blob-1 { width: 50px; height: 50px; background-color: #e81c4f; top: 35%; right: 10%; animation: float 6s ease-in-out infinite; }
.blob-2 { width: 40px; height: 40px; background-color: #a310a3; top: 50%; right: 15%; animation: float 7s ease-in-out infinite reverse; }
.blob-3 { width: 100px; height: 100px; background-color: #ffc107; bottom: 20%; right: -20px; animation: float 8s ease-in-out infinite; }
.blob-4 { width: 25px; height: 25px; background-color: #d81b60; bottom: 5%; left: 20%; animation: float 5s ease-in-out infinite; }

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-15px) scale(1.05); }
}

.jago-card {
  background: white;
  border-radius: 1.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(255,255,255,0.5);
}

.jago-input {
  background-color: #f3f4f6;
  border: 1px solid transparent;
  border-radius: 1rem;
  padding: 1rem 1.2rem;
  font-weight: 600;
  transition: all 0.2s;
}
.jago-input:focus {
  background-color: #ffffff;
  border-color: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.1);
  outline: none;
}

/* ===== Micro-animations ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.2); }
  50% { box-shadow: 0 0 0 8px rgba(16,185,129,0); }
}

/* ===== Section Dividers ===== */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.06), transparent);
  margin: 1.5rem 0;
}

/* ===== Buku Tulis style ===== */
.buku-tulis {
  background-color: #fdfbf7;
  background-image: repeating-linear-gradient(transparent, transparent 1.9em, #93c5fd 1.9em, #93c5fd 2em);
  background-attachment: local;
  line-height: 2em;
  font-family: 'Kalam', cursive;
  padding: 2em 1em 2em 3.5rem;
  position: relative;
  color: #1e3a8a;
  border-radius: 4px;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
  min-height: 400px;
  width: 100%;
}
.buku-tulis::before {
  content: '';
  position: absolute;
  left: 2.5rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #fca5a5;
  z-index: 1;
}
.buku-tulis-content {
  position: relative;
  z-index: 2;
  font-size: 16px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* ===== Mobile Rekapan & Content Fixes ===== */
@media screen and (max-width: 640px) {
  /* Slightly more breathing room in main content */
  #mainContent {
    padding: 0.5rem !important;
  }

  /* Rekapan HTML container - better mobile padding */
  #rekapanHtml {
    padding: 0.625rem !important;
    font-size: 11px !important;
    word-break: break-word;
  }

  /* Rekapan page container - no horizontal overflow */
  #page-rekapan {
    padding-bottom: 5rem;
  }

  #page-rekapan > div {
    border-radius: 1rem;
  }

  /* Transaction card details - slightly bigger text for readability */
  #rekapanHtml div[style*="border:1px"] {
    padding: 10px !important;
    border-radius: 8px !important;
    margin-bottom: 10px !important;
    word-break: break-word;
  }

  /* Copy to WhatsApp button - full width on mobile */
  #page-rekapan .btn-primary {
    width: 100%;
    justify-content: center;
  }
}