/* =====================
   ADT Design System v2.0
   ArahDocs × Brother
   Claymorphism Light
   ===================== */

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

:root {
  --brother-primary:   #0D2EA0;
  --brother-secondary: #005CAB;
  --brother-dark:      #081A5E;
  --brother-light:     #E8EEFF;
  --neutral-50:        #F8FAFF;
  --neutral-900:       #0A0F2E;
  --text-primary:      #0A0F2E;
  --text-secondary:    #6B7280;
  --text-accent:       #0D2EA0;

  /* Clay card shadows */
  --clay-shadow:
    inset 0 6px 12px rgba(255,255,255,0.9),
    inset 0 -6px 12px rgba(13,46,160,0.08),
    0 16px 32px rgba(13,46,160,0.12);
  --clay-shadow-sm:
    inset 0 3px 6px rgba(255,255,255,0.9),
    inset 0 -3px 6px rgba(13,46,160,0.06),
    0 8px 16px rgba(13,46,160,0.08);
  --clay-border:     1px solid rgba(13,46,160,0.06);
  --radius-card:     24px;
  --radius-card-sm:  16px;
  --radius-btn:      10px;
  --radius-input:    10px;

  /* Vertikal pastel */
  --v-klinik:   #059669;
  --v-retail:   #d97706;
  --v-legal:    #6d28d9;
  --v-logistik: #1d4ed8;
  --v-umum:     #6b7280;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.95rem;
  color: var(--text-primary);
  background: linear-gradient(135deg, #DCEBFA 0%, #EEF5FD 50%, #F4F9FF 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}

/* --- Clay Card --- */
.glass-card {
  background: #ffffff;
  border-radius: var(--radius-card);
  box-shadow: var(--clay-shadow);
  border: var(--clay-border);
  padding: 24px;
}

.glass-pill {
  background: var(--brother-light);
  border: 1px solid rgba(13,46,160,0.15);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.8rem;
  font-family: 'DM Mono', monospace;
  color: var(--brother-primary);
  font-weight: 600;
}

.mt-16 { margin-top: 16px; }

/* --- Header --- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #ffffff;
  border-bottom: 1px solid rgba(13,46,160,0.08);
  box-shadow: 0 2px 8px rgba(13,46,160,0.06);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(13,46,160,0.2);
}
.brand-name { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.02em; color: var(--brother-primary); }
.brand-sub  { font-size: 0.7rem; color: var(--brother-secondary); font-weight: 500; }

.header-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #9CA3AF;
  transition: background 0.3s, box-shadow 0.3s;
}
.status-dot.ok    {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.2);
}
.status-dot.error { background: #EF4444; }
.status-text      { font-size: 0.8rem; color: var(--text-secondary); }

/* --- Main Layout --- */
.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  min-height: calc(100vh - 120px);
}

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

.panel { display: flex; flex-direction: column; gap: 0; }

/* --- Panel Title / Section Labels --- */
.panel-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--brother-secondary);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}
.panel-title svg { color: var(--brother-secondary); opacity: 0.7; }

/* --- Drop Zone --- */
.dropzone {
  border: 2px dashed rgba(13,46,160,0.2);
  border-radius: var(--radius-card-sm);
  padding: 28px 20px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(232,238,255,0.3);
}
.dropzone:hover, .dropzone.drag-over {
  border-color: rgba(13,46,160,0.45);
  background: rgba(232,238,255,0.55);
}
.dropzone-icon { margin-bottom: 12px; }
.dropzone-text { font-weight: 600; font-size: 0.95rem; margin-bottom: 4px; color: var(--text-primary); }
.dropzone-hint { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 12px; }
.dropzone-formats { font-size: 0.75rem; color: var(--text-secondary); margin-top: 10px; font-family: 'DM Mono', monospace; }

/* Vertikal selector */
.vertikal-select-wrap {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.vertikal-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
}
.vertikal-select {
  flex: 1;
  background: #F8FAFF;
  border: 1.5px solid rgba(13,46,160,0.15);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.82rem;
  outline: none;
  cursor: pointer;
  transition: border 0.2s;
}
.vertikal-select:focus { border-color: rgba(13,46,160,0.4); }
.vertikal-select option { background: #ffffff; color: var(--text-primary); }

.btn-upload {
  background: linear-gradient(135deg, var(--brother-primary), var(--brother-secondary));
  box-shadow: 0 4px 12px rgba(13,46,160,0.3);
  color: white;
  border: none;
  border-radius: var(--radius-btn);
  padding: 10px 24px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s, box-shadow 0.2s;
}
.btn-upload:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(13,46,160,0.35);
}
.btn-upload:active { transform: translateY(0); }

