/*
 * CSS Stylesheet for Mass Document & Certificate Generator
 * Featuring: Glassmorphism, Dark/Light Mode, Micro-animations, 1-screen layout.
 * Redesigned: Compact single-viewport layout — no page scroll, panels scroll internally.
 */

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

:root {
  /* Dark Mode (Default) Variables */
  --bg-color: #0b0f19;
  --panel-bg: rgba(22, 31, 48, 0.75);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --primary-color: #3b82f6;
  --primary-hover: #2563eb;

  --gold-color: #d97706;
  --gold-hover: #b45309;

  --success-color: #10b981;
  --danger-color: #ef4444;

  --card-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.5);
  --glow-shadow: 0 0 20px rgba(59, 130, 246, 0.12);
  --transition-speed: 0.3s;

  /* Layout heights — calculated so everything fits exactly in viewport */
  --header-height: 52px;
  --footer-height: 28px;
  --content-height: calc(100vh - var(--header-height) - var(--footer-height));
}

[data-theme="light"] {
  --bg-color: #f0f4fc;
  --panel-bg: rgba(255, 255, 255, 0.92);
  --panel-border: rgba(0, 0, 0, 0.07);
  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;

  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;

  --gold-color: #d97706;
  --gold-hover: #b45309;

  --card-shadow: 0 6px 20px -4px rgba(0, 0, 0, 0.08);
  --glow-shadow: 0 0 20px rgba(37, 99, 235, 0.07);
}

/* ─── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ─── Body: viewport-lock, no scroll ──────────────────────────── */
html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
  display: flex;
  flex-direction: column;
}

/* ─── Header ───────────────────────────────────────────────────── */
header {
  height: var(--header-height);
  min-height: var(--header-height);
  padding: 0 20px;
  background: rgba(11, 15, 25, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  z-index: 100;
}

[data-theme="light"] header {
  background: rgba(240, 244, 252, 0.85);
}

header h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  background: linear-gradient(135deg, #60a5fa, #e5e7eb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

[data-theme="light"] header h1 {
  background: linear-gradient(135deg, #1e3a8a, #d97706);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

header p {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 340px;
}

/* ─── Theme Switcher ───────────────────────────────────────────── */
.theme-switch {
  cursor: pointer;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-primary);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.theme-switch:hover {
  transform: scale(1.1) rotate(15deg);
  border-color: var(--primary-color);
}

/* ─── Tabs in Header ───────────────────────────────────────────── */
.tabs-container {
  display: flex;
  background: var(--panel-bg);
  padding: 4px;
  border-radius: 24px;
  border: 1px solid var(--panel-border);
  gap: 2px;
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 5px 16px;
  border-radius: 18px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.tab-btn.active {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 3px 10px rgba(59, 130, 246, 0.35);
}

/* ─── Main Content Area ────────────────────────────────────────── */
main.container {
  flex: 1;
  overflow: hidden;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
}

/* ─── Tab Panels ───────────────────────────────────────────────── */
.tab-content {
  display: none;
  height: 100%;
  animation: fadeIn 0.3s ease-in-out forwards;
}

.tab-content.active {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 12px;
  height: 100%;
  overflow: hidden;
}

@media (max-width: 900px) {
  .tab-content.active {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }
}

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

/* ─── Panel Card ───────────────────────────────────────────────── */
.panel {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--card-shadow);
  transition: box-shadow var(--transition-speed) ease;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.panel::-webkit-scrollbar { width: 4px; }
.panel::-webkit-scrollbar-track { background: transparent; }
.panel::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 4px;
}

[data-theme="light"] .panel::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.12);
}

.panel:hover {
  box-shadow: var(--glow-shadow), var(--card-shadow);
}

.panel h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 8px;
  flex-shrink: 0;
}

/* ─── Form Controls ────────────────────────────────────────────── */
.form-group {
  margin-bottom: 10px;
}

label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.form-row {
  display: flex;
  gap: 8px;
}

.form-row > div {
  flex: 1;
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 7px 10px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  outline: none;
  transition: all 0.2s ease;
}

select option {
  background-color: #161f30;
  color: var(--text-primary);
}

[data-theme="light"] select option {
  background-color: #ffffff;
  color: var(--text-primary);
}

[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="number"],
[data-theme="light"] select,
[data-theme="light"] textarea {
  background: #ffffff;
  border-color: #cbd5e1;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

textarea {
  resize: vertical;
  min-height: 70px;
  max-height: 110px;
  font-size: 12px;
}

/* ─── Upload Zone ──────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--panel-border);
  border-radius: 10px;
  padding: 12px 12px;
  text-align: center;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary-color);
  background: rgba(59, 130, 246, 0.05);
}

.upload-zone input[type="file"] {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-icon {
  font-size: 20px;
  margin-bottom: 4px;
  display: block;
}

.upload-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.upload-hint {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.file-selected-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  margin-top: 5px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* ─── Column Mapper ────────────────────────────────────────────── */
.column-mapper-card {
  margin-bottom: 10px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .column-mapper-card {
  background: rgba(255, 255, 255, 0.6);
  border-color: #cbd5e1;
}

.column-mapper-title {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ─── Sliders & Color Picker ───────────────────────────────────── */
.range-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.range-group input[type="range"] {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 5px;
  outline: none;
  -webkit-appearance: none;
}

[data-theme="light"] .range-group input[type="range"] {
  background: #cbd5e1;
}

.range-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
  transition: all 0.1s ease;
}

.range-group input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.range-value {
  font-size: 11px;
  font-weight: 600;
  width: 46px;
  text-align: right;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  cursor: pointer;
  background: none;
  flex-shrink: 0;
}

input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch {
  border: 1px solid var(--panel-border);
  border-radius: 7px;
}

/* ─── Buttons ──────────────────────────────────────────────────── */
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  border-radius: 9px;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
}

button.btn-primary {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}
button.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.3);
  transform: translateY(-1px);
}

