/* ===== VARIABLES ===== */
:root {
  --bg: #060e06;
  --bg2: #0a1a0a;
  --card: rgba(16, 32, 16, 0.7);
  --card-hover: rgba(20, 40, 20, 0.85);
  --green: #22c55e;
  --green-light: #86efac;
  --green-glow: rgba(34, 197, 94, 0.3);
  --lime: #a3e635;
  --text: #f0fdf4;
  --text2: #bbf7d0;
  --muted: rgba(187, 247, 208, 0.5);
  --border: rgba(34, 197, 94, 0.15);
  --border-h: rgba(34, 197, 94, 0.4);
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --tr: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --heading: 'Outfit', sans-serif;
  --body: 'Inter', sans-serif;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--body); background: var(--bg); color: var(--text); line-height: 1.6; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }

.container { max-width: 640px; margin: 0 auto; padding: 0 16px; }
.text-accent { color: var(--green); }

/* ===== HEADER ===== */
.app-header {
  background: rgba(6, 14, 6, 0.9); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border); padding: 12px 0;
  position: sticky; top: 0; z-index: 100;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 38px; height: 38px; border-radius: 10px; }
.brand-name { font-family: var(--heading); font-size: 1.2rem; font-weight: 700; line-height: 1.2; }
.brand-tagline { font-size: 0.7rem; color: var(--muted); }
.header-badge {
  display: flex; align-items: center; gap: 6px;
  background: rgba(34,197,94,0.1); border: 1px solid var(--border);
  padding: 4px 12px; border-radius: 50px; font-size: 0.72rem; font-weight: 500; color: var(--green-light);
}
.badge-dot { width: 6px; height: 6px; background: var(--green); border-radius: 50%; animation: pulse 2s infinite; }

/* ===== MAIN ===== */
.main { padding: 20px 0 40px; min-height: calc(100vh - 130px); }

