/* ==========================================================================
   PENGGABUNG DOKUMEN SPMB - MODERN & LUXURY STYLESHEET
   Design System: Deep Indigo Glassmorphism with HSL Tailored Colors
   ========================================================================== */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  --bg-dark: #07090e;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(26, 34, 54, 0.85);
  --bg-surface: rgba(255, 255, 255, 0.03);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);
  --border-highlight: rgba(6, 182, 212, 0.4);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-cyan: #06b6d4;
  --accent-indigo: #6366f1;
  --accent-purple: #8b5cf6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 10px 30px -5px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

.bg-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.25;
}

.orb-1 {
  top: -10%;
  left: 15%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-indigo) 0%, transparent 70%);
}

.orb-2 {
  top: 40%;
  right: -5%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-cyan) 0%, transparent 70%);
}

.orb-3 {
  bottom: -10%;
  left: 20%;
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, var(--accent-purple) 0%, transparent 70%);
}

.main-container {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.app-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #c7d2fe;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 1.25rem;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
}

.header-badge svg {
  color: var(--accent-cyan);
}

.app-title {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.gradient-text {
  background: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-subtitle {
  max-width: 650px;
  margin: 0 auto 2rem;
  font-size: 0.975rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.app-subtitle strong {
  color: var(--accent-cyan);
  font-weight: 600;
}

.progress-steps {
  display: inline-flex;
  align-items: center;
  background: rgba(18, 24, 38, 0.8);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
}

.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text-dim);
}

.step-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  transition: var(--transition);
}

.step-dot--active {
  background: var(--accent-indigo);
  color: #fff;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.5);
}

.step-dot--done {
  background: var(--accent-emerald);
  color: #fff;
}

.step-line {
  width: 28px;
  height: 2px;
  background: var(--border-subtle);
  margin: 0 10px;
}

.section-card {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.section-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.section-number {
  position: absolute;
  top: 1.25rem;
  right: 1.75rem;
  font-size: 2.5rem;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.03);
  user-select: none;
  line-height: 1;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.section-title svg {
  color: var(--accent-cyan);
}

.section-desc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 1.5rem;
}

.section-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.badge-optional {
  display: inline-block;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: #cbd5e1;
  margin-left: 6px;
}

.upload-counter {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.upload-counter.has-any {
  color: var(--accent-cyan);
  border-color: rgba(6, 182, 212, 0.3);
  background: rgba(6, 182, 212, 0.08);
}

.input-wrapper {
  margin-top: 1rem;
}

.name-input {
  width: 100%;
  padding: 1rem 1.25rem;
  font-size: 1.05rem;
  font-family: inherit;
  font-weight: 500;
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
}

.name-input:focus {
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
  background: rgba(15, 23, 42, 0.9);
}

.name-input::placeholder {
  color: var(--text-dim);
}

.name-input.shake {
  animation: inputShake 0.4s ease-in-out;
  border-color: var(--accent-rose);
  box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.18);
}

@keyframes inputShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.input-hint {
  font-size: 0.8125rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
}

.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.doc-card {
  background: rgba(14, 20, 32, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: var(--transition);
}

.doc-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.14);
  transform: translateY(-2px);
}

.doc-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.doc-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.doc-card-info {
  flex: 1;
  min-width: 0;
}

.doc-badge-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  display: block;
}

.doc-title {
  font-size: 0.975rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-status-pill {
  font-size: 0.725rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: var(--transition);
}

.doc-status-pill.done {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.upload-zone {
  border: 2px dashed rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.015);
  border-radius: var(--radius-sm);
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  outline: none;
}

.upload-zone:hover, .upload-zone:focus-visible {
  border-color: var(--accent-indigo);
  background: rgba(99, 102, 241, 0.04);
}

.upload-zone.drag-over {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.08);
  transform: scale(1.01);
}

.upload-zone.has-file {
  display: none;
}

.upload-zone input[type="file"] {
  display: none;
}

.upload-icon-wrap {
  width: 44px;
  height: 44px;
  margin: 0 auto 0.5rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
}