button.btn-gold {
  background: var(--gold-color);
  color: white;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.2);
}
button.btn-gold:hover:not(:disabled) {
  background: var(--gold-hover);
  box-shadow: 0 6px 18px rgba(217, 119, 6, 0.3);
  transform: translateY(-1px);
}

button:disabled {
  background: var(--text-muted);
  color: rgba(255,255,255,0.45);
  cursor: not-allowed;
  box-shadow: none !important;
  transform: none !important;
  opacity: 0.55;
}

/* ─── Secondary Button ─────────────────────────────────────────── */
.sample-links {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 7px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  flex: 1;
  text-decoration: none;
  justify-content: center;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text-secondary);
}

[data-theme="light"] .btn-secondary {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
[data-theme="light"] .btn-secondary:hover {
  background: #e2e8f0;
}

/* ─── Preview Container (right column) ────────────────────────── */
.preview-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.preview-container > .panel {
  flex: 1;
  height: 100%;
  min-height: 0;
  overflow: hidden; /* children handle their own overflow */
  display: flex;
  flex-direction: column;
}

.preview-badge-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.badge {
  background: rgba(59, 130, 246, 0.12);
  color: var(--primary-color);
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(59, 130, 246, 0.2);
}
.badge-gold {
  background: rgba(217, 119, 6, 0.12);
  color: var(--gold-color);
  border-color: rgba(217, 119, 6, 0.2);
}

/* ─── Canvas Preview Wrapper ───────────────────────────────────── */
.preview-canvas-wrapper {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px;
  overflow: auto;
  position: relative;
}

.preview-canvas-wrapper.checkerboard {
  background-image:
    linear-gradient(45deg, rgba(255,255,255,0.05) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,0.05) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.05) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.05) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  background-color: #0b0f19;
}

[data-theme="light"] .preview-canvas-wrapper.checkerboard {
  background-image:
    linear-gradient(45deg, rgba(0,0,0,0.05) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(0,0,0,0.05) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(0,0,0,0.05) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(0,0,0,0.05) 75%);
  background-color: #e2e8f0;
}

[data-theme="light"] .preview-canvas-wrapper {
  background: #e2e8f0;
}

canvas {
  max-width: 100%;
  max-height: 100%;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  border-radius: 4px;
  background: #ffffff;
  object-fit: contain;
}

