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

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

:root {
  --green-primary : #056839;
  --green-light   : #B4D2C4;
  --green-active  : #0CA901;
  --bg            : #F1F0F0;
  --surface       : #ffffff;
  --border        : #dde1e0;
  --danger        : #B50000;
  --text-main     : #1a1d23;
  --text-sub      : #787575;
  --text-mono     : #374151;

  --radius    : 12px;
  --shadow    : 0 1px 3px rgba(0,0,0,.07), 0 4px 14px rgba(0,0,0,.05);
  --font      : 'Geologica', sans-serif;
  --font-logo : 'Lexend', sans-serif;
  --mono      : 'DM Mono', monospace;
}

body {
  font-family : var(--font);
  background  : var(--bg);
  color       : var(--text-main);
  min-height  : 100vh;
  display     : flex;
  flex-direction: column;
}

/* ── Header ────────────────────────────────────────── */
.header {
  background   : var(--surface);
  border-bottom: 1px solid var(--border);
  position     : sticky;
  top          : 0;
  z-index      : 100;
  width        : 100%;
}
.header__inner {
  max-width   : 1100px;
  margin      : 0 auto;
  padding     : 14px 32px;
  display     : flex;
  align-items : center;
  justify-content: space-between;
  gap         : 12px;
  min-height  : 72px;
}
.header__right {
  display    : flex;
  align-items: center;
  gap        : 14px;
  flex-wrap  : wrap;
  justify-content: flex-end;
}
.header__user-name {
  font-size: .85rem;
  color    : var(--text-sub);
  max-width: 180px;
  overflow : hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.header__brand {
  display    : flex;
  align-items: center;
  gap        : 6px;
}
.brand-name {
  font-family: var(--font-logo);
  font-weight: 700;
  font-size  : 1.3rem;
  color      : var(--green-primary);
  letter-spacing: -0.02em;
}
.brand-name span {
  color: var(--green-primary);
  font-weight: 400;
}
.brand-icon { display: none; }

/* Hospital logo in header */
.header__logo-rs {
  height: 44px;
  width: auto;
  object-fit: contain;
}

/* status badge */
.header__status {
  display    : flex;
  align-items: center;
  gap        : 6px;
  font-size  : .8rem;
  color      : var(--text-sub);
}
.status-dot {
  width        : 9px;
  height       : 9px;
  border-radius: 50%;
  background   : #9ca3af;
  transition   : background .3s;
  flex-shrink  : 0;
}
.status-dot.ok   { background: var(--green-active); }
.status-dot.err  { background: var(--danger); }

/* ── Main layout ───────────────────────────────────── */
.main {
  flex      : 1;
  max-width : 900px;
  margin    : 0 auto;
  padding   : 60px 32px 80px;
  width     : 100%;
  display   : flex;
  flex-direction: column;
  gap       : 28px;
  min-height: calc(100vh - 70px);
}

/* ── Hero ──────────────────────────────────────────── */
.hero__title {
  font-size  : 2.1rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
  color: var(--green-primary);
}
.hero__title span { color: var(--text-main); }
.hero__sub {
  color    : var(--text-sub);
  font-size: .93rem;
  max-width: 560px;
  line-height: 1.65;
  font-weight: 400;
}

/* ── Card ──────────────────────────────────────────── */
.card {
  background   : var(--surface);
  border       : 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow   : var(--shadow);
  padding      : 28px;
  display      : flex;
  flex-direction: column;
  gap          : 20px;
}

/* ── Upload Zone ───────────────────────────────────── */
.upload-zone {
  border       : 2px dashed var(--green-light);
  border-radius: 10px;
  padding      : 80px 20px;
  text-align   : center;
  cursor       : pointer;
  transition   : border-color .2s, background .2s;
  position     : relative;
  background   : #fafafa;
  min-height   : 280px;
  display      : flex;
  align-items  : center;
  justify-content: center;
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--green-primary);
  background  : rgba(5,104,57,.04);
}
.upload-icon  { font-size: 2.4rem; margin-bottom: 14px; color: var(--green-primary); }
.upload-title { font-weight: 500; font-size: .95rem; margin-bottom: 5px; color: var(--text-main); }
.upload-sub   { color: var(--text-sub); font-size: .82rem; margin-bottom: 2px; }
.upload-format{ color: var(--text-sub); font-size: .78rem; }

/* Camera SVG icon replacement */
.upload-icon svg {
  width: 48px;
  height: 48px;
}