/* --- Progress --- */
.upload-progress { margin-top: 20px; }

.progress-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 16px;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 64px;
}
.step-icon   { font-size: 1.2rem; }
.step-label  { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); }
.step-status { font-size: 0.65rem; font-family: 'DM Mono', monospace; color: var(--text-secondary); }
.step.done   .step-icon::after { content: ' ✓'; }
.step.active .step-icon { animation: pulse 1s infinite; }
.step-line {
  flex: 1;
  height: 1px;
  background: rgba(13,46,160,0.12);
  min-width: 24px;
  margin-bottom: 20px;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.15); }
}

.progress-bar-wrap {
  background: rgba(13,46,160,0.08);
  border-radius: 999px;
  height: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--brother-primary), var(--brother-secondary));
  border-radius: 999px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}
.progress-msg {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: center;
}

/* --- Doc List --- */
.doc-list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; }
.doc-list::-webkit-scrollbar { width: 4px; }
.doc-list::-webkit-scrollbar-track { background: transparent; }
.doc-list::-webkit-scrollbar-thumb { background: rgba(13,46,160,0.15); border-radius: 2px; }

.doc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--neutral-50);
  border: 1px solid rgba(13,46,160,0.06);
  border-radius: 10px;
  font-size: 0.82rem;
  transition: background 0.2s, box-shadow 0.2s;
}
.doc-item:hover {
  background: var(--brother-light);
  box-shadow: 0 2px 8px rgba(13,46,160,0.08);
}
.doc-icon { font-size: 1rem; flex-shrink: 0; }
.doc-info { flex: 1; min-width: 0; }
.doc-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); }
.doc-id   { font-size: 0.68rem; font-family: 'DM Mono', monospace; color: var(--text-secondary); }