/* ─── Preview Controls ─────────────────────────────────────────── */
.preview-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  gap: 8px;
  flex-shrink: 0;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 12px;
}
.btn-icon:hover:not(:disabled) {
  background: rgba(255,255,255,0.1);
  border-color: var(--text-secondary);
}
.btn-icon:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ─── Progress / Status ────────────────────────────────────────── */
.status-card {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 9px;
  border: 1px solid var(--panel-border);
}

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 8px;
}
[data-theme="light"] .progress-bar-bg { background: #cbd5e1; }

.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--success-color));
  border-radius: 10px;
  transition: width 0.1s ease;
}

.status-text {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

/* ─── Info Box / Tips ──────────────────────────────────────────── */
.info-box {
  margin-top: 10px;
  background: rgba(59, 130, 246, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.13);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 11px;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.info-box.gold {
  background: rgba(217, 119, 6, 0.05);
  border-color: rgba(217, 119, 6, 0.15);
}
.info-box h4 {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 3px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 5px;
}
.info-box ul, .info-box ol {
  padding-left: 14px;
  margin-top: 4px;
}
.info-box li { margin-bottom: 2px; }
.info-box code {
  background: rgba(255,255,255,0.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
}
[data-theme="light"] .info-box code { background: #e2e8f0; }

/* ─── Data Preview Table ───────────────────────────────────────── */
.data-preview-table-wrapper {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  border: 1px solid var(--panel-border);
  border-radius: 9px;
  background: rgba(0,0,0,0.1);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.data-preview-table-wrapper::-webkit-scrollbar { width: 4px; }
.data-preview-table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}

.data-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  text-align: left;
}
.data-preview-table th {
  background: rgba(0,0,0,0.2);
  padding: 8px 10px;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--panel-border);
  position: sticky;
  top: 0;
  z-index: 1;
}
.data-preview-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--panel-border);
  color: var(--text-secondary);
}
.data-preview-table tr:hover { background: rgba(255,255,255,0.02); }

[data-theme="light"] .data-preview-table-wrapper { background: #ffffff; }
[data-theme="light"] .data-preview-table th { background: #f1f5f9; }
[data-theme="light"] .data-preview-table tr:hover { background: #f8fafc; }

/* ─── Segmented Control ────────────────────────────────────────── */
.segmented-control {
  display: flex;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 2px;
  margin-bottom: 8px;
}
[data-theme="light"] .segmented-control { background: #e2e8f0; }

.segment-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.segment-btn.active {
  background: var(--panel-bg);
  color: var(--text-primary);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ─── Micro Footer ─────────────────────────────────────────────── */
footer {
  height: var(--footer-height);
  min-height: var(--footer-height);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-muted);
  border-top: 1px solid var(--panel-border);
  flex-shrink: 0;
  letter-spacing: 0.02em;
  padding: 0 20px;
  background: rgba(11,15,25,0.3);
}

[data-theme="light"] footer { background: rgba(240,244,252,0.6); }

footer a {
  color: var(--primary-color);
  text-decoration: none;
}
footer a:hover { text-decoration: underline; }

/* Collapsed states for preview tables */
#certTableWrapper.collapsed,
#docTableWrapper.collapsed {
  flex: 0 0 auto !important;
  min-height: 0 !important;
}

#certTableWrapper.collapsed #certTableInner,
#docTableWrapper.collapsed #docTableInner {
  display: none !important;
}

#docTableWrapper:not(.collapsed) ~ #docPlaceholderInfo {
  display: none !important;
}

#undanganTab.active {
  grid-template-columns: 400px 1fr 1.25fr;
}

/* ─── Word Document Live Preview ───────────────────────────────── */
.word-preview-wrapper {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 16px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.word-preview-wrapper::-webkit-scrollbar { width: 4px; height: 4px; }
.word-preview-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}

[data-theme="light"] .word-preview-wrapper {
  background: #e2e8f0;
}