.upload-zone:hover .upload-icon-wrap {
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
  transform: translateY(-2px);
}

.upload-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.upload-link {
  color: var(--accent-cyan);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.upload-hint-sm {
  font-size: 0.725rem;
  color: var(--text-dim);
}

.upload-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--accent-cyan);
}

.mini-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(6, 182, 212, 0.2);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

.file-info-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
}

.fi-icon {
  font-size: 1rem;
}

.fi-name {
  flex: 1;
  font-weight: 500;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fi-size {
  font-size: 0.725rem;
  color: var(--text-dim);
}

.fi-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.95rem;
  transition: var(--transition);
}

.fi-remove:hover {
  background: rgba(244, 63, 94, 0.15);
  color: #f87171;
}

.preview-area {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 0.5rem;
}

.preview-page {
  background: rgba(11, 15, 25, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.page-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1.414;
  background: #0f172a;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.page-img-wrap.sideways .page-img {
  transform-origin: center center;
}

.rot-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  color: var(--accent-cyan);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.pg-num {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.75);
  color: #cbd5e1;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 3px;
}

.rotate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: #cbd5e1;
  font-size: 0.725rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.rotate-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
  color: #fff;
}

.save-section {
  background: linear-gradient(135deg, rgba(18, 24, 38, 0.85) 0%, rgba(30, 27, 75, 0.4) 100%);
  border-color: rgba(99, 102, 241, 0.25);
}

.save-info-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
  background: rgba(11, 15, 25, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
}

@media (max-width: 768px) {
  .save-info-row {
    grid-template-columns: 1fr;
  }
}

.save-checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-dim);
  transition: var(--transition);
}

.checklist-item.done {
  color: #e2e8f0;
  font-weight: 500;
}

.check-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
  transition: var(--transition);
}

.checklist-item.done .check-icon {
  background: var(--accent-emerald);
  color: #fff;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.req-tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #fb7185;
  background: rgba(244, 63, 94, 0.12);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.save-desc-box {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
}

.save-desc-box code {
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent-cyan);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: monospace;
}

.save-info-note {
  font-size: 0.775rem;
  color: var(--text-dim);
}

.save-privacy {
  font-size: 0.75rem;
  color: #a5b4fc;
  margin-top: 4px;
}

.save-btn {
  width: 100%;
  padding: 1.1rem;
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, #0284c7 0%, #4f46e5 50%, #7c3aed 100%);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.35);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.save-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 100%);
  opacity: 0;
  transition: var(--transition);
}

.save-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(79, 70, 229, 0.45);
}

.save-btn:hover:not(:disabled)::before {
  opacity: 1;
}

.save-btn:active:not(:disabled) {
  transform: translateY(0);
}

.save-btn:disabled {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  cursor: not-allowed;
  box-shadow: none;
}

.save-btn-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.merge-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 9, 14, 0.85);
  backdrop-filter: blur(14px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.3s ease;
}

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

.merge-card {
  background: rgba(18, 24, 38, 0.95);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), var(--shadow-glow);
}

.spinner-ring {
  width: 54px;
  height: 54px;
  border: 4px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--accent-cyan);
  border-right-color: var(--accent-indigo);
  border-radius: 50%;
  margin: 0 auto 1.5rem;
  animation: spin 0.85s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
}

#merge-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

#merge-status {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.merge-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  background: rgba(11, 15, 25, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.merge-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--text-dim);
  transition: var(--transition);
}

.merge-step.active {
  color: var(--accent-cyan);
  font-weight: 600;
}

.merge-step.done {
  color: var(--accent-emerald);
}

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(18, 24, 38, 0.95);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
  max-width: 360px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-success {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(6, 78, 59, 0.85);
}

.toast-error {
  border-color: rgba(244, 63, 94, 0.4);
  background: rgba(136, 19, 55, 0.85);
}

.toast-info {
  border-color: rgba(6, 182, 212, 0.4);
  background: rgba(12, 74, 96, 0.85);
}

.app-footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8125rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}