/* ===== CARDS ===== */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 12px;
  backdrop-filter: blur(10px); transition: var(--tr);
  animation: fadeUp 0.4s ease both;
}
.card:hover { border-color: var(--border-h); }
.card-highlight { border-color: rgba(34,197,94,0.3); background: rgba(34,197,94,0.05); }
.card-header { margin-bottom: 16px; }
.card-title {
  font-family: var(--heading); font-size: 1rem; font-weight: 600;
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.card-subtitle { font-size: 0.82rem; color: var(--muted); }
.card-section-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.card-section-head h4 { font-family: var(--heading); font-weight: 600; font-size: 0.92rem; }
.card-text { color: var(--text2); font-size: 0.88rem; line-height: 1.7; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 22px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.88rem; transition: var(--tr);
}
.btn-primary {
  background: linear-gradient(135deg, var(--green), #16a34a);
  color: #fff; box-shadow: 0 4px 16px var(--green-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 24px var(--green-glow); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-secondary { background: var(--card); border: 1px solid var(--border); color: var(--text2); }
.btn-secondary:hover { border-color: var(--border-h); }
.btn-ghost { color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--border-h); color: var(--green-light); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

/* ===== UPLOAD ===== */
.upload-area {
  border: 2px dashed var(--border-h); border-radius: var(--radius-sm);
  padding: 36px 16px; text-align: center; cursor: pointer;
  transition: var(--tr); position: relative; overflow: hidden;
}
.upload-area:hover, .upload-area.dragover { border-color: var(--green); background: rgba(34,197,94,0.05); }
.upload-area.has-image { border-style: solid; padding: 0; cursor: default; }
.upload-icon { color: var(--green); margin-bottom: 12px; opacity: 0.7; }
.upload-title { font-family: var(--heading); font-size: 1rem; font-weight: 600; margin-bottom: 2px; }
.upload-text { color: var(--muted); font-size: 0.8rem; margin-bottom: 12px; }
.upload-formats { display: flex; gap: 6px; justify-content: center; }
.upload-formats span {
  padding: 3px 8px; background: rgba(34,197,94,0.1); border-radius: 4px;
  font-size: 0.65rem; font-weight: 600; color: var(--green-light); text-transform: uppercase;
}
.upload-preview { position: relative; }
.upload-preview img { width: 100%; max-height: 350px; object-fit: contain; border-radius: var(--radius-sm); background: #000; }
.btn-remove {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px;
  border-radius: 50%; background: rgba(0,0,0,0.7); color: #fff;
  display: flex; align-items: center; justify-content: center; transition: var(--tr);
}
.btn-remove:hover { background: var(--danger); }
.upload-actions { display: flex; gap: 10px; margin-top: 14px; justify-content: center; }
.upload-actions .btn-primary { flex: 1; justify-content: center; }

/* ===== LOADING ===== */
.loading-card { text-align: center; padding: 36px 20px; }
.loader-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 16px; }
.dot {
  width: 10px; height: 10px; background: var(--green); border-radius: 50%;
  animation: bounce 1.4s ease-in-out infinite;
}
.dot:nth-child(2) { animation-delay: 0.1s; }
.dot:nth-child(3) { animation-delay: 0.2s; }
.loading-title { font-family: var(--heading); font-size: 1.05rem; margin-bottom: 4px; }
.loading-text { color: var(--muted); font-size: 0.82rem; margin-bottom: 14px; }
.progress-bar { width: 100%; max-width: 240px; height: 3px; background: rgba(34,197,94,0.15); border-radius: 2px; margin: 0 auto; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--green), var(--lime)); border-radius: 2px; transition: width 0.5s ease; }

/* ===== ERROR ===== */
.error-card { text-align: center; padding: 32px 20px; border-color: rgba(239,68,68,0.3); }
.error-icon { font-size: 2.5rem; display: block; margin-bottom: 10px; }
.error-title { font-family: var(--heading); font-size: 1.05rem; color: var(--danger); margin-bottom: 4px; }
.error-text { color: var(--muted); font-size: 0.85rem; margin-bottom: 16px; line-height: 1.6; }

/* ===== RESULTS ===== */
.results-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.results-title { font-family: var(--heading); font-size: 1.1rem; font-weight: 700; color: var(--green-light); }
.result-main .result-header { display: flex; gap: 16px; align-items: flex-start; }
.result-thumb { flex-shrink: 0; width: 100px; height: 100px; border-radius: var(--radius-sm); overflow: hidden; border: 2px solid var(--border); }
.result-thumb img { width: 100%; height: 100%; object-fit: cover; }
.result-info { flex: 1; }
.result-badge {
  display: inline-block; padding: 3px 10px; border-radius: 50px;
  font-size: 0.72rem; font-weight: 600; margin-bottom: 6px;
  background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3);
}
.result-badge.healthy { background: rgba(34,197,94,0.15); color: var(--green); border-color: rgba(34,197,94,0.3); }
.result-name { font-family: var(--heading); font-size: 1.15rem; font-weight: 700; margin-bottom: 1px; }
.result-latin { font-style: italic; color: var(--muted); font-size: 0.8rem; margin-bottom: 8px; }
.result-severity { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.sev-label { font-size: 0.75rem; color: var(--muted); }
.sev-value { padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
.sev-value.ringan { background: rgba(34,197,94,0.15); color: var(--green); }
.sev-value.sedang { background: rgba(245,158,11,0.15); color: var(--warning); }
.sev-value.berat { background: rgba(239,68,68,0.15); color: var(--danger); }
.result-confidence { display: flex; align-items: center; gap: 8px; }
.conf-bar { flex: 1; height: 5px; background: rgba(34,197,94,0.15); border-radius: 3px; overflow: hidden; max-width: 120px; }
.conf-fill { height: 100%; background: var(--green); border-radius: 3px; transition: width 1s ease; }
.conf-text { font-size: 0.75rem; font-weight: 600; color: var(--green-light); }

.result-list li {
  position: relative; padding: 6px 0 6px 20px;
  color: var(--text2); font-size: 0.85rem; line-height: 1.6;
  border-bottom: 1px solid rgba(34,197,94,0.05);
}
.result-list li:last-child { border-bottom: none; }
.result-list li::before {
  content: ''; position: absolute; left: 0; top: 14px;
  width: 6px; height: 6px; background: var(--green); border-radius: 50%; opacity: 0.6;
}
.result-list.numbered { counter-reset: step; }
.result-list.numbered li { padding-left: 28px; }
.result-list.numbered li::before {
  content: counter(step); counter-increment: step;
  width: 18px; height: 18px; background: rgba(34,197,94,0.15); border-radius: 50%;
  top: 9px; font-size: 0.65rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; color: var(--green);
}

.disclaimer {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 12px; background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.2);
  border-radius: var(--radius-sm); margin-top: 4px;
}
.disclaimer svg { flex-shrink: 0; color: var(--warning); margin-top: 1px; }
.disclaimer p { font-size: 0.75rem; color: var(--muted); line-height: 1.4; }

/* ===== FOOTER ===== */
.app-footer { text-align: center; padding: 20px; border-top: 1px solid var(--border); }
.app-footer p { font-size: 0.72rem; color: var(--muted); }

/* ===== ANIMATIONS ===== */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes bounce { 0%,80%,100% { transform: scale(0.6); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .result-main .result-header { flex-direction: column; align-items: center; text-align: center; }
  .result-thumb { width: 80px; height: 80px; }
  .result-severity, .result-confidence { justify-content: center; }
  .upload-area { padding: 28px 12px; }
}