.word-preview-page {
  background: #ffffff;
  color: #1f2937;
  width: 100%;
  max-width: 440px;
  min-height: 560px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  border-radius: 4px;
  padding: 30px 32px;
  font-family: 'Times New Roman', Times, serif;
  font-size: 12px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.word-preview-page p {
  margin-top: 0;
  margin-bottom: 10px;
  text-align: justify;
  text-justify: inter-word;
  white-space: pre-wrap;
}

.word-preview-page strong {
  font-weight: bold;
}

.word-preview-page em {
  font-style: italic;
}

.word-preview-page a {
  color: #2563eb;
  text-decoration: underline;
}

.word-preview-page table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  margin-bottom: 12px;
}

.word-preview-page td {
  padding: 4px;
  vertical-align: top;
}

.word-preview-page ul, .word-preview-page ol {
  margin-top: 0;
  margin-bottom: 10px;
  padding-left: 20px;
}

.word-preview-page h1, .word-preview-page h2, .word-preview-page h3, .word-preview-page h4 {
  margin-top: 0;
  margin-bottom: 10px;
  font-weight: bold;
  text-align: center;
}



/* ─── Dynamic Certificate Layers ───────────────────────────────────── */
.layer-card {
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s ease;
}

[data-theme="light"] .layer-card {
  background: rgba(0, 0, 0, 0.02);
  border-color: #cbd5e1;
}

.layer-card:hover {
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.layer-header {
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

[data-theme="light"] .layer-header {
  background: rgba(0, 0, 0, 0.03);
}

.layer-body {
  padding: 14px;
  border-top: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.layer-header .drag-handle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-right: 4px;
  cursor: grab;
}

.layer-header .collapse-icon {
  font-size: 10px;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}

.btn-delete-layer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.2s;
}

.btn-delete-layer:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* ─── Halaman Beranda (Dashboard) Styles ────────────────────────── */
#berandaTab.active {
  display: block;
  overflow-y: auto;
  padding-right: 4px;
}

.beranda-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
  padding-bottom: 24px;
}

/* 1. Hero Banner */
.hero-banner {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.75), rgba(15, 23, 42, 0.75));
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

[data-theme="light"] .hero-banner {
  background: linear-gradient(135deg, rgba(219, 234, 254, 0.7), rgba(255, 255, 255, 0.8));
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
  z-index: 1;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 750px;
}

.hero-content h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #60a5fa, #f472b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

[data-theme="light"] .hero-content h1 {
  background: linear-gradient(135deg, #1e3a8a, #db2777);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-content p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.hero-badge-container {
  flex-shrink: 0;
  z-index: 2;
}

/* Status Badge */
.database-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: all 0.3s ease;
}

.badge-local {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.25);
  color: #10b981;
}

.badge-connected {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.25);
  color: #3b82f6;
  animation: pulse-border 2s infinite;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
  position: relative;
}

.badge-connected .status-dot::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: currentColor;
  animation: ping 1.2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
  75%, 100% {
    transform: scale(2.5);
    opacity: 0;
  }
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

/* 2. Dashboard Grids */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* Stats Card Panel */
.stats-card-panel {
  padding: 16px 20px;
}

.stats-card-panel h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 6px;
}

.stats-group {
  margin-bottom: 14px;
}

.stats-group:last-child {
  margin-bottom: 0;
}

.stats-group h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stats-row {
  display: flex;
  gap: 12px;
}

.stat-item {
  flex: 1;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

[data-theme="light"] .stat-item {
  background: rgba(255, 255, 255, 0.5);
}

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

.stat-number {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

#localCertCount, #globalCertCount {
  color: #fbbf24;
}

#localDocxCount, #globalDocxCount {
  color: #3b82f6;
}

.stat-label {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 2px;
  text-align: center;
}

.stats-global-group {
  border-top: 1px dashed var(--panel-border);
  padding-top: 12px;
  margin-top: 12px;
}

.stats-hint {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 6px;
  font-style: italic;
  text-align: center;
}

/* Quick Action Cards */
.quick-action-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.quick-action-card:hover {
  transform: translateY(-4px);
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.4), var(--glow-shadow);
}

.quick-action-card.cert-quick-card:hover {
  border-color: rgba(217, 119, 6, 0.3);
}

.card-icon {
  font-size: 28px;
  margin-bottom: 12px;
  transition: transform 0.3s ease;
}