.empty-state {
  text-align: center;
  padding: 20px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* --- Search --- */
.search-wrap {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.search-input {
  flex: 1;
  background: #F8FAFF;
  border: 1.5px solid rgba(13,46,160,0.15);
  border-radius: var(--radius-input);
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border 0.2s, box-shadow 0.2s;
  box-shadow: inset 0 2px 4px rgba(13,46,160,0.06);
}
.search-input::placeholder { color: #9CA3AF; }
.search-input:focus {
  border-color: rgba(13,46,160,0.35);
  box-shadow: inset 0 2px 4px rgba(13,46,160,0.06), 0 0 0 3px rgba(13,46,160,0.06);
}

.btn-search {
  background: linear-gradient(135deg, var(--brother-primary), var(--brother-secondary));
  box-shadow: 0 4px 12px rgba(13,46,160,0.3);
  color: white;
  border: none;
  border-radius: var(--radius-btn);
  padding: 12px 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, transform 0.1s, box-shadow 0.2s;
}
.btn-search:hover  {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(13,46,160,0.35);
}
.btn-search:active { transform: translateY(0); }

.search-tips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tip-label   { font-size: 0.75rem; color: var(--text-secondary); }
.tip-pill {
  font-size: 0.75rem;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(13,46,160,0.15);
  background: var(--brother-light);
  color: var(--brother-primary);
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 500;
  transition: all 0.2s;
}
.tip-pill:hover {
  background: #D4E3FF;
  border-color: rgba(13,46,160,0.3);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(13,46,160,0.1);
}

/* --- Results --- */
.results-area { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }

.results-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}
.empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.muted { color: var(--text-secondary); font-size: 0.82rem; margin-top: 6px; }

/* Result card — clay light version */
@keyframes resultIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-card {
  background: #ffffff;
  border-radius: var(--radius-card-sm);
  padding: 18px 20px;
  box-shadow: var(--clay-shadow-sm);
  border: var(--clay-border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: default;
  animation: resultIn 0.35s ease both;
}
.result-card:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 3px 6px rgba(255,255,255,0.9),
    inset 0 -3px 6px rgba(13,46,160,0.08),
    0 12px 24px rgba(13,46,160,0.14);
}

.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.result-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.result-filename {
  font-weight: 700;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}
.result-badge {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
}
.result-excerpt {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
}
.result-excerpt mark {
  background: rgba(250,204,21,0.3);
  color: #92400e;
  border-radius: 2px;
  padding: 0 2px;
  font-style: normal;
  font-weight: 500;
}

/* Score badge tiers */
.result-badge.score-100 {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid rgba(21,128,61,0.15);
}
.result-badge.score-high {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid rgba(29,78,216,0.15);
}
.result-badge.score-low {
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid rgba(107,114,128,0.2);
}

.result-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.result-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.tag-pill {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(13,46,160,0.12);
  background: var(--neutral-50);
  color: var(--text-secondary);
  font-family: 'DM Mono', monospace;
}
.result-meta {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-family: 'DM Mono', monospace;
  white-space: nowrap;
}

.results-count {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* --- Vertikal Badges — pastel clay --- */
.vertikal-badge {
  flex-shrink: 0;
  font-size: 0.63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 999px;
}
.vertikal-badge.v-klinik   { background: #d1fae5; color: #059669; border: 1px solid rgba(5,150,105,0.2); }
.vertikal-badge.v-retail   { background: #fef3c7; color: #d97706; border: 1px solid rgba(217,119,6,0.2); }
.vertikal-badge.v-legal    { background: #ede9fe; color: #6d28d9; border: 1px solid rgba(109,40,217,0.2); }
.vertikal-badge.v-logistik { background: #dbeafe; color: #1d4ed8; border: 1px solid rgba(29,78,216,0.2); }
.vertikal-badge.v-umum     { background: #f3f4f6; color: #6b7280; border: 1px solid rgba(107,114,128,0.2); }

/* --- Scan Section --- */
.scan-section { margin-top: 16px; }

.scan-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.scan-divider::before,
.scan-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(13,46,160,0.1);
}
.scan-divider span {
  font-size: 0.72rem;
  color: var(--text-secondary);
  white-space: nowrap;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.btn-scan {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #ffffff;
  border: 1.5px solid rgba(13,46,160,0.25);
  border-radius: var(--radius-btn);
  padding: 11px 20px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--brother-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,0.9),
    0 2px 8px rgba(13,46,160,0.08);
}
.btn-scan:hover {
  background: var(--brother-light);
  border-color: rgba(13,46,160,0.45);
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,0.9),
    0 4px 12px rgba(13,46,160,0.14);
  transform: translateY(-1px);
}
.btn-scan:active { transform: translateY(0); }
.btn-scan:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.btn-scan.scanning {
  border-color: rgba(34,197,94,0.4);
  background: rgba(220,252,231,0.5);
  color: #15803d;
}
.btn-scan.error {
  border-color: rgba(239,68,68,0.3);
  background: rgba(254,226,226,0.5);
  color: #dc2626;
}

.scan-status {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.8rem;
  line-height: 1.5;
}
.scan-status.ok      { background: #dcfce7; color: #15803d; border: 1px solid rgba(21,128,61,0.15); }
.scan-status.info    { background: var(--brother-light); color: var(--brother-primary); border: 1px solid rgba(13,46,160,0.15); }
.scan-status.warn    { background: #fef3c7; color: #d97706; border: 1px solid rgba(217,119,6,0.2); }
.scan-status.error   { background: #fee2e2; color: #dc2626; border: 1px solid rgba(220,38,38,0.15); }

.scan-status .scan-hint {
  font-size: 0.72rem;
  margin-top: 4px;
  opacity: 0.8;
}

/* Scanner pulse animation when waiting */
@keyframes scanPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}
.btn-scan.scanning svg { animation: scanPulse 1.5s ease infinite; }

/* --- Loading Spinner --- */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(13,46,160,0.2);
  border-top-color: var(--brother-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--neutral-900);
  border-radius: 999px;
  padding: 10px 24px;
  font-size: 0.85rem;
  font-weight: 500;
  color: white;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  z-index: 999;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(10,15,46,0.25);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.error { background: #dc2626; }
.toast.success { background: #15803d; }

/* --- Footer --- */
.footer {
  text-align: center;
  padding: 20px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.footer-sep { margin: 0 8px; color: rgba(13,46,160,0.2); }
.footer strong { color: var(--brother-primary); font-weight: 700; }