/* ── Preview ───────────────────────────────────────── */
.preview-area {
  display       : flex;
  flex-direction: column;
  align-items   : center;
  gap           : 14px;
}
.preview-area img {
  max-height   : 300px;
  max-width    : 100%;
  border-radius: 10px;
  border       : 1px solid var(--border);
  object-fit   : cover;
}

/* Upload card action row */
.upload-actions {
  display: flex;
  gap    : 12px;
}
.upload-actions .btn { flex: 1; }

/* ── Buttons ───────────────────────────────────────── */
.btn {
  display        : inline-flex;
  align-items    : center;
  justify-content: center;
  gap            : 8px;
  padding        : 12px 24px;
  border-radius  : 8px;
  font-family    : var(--font);
  font-size      : .88rem;
  font-weight    : 600;
  cursor         : pointer;
  border         : none;
  transition     : background .2s, opacity .2s, transform .1s;
  letter-spacing : 0.01em;
}
.btn:active { transform: scale(.97); }

.btn--primary {
  background: var(--green-primary);
  color     : #fff;
}
.btn--primary:hover:not(:disabled) { background: #044f2c; }
.btn--primary:disabled {
  background: var(--green-light);
  cursor    : not-allowed;
  color     : #fff;
}

.btn--ghost {
  background: transparent;
  color     : var(--green-primary);
  border    : 1.5px solid var(--green-primary);
}
.btn--ghost:hover { background: rgba(5,104,57,.06); }

.btn--sm {
  padding  : 7px 14px;
  font-size: .78rem;
  width      : auto;
}

.btn--block { width: 100%; }

/* spinner */
.btn__spinner {
  width        : 16px;
  height       : 16px;
  border       : 2px solid rgba(255,255,255,.4);
  border-top   : 2px solid #fff;
  border-radius: 50%;
  animation    : spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Result Card ───────────────────────────────────── */
.result-card { animation: slideUp .3s ease; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-header {
  display    : flex;
  align-items: flex-start;
  gap        : 16px;
}
.result-icon { font-size: 2.4rem; line-height: 1; }
.result-label {
  font-size  : 1.5rem;
  font-weight: 700;
  margin-bottom: 5px;
  letter-spacing: -0.01em;
}
.result-label.katarak { color: var(--danger);         }
.result-label.normal  { color: var(--green-primary);  }
.result-message       { color: var(--text-sub); font-size: .88rem; line-height: 1.5; }

/* meter */
.result-meter { display: flex; flex-direction: column; gap: 8px; }
.meter-label  {
  display        : flex;
  justify-content: space-between;
  font-size      : .85rem;
  color          : var(--text-sub);
}
.meter-value { font-weight: 700; color: var(--text-main); }
.meter-track {
  height       : 10px;
  background   : var(--bg);
  border-radius: 99px;
  overflow     : hidden;
  border       : 1px solid var(--border);
}
.meter-fill {
  height       : 100%;
  border-radius: 99px;
  transition   : width .8s ease;
  background   : var(--green-primary);
}
.meter-fill.high  { background: var(--danger);        }
.meter-fill.low   { background: var(--green-active);  }

/* meta info */
.result-meta {
  display  : grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap      : 12px;
  padding  : 16px;
  background: var(--bg);
  border-radius: 8px;
}
.meta-item {
  display       : flex;
  flex-direction: column;
  gap           : 4px;
}
.meta-key { font-size: .73rem; color: var(--text-sub); text-transform: uppercase; letter-spacing: .06em; font-weight: 500; }
.meta-val { font-size: .88rem; font-weight: 600; }
.mono     { font-family: var(--mono); font-size: .82rem !important; color: var(--text-mono); }

/* ── Error banner ──────────────────────────────────── */
.error-banner {
  background   : #fff0f0;
  border       : 1px solid #fecaca;
  border-radius: 8px;
  padding      : 14px 18px;
  color        : var(--danger);
  font-size    : .88rem;
  display      : flex;
  gap          : 10px;
  align-items  : flex-start;
  animation    : slideUp .25s ease;
}

/* ── Footer ────────────────────────────────────────── */
.footer {
  background : var(--green-primary);
  color      : rgba(255,255,255,.85);
  padding    : 40px 32px 24px;
  text-align : center;
  display    : flex;
  flex-direction: column;
  align-items: center;
  gap        : 14px;
}
.footer__brand {
  font-family: var(--font-logo);
  font-weight: 600;
  font-size  : 1.3rem;
  color      : #fff;
  margin-bottom: 4px;
}
.footer__brand span { 
  color: rgba(255,255,255,.7); 
  font-weight: 400;
}
.footer__disclaimer {
  font-size: .85rem;
  line-height: 1.6;
  max-width: 600px;
  color: rgba(255,255,255,.8);
}
.footer__disclaimer-title {
  font-size  : 1rem;
  font-weight: 600;
  color      : #fff;
  margin-bottom: 6px;
}
.footer__copy {
  font-size : .75rem;
  color     : rgba(255,255,255,.55);
  border-top: 1px solid rgba(255,255,255,.15);
  padding-top: 16px;
  width     : 100%;
}
.footer__api { font-size: .72rem; color: rgba(255,255,255,.45); }


/* ── Cara Kerja Section ────────────────────────────── */
.how-section {
  background : var(--green-primary);
  padding    : 56px 32px;
  text-align : center;
}
.how-title {
  font-family   : var(--font);
  font-size     : 1.5rem;
  font-weight   : 700;
  color         : #fff;
  margin-bottom : 40px;
  letter-spacing: -0.01em;
}
.how-title span {
  font-family: var(--font-logo);
  font-weight: 600;
}
.how-steps {
  display              : grid;
  grid-template-columns: repeat(4, 1fr);
  gap                  : 24px;
  max-width            : 1100px;
  margin               : 0 auto;
  padding              : 0 32px;
}
.how-step {
  border       : 1.5px solid rgba(255,255,255,.3);
  border-radius: 12px;
  padding      : 28px 16px 24px;
  display      : flex;
  flex-direction: column;
  align-items  : center;
  gap          : 12px;
  transition   : background .2s;
}
.how-step:hover { background: rgba(255,255,255,.07); }
.how-step__num {
  width        : 48px;
  height       : 48px;
  border-radius: 50%;
  background   : #fff;
  color        : var(--green-primary);
  font-size    : 1.2rem;
  font-weight  : 700;
  display      : flex;
  align-items  : center;
  justify-content: center;
  flex-shrink  : 0;
}
.how-step__label {
  font-size  : .95rem;
  font-weight: 600;
  color      : #fff;
}
.how-step__desc {
  font-size  : .8rem;
  color      : rgba(255,255,255,.7);
  line-height: 1.5;
}

@media (max-width: 768px) {
  .how-steps { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .how-steps { grid-template-columns: 1fr; }
  .how-section { padding: 40px 20px; }
}

/* ── Auth body ─────────────────────────────────────── */
.auth-body { min-height: 100vh; }

/* Auth page header — simpler */
.auth-header-logo {
  height: 44px;
}

/* Auth page hero section — padding must match header__inner exactly */
.auth-hero-section {
  max-width : 1100px;
  margin    : 0 auto;
  padding   : 80px 32px 72px;
  display   : grid;
  grid-template-columns: 1fr 1fr;
  gap       : 48px;
  align-items: center;
  width     : 100%;
}
.auth-hero-text {}
.auth-hero-title {
  font-size  : 3rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 18px;
  color: var(--text-main);
}
.auth-hero-title span { color: var(--green-primary); }
.auth-hero-sub {
  color      : var(--text-sub);
  font-size  : .9rem;
  line-height: 1.7;
  margin-bottom: 28px;
  max-width  : 400px;
}
.auth-hero-img {
  width        : 100%;
  height       : 340px;
  object-fit   : cover;
  border-radius: 16px;
}

/* Auth form section */
.auth-form-section {
  max-width: 700px;
  margin   : 0 auto;
  padding  : 60px 32px 60px;
  display  : flex;
  flex-direction: column;
  align-items: center;
  gap      : 20px;
}
.auth-form-title {
  font-size  : 1.4rem;
  font-weight: 700;
  text-align : center;
  letter-spacing: -0.01em;
}
.auth-form-sub {
  text-align: center;
  color     : var(--text-sub);
  font-size : .85rem;
  line-height: 1.5;
  margin-top: -8px;
}

/* Tab switcher */
.auth-tabs {
  display      : flex;
  gap          : 0;
  border-radius: 10px;
  border       : 1px solid var(--border);
  overflow     : hidden;
  background   : var(--surface);
  width        : 100%;
  max-width    : 400px;
}
.auth-tab {
  flex      : 1;
  padding   : 11px 16px;
  border    : none;
  background: var(--surface);
  font-family: var(--font);
  font-size : .88rem;
  font-weight: 600;
  color     : var(--text-sub);
  cursor    : pointer;
  transition: background .15s, color .15s;
}
.auth-tab--active {
  background: var(--green-primary);
  color     : #fff;
}
.auth-tab:hover:not(.auth-tab--active) { background: var(--bg); }

/* Auth card */
.auth-card {
  width    : 100%;
  max-width: 400px;
  padding  : 24px 26px;
}
.auth-form { display: flex; flex-direction: column; gap: 16px; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size : .8rem;
  font-weight: 600;
  color     : var(--text-main);
}
.form-group input {
  padding      : 10px 12px;
  border-radius: 8px;
  border       : 1.5px solid var(--green-light);
  font-family  : var(--font);
  font-size    : .9rem;
  background   : rgba(180,210,196,.12);
  transition   : border-color .2s, box-shadow .2s;
  color        : var(--text-main);
}
.form-group input::placeholder { color: var(--text-sub); font-size: .85rem; }
.form-group input:focus {
  outline    : none;
  border-color: var(--green-primary);
  box-shadow : 0 0 0 3px rgba(5,104,57,.12);
  background : #fff;
}
.form-hint { font-size: .73rem; color: var(--text-sub); margin-top: -6px; }
.form-error {
  font-size: .83rem;
  color    : var(--danger);
  margin   : 0;
}
.form-success {
  font-size: .83rem;
  color    : var(--green-active);
  margin   : 0;
}

.auth-foot {
  text-align : center;
  font-size  : .83rem;
  color      : var(--text-sub);
  display    : flex;
  flex-direction: column;
  gap        : 6px;
  align-items: center;
}
.auth-foot a { color: var(--green-primary); text-decoration: none; font-weight: 600; }
.auth-foot a:hover { text-decoration: underline; }
.auth-foot-api { font-size: .72rem; }
.auth-badge { display: none; }

/* Auth main (for old login.html structure fallback) */
.auth-main { max-width: 480px; }

/* ── Predict page layout ───────────────────────────── */
.predict-layout {
  max-width: 900px;
}

/* Upload card two-column inside */
.upload-card .upload-inner {
  display: flex;
  gap    : 20px;
  align-items: flex-start;
}
.upload-card .upload-inner .upload-zone { flex: 1; }
.upload-card .upload-inner .preview-area { flex: 1; }

/* ── Responsive ────────────────────────────────────── */
/* ── Tablet (≤1024px) ──────────────────────────────── */
@media (max-width: 1024px) {
  .auth-hero-section {
    padding: 60px 32px 48px;
    gap    : 32px;
  }
  .auth-hero-title { font-size: 2.4rem; }
  .auth-hero-img   { height: 280px; }
  .how-steps       { padding: 0 20px; }
}

/* ── Tablet kecil / landscape phone (≤768px) ───────── */
@media (max-width: 768px) {
  /* hero: stack vertikal, gambar tetap muncul tapi lebih kecil */
  .auth-hero-section {
    grid-template-columns: 1fr;
    padding              : 40px 24px 36px;
    gap                  : 28px;
  }
  .auth-hero-img {
    height      : 220px;
    width       : 100%;
    order       : -1;        /* foto di atas teks di mobile */
    border-radius: 12px;
  }
  .auth-hero-title   { font-size: 2rem; }
  .auth-hero-sub     { max-width: 100%; }
  .auth-form-section { padding: 40px 24px 48px; }
  .how-steps         { grid-template-columns: repeat(2, 1fr); padding: 0 24px; }
  .main              { padding: 28px 24px 60px; }
  .header__inner     { padding: 12px 24px; }
}

/* ── Phone (≤480px) ────────────────────────────────── */
@media (max-width: 480px) {
  .auth-hero-img     { height: 180px; }
  .auth-hero-title   { font-size: 1.7rem; }
  .auth-hero-section { padding: 28px 16px 24px; gap: 20px; }
  .auth-form-section { padding: 32px 16px 40px; }
  .how-steps         { grid-template-columns: 1fr; padding: 0 16px; }
  .how-section       { padding: 40px 16px; }
  .auth-tabs         { max-width: 100%; }
  .auth-card         { padding: 20px 18px; }
}

/* ── Phone kecil (≤600px) ──────────────────────────── */
@media (max-width: 600px) {
  .hero__title           { font-size: 1.6rem; }
  .result-meta           { grid-template-columns: 1fr 1fr; }
  .main                  { padding: 24px 16px 40px; }
  .header__user-name     { max-width: 90px; font-size: .75rem; }
  .footer                { padding: 32px 16px 20px; }
  .upload-actions        { flex-direction: column; }
  .brand-name            { font-size: 1.1rem; }
  .header__logo-rs       { height: 36px; }
}