.quick-action-card:hover .card-icon {
  transform: scale(1.15) rotate(5deg);
}

.quick-action-card h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.quick-action-card p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
  flex: 1;
}

.btn-quick-nav {
  width: 100% !important;
  margin: 0 !important;
  font-size: 12px !important;
  padding: 8px 12px !important;
  border-radius: 8px !important;
}

/* 4. Secondary Grid (Timeline & Settings) */
.secondary-grid {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 16px;
  width: 100%;
  max-width: 100%;
}

.secondary-grid > .guide-panel {
  flex: 1 1 360px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.secondary-grid > .settings-panel {
  flex: 1.2 1 360px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

@media (max-width: 900px) {
  .secondary-grid {
    flex-direction: column;
  }
  .secondary-grid > .guide-panel,
  .secondary-grid > .settings-panel {
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
  }
}

.guide-panel h3, .settings-panel h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 6px;
  color: var(--text-primary);
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Workflow Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  padding-left: 8px;
  width: 100%;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 15px;
  bottom: 15px;
  width: 2px;
  background: var(--panel-border);
  z-index: 1;
}

.timeline-item {
  display: flex;
  gap: 16px;
  position: relative;
  z-index: 2;
  width: 100%;
  min-width: 0;
}

.timeline-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--panel-bg);
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.15);
  transition: all 0.3s;
}

.timeline-item:hover .timeline-num {
  background: var(--primary-color);
  color: white;
  transform: scale(1.1);
}

.timeline-item:nth-child(even) .timeline-num {
  border-color: var(--gold-color);
  color: var(--gold-color);
}

.timeline-item:nth-child(even):hover .timeline-num {
  background: var(--gold-color);
  color: white;
}

.timeline-desc {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.timeline-desc strong {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
  overflow-wrap: break-word;
}

.timeline-desc span {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 2px;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Settings and Download Group */
.download-resource-group {
  margin-bottom: 16px;
}

.download-resource-group h4, .supabase-setup-group h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.download-grid-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.download-grid-buttons button.resource-card {
  text-align: left;
  justify-content: flex-start;
}

/* Supabase settings UI */
.supabase-setup-group {
  border-top: 1px dashed var(--panel-border);
  padding-top: 14px;
}

.form-group-compact {
  margin-bottom: 10px;
}

.form-group-compact label {
  display: block;
  font-size: 10px;
  color: var(--text-secondary);
  margin-bottom: 2px;
  font-weight: 500;
}

.form-group-compact input {
  width: 100%;
  padding: 6px 10px;
  font-size: 11px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}

[data-theme="light"] .form-group-compact input {
  background: rgba(255, 255, 255, 0.8);
}

.form-group-compact input:focus {
  border-color: var(--primary-color);
}

.settings-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* SQL Accordion UI */
.sql-details {
  margin-top: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: rgba(0,0,0,0.1);
  overflow: hidden;
}

.sql-details summary {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  background: rgba(0,0,0,0.05);
}

.sql-details summary:hover {
  color: var(--text-primary);
}

.sql-code-block {
  padding: 8px 10px;
  background: rgba(0,0,0,0.3);
  border-top: 1px solid var(--panel-border);
  overflow-x: auto;
}

.sql-code-block pre {
  margin: 0;
}

.sql-code-block code {
  font-family: monospace;
  font-size: 10px;
  color: #a7f3d0;
}

/* ─── UI/UX Audit Custom Additions ────────────────────────────── */

/* SVG Icon Helper Styles */
.svg-icon {
  width: 1.25rem;
  height: 1.25rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: inline-block;
  vertical-align: middle;
}

.tab-btn .svg-icon {
  margin-right: 6px;
}

.card-icon .svg-icon {
  width: 2.25rem;
  height: 2.25rem;
  stroke-width: 1.75;
}

.hero-lightning {
  display: inline-block;
  animation: pulse-light 1.5s infinite alternate;
}

@keyframes pulse-light {
  0% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(234, 179, 8, 0.4)); }
  100% { transform: scale(1.1); filter: drop-shadow(0 0 8px rgba(234, 179, 8, 0.8)); }
}

/* Skeleton Loading Shimmer */
.shimmer-placeholder {
  display: inline-block;
  height: 22px;
  width: 50px;
  background: linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.06) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  vertical-align: middle;
}

[data-theme="light"] .shimmer-placeholder {
  background: linear-gradient(90deg, rgba(0,0,0,0.06) 25%, rgba(0,0,0,0.12) 50%, rgba(0,0,0,0.06) 75%);
  background-size: 200% 100%;
}

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

/* Resource Cards (Download Center) */
.resource-card {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  width: 100%;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
}

[data-theme="light"] .resource-card {
  background: rgba(255, 255, 255, 0.5);
}

.resource-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-color);
  background: rgba(59, 130, 246, 0.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .resource-card:hover {
  background: rgba(37, 99, 235, 0.04);
}

.resource-icon-wrapper {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.resource-icon-wrapper.file-excel {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.resource-icon-wrapper.file-image {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.resource-icon-wrapper.file-word {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
}

.resource-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.resource-title {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.resource-meta {
  font-size: 9px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.resource-format-badge {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 4px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 8px;
}

[data-theme="light"] .resource-format-badge {
  background: rgba(0, 0, 0, 0.05);
}

/* Stats Visual Dashboard Styling */
.stats-visual-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  margin-top: 10px;
  width: 100%;
}

.donut-chart-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 110px;
  height: 110px;
  flex-shrink: 0;
}

.donut-chart {
  transform: rotate(0deg);
  transition: stroke-dasharray 0.5s ease;
}

.donut-segment {
  transition: stroke-dasharray 0.8s cubic-bezier(0.4, 0, 0.2, 1), stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.donut-center-text {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.donut-total-num {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.donut-total-label {
  font-size: 8px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.stats-details-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-progress-bar-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 10px 12px;
  background: rgba(0,0,0,0.15);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
[data-theme="light"] .stat-progress-bar-group {
  background: rgba(255, 255, 255, 0.5);
}

.stat-progress-bar-group:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .stat-progress-bar-group:hover {
  border-color: rgba(0,0,0,0.12);
}

.stat-progress-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.stat-progress-label-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.stat-progress-val {
  font-size: 11px;
  color: var(--text-primary);
}

.stat-progress-val strong {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 700;
}

.stat-total-ref {
  font-size: 9px;
  color: var(--text-muted);
}

.stat-progress-track {
  width: 100%;
  height: 5px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
}
[data-theme="light"] .stat-progress-track {
  background: rgba(0,0,0,0.06);
}

.stat-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-progress-fill.fill-cert {
  background: var(--gold-color);
  box-shadow: 0 0 8px rgba(217, 119, 6, 0.15);
}

.stat-progress-fill.fill-docx {
  background: var(--primary-color);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.15);
}

/* Hide mobile toggle by default on desktop/tablet */
@media (min-width: 601px) {
  .mobile-view-toggle {
    display: none !important;
  }
}

/* ─── Responsive (tablet / small desktop) ─────────────────────── */
@media (max-width: 1100px) {
  .tab-content.active {
    grid-template-columns: 360px 1fr;
  }
  #undanganTab.active {
    grid-template-columns: 320px 1fr 1.1fr;
  }
}

@media (max-width: 900px) {
  html, body { overflow-x: hidden; overflow-y: auto; }

  body { display: block; }

  header {
    height: auto;
    padding: 10px 16px;
    position: sticky;
    top: 0;
  }

  main.container {
    overflow: visible;
    height: auto;
  }

  .tab-content.active {
    display: flex;
    flex-direction: column;
    height: auto;
    gap: 12px;
  }

  .panel { height: auto !important; overflow: visible; }
  .preview-container { height: auto; }
  .preview-canvas-wrapper { min-height: 300px; }
}

@media (max-width: 600px) {
  /* 1. Header Layout stacking for mobile */
  header {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 16px;
    gap: 10px;
    height: auto;
  }
  
  header > div:first-child {
    padding-right: 44px; /* Space for absolute theme switcher */
  }
  
  header > div:nth-child(2) {
    width: 100%;
  }
  
  .tabs-container {
    width: 100%;
    display: flex;
    gap: 3px;
    padding: 3px;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs-container::-webkit-scrollbar {
    display: none;
  }
  
  .tab-btn {
    flex: 1;
    justify-content: center;
    padding: 6px 6px;
    font-size: 11px;
    gap: 4px;
  }
  .tab-btn svg {
    width: 14px !important;
    height: 14px !important;
  }
  
  #themeToggle {
    position: absolute;
    top: 12px;
    right: 16px;
  }

  /* 2. Form Grid stacks vertically on mobile */
  .form-row {
    flex-direction: column;
    gap: 10px;
  }
  
  /* 3. Touch target sizes optimized for mobile */
  button.btn {
    padding: 11px 16px;
  }
  .btn-secondary {
    padding: 10px 12px;
    font-size: 12px;
  }
  .btn-icon {
    width: 38px;
    height: 38px;
  }
  
  /* 4. Mobile Switcher Toggling between Edit & Preview views */
  .mobile-view-toggle {
    display: flex !important;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    padding: 3px;
    margin-bottom: 12px;
    gap: 4px;
    width: 100%;
  }
  
  [data-theme="light"] .mobile-view-toggle {
    background: rgba(255, 255, 255, 0.7);
    border-color: #cbd5e1;
  }
  
  .mobile-toggle-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 8px 12px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
  }
  
  .mobile-toggle-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
  }
  
  /* Edit Mode (Default): Hide previews, show forms */
  body:not(.mobile-preview-mode) .tab-content.active > .preview-container {
    display: none !important;
  }
  body:not(.mobile-preview-mode) .tab-content.active > .panel:not(.preview-container) {
    display: flex !important;
    height: auto !important;
  }
  
  /* Preview Mode: Show previews, hide forms */
  body.mobile-preview-mode .tab-content.active > .preview-container {
    display: flex !important;
  }
  body.mobile-preview-mode .tab-content.active > .panel:not(.preview-container) {
    display: none !important;
  }

  header p {
    white-space: normal;
    max-width: 100%;
  }

  .guide-panel h3, .settings-panel h3 {
    font-size: 13px !important;
    gap: 6px !important;
  }

  .download-grid-buttons {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }

  .hero-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
  }

  .hero-badge-container {
    order: -1;
    margin-bottom: 4px;
  }
}

/* Hide mobile view toggle specifically when Beranda tab is active */
main.container:has(#berandaTab.active) .mobile-view-toggle {
  display: none !important;
}

/* ─── Modal Progress Pop-up ────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: modalFadeInOverlay 0.2s ease-out;
}

.modal-box {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 28px 24px;
  width: 90%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
  text-align: center;
  position: relative;
  animation: modalScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#modalTitle {
  margin-top: 0;
  margin-bottom: 18px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-progress-container {
  margin: 20px 0 10px 0;
}

.modal-status-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  gap: 12px;
}

.modal-status-row span {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#modalStatusText {
  flex: 1;
  text-align: left;
}

#modalProgressPercent {
  font-weight: 600;
  color: var(--gold-color);
  flex-shrink: 0;
}

.modal-progress-bar-bg {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  overflow: hidden;
}

[data-theme="light"] .modal-progress-bar-bg {
  background: #e2e8f0;
}

.modal-progress-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--gold-color), var(--success-color));
  border-radius: 6px;
  transition: width 0.1s ease;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

@keyframes modalFadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.92) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* QRIS Styling */
.qris-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--panel-border);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.qris-text {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
  line-height: 1.4;
}

.qris-image {
  width: 230px;
  height: 230px;
  object-fit: contain;
  border-radius: 12px;
  border: 4px solid #ffffff; /* White border is mandatory for proper QR scanning */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.3s ease;
  /* Premium Dark Gold / Amber tint that keeps QR code contrast high and perfectly scannable */
  filter: sepia(0.5) saturate(1.8) hue-rotate(5deg) contrast(1.1) brightness(0.92);
}

.qris-image:hover {
  transform: scale(1.08);
  filter: sepia(0.15) saturate(1.4) hue-rotate(5deg) contrast(1.1) brightness(1.0);
}


