/* SmartWaste AI — style.css */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f8f9fa;
  color: #111;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Ensure hidden attribute always wins over any CSS display value */
[hidden] { display: none !important; }

/* ── NAV ───────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #e5e7eb;
}
.nav-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 28px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  color: #111;
  letter-spacing: -0.01em;
}
nav { display: flex; gap: 4px; }
nav a {
  padding: 6px 14px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #555;
  text-decoration: none;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}
nav a:hover { color: #16a34a; background: #f0fdf4; }

/* ── HERO ──────────────────────────────── */
.hero {
  background: linear-gradient(150deg, #f0fdf4 0%, #ffffff 55%, #fafafa 100%);
  padding: 96px 28px 88px;
  text-align: center;
  border-bottom: 1px solid #e5e7eb;
}
.hero-inner { max-width: 600px; margin: 0 auto; }

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #16a34a;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 28px;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.035em;
  color: #0f172a;
  margin-bottom: 20px;
}
.green { color: #16a34a; }

.hero-sub {
  font-size: 1.05rem;
  color: #4b5563;
  margin-bottom: 36px;
  line-height: 1.75;
}
.hero-sub strong { color: #111; font-weight: 600; }

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── HOW IT WORKS ──────────────────────── */
.how {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 80px 28px;
}
.section-inner { max-width: 820px; margin: 0 auto; }

h2 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #0f172a;
  text-align: center;
  margin-bottom: 52px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  list-style: none;
}

.step {
  position: relative;
  text-align: center;
  padding: 36px 24px 32px;
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.step:hover {
  border-color: #bbf7d0;
  box-shadow: 0 8px 24px rgba(22,163,74,.08);
  transform: translateY(-3px);
}

.step-icon {
  width: 52px;
  height: 52px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #16a34a;
  margin: 0 auto 16px;
  transition: background 0.2s;
}
.step:hover .step-icon { background: #dcfce7; }

.step-num {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9ca3af;
  margin-bottom: 6px;
}

.step h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #111;
  margin-bottom: 8px;
}
.step p {
  font-size: 0.85rem;
  color: #6b7280;
  line-height: 1.6;
}

/* ── CLASSIFIER SECTION ─────────────────── */
.classifier-section {
  padding: 80px 28px;
  background: #f8f9fa;
}

.classifier-section h2 { margin-bottom: 10px; }

.section-sub {
  text-align: center;
  font-size: 0.92rem;
  color: #6b7280;
  margin-bottom: 44px;
}

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  padding: 40px;
  max-width: 500px;
  margin: 0 auto;
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
}

/* ── Upload zone ─────────── */
.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 52px 24px;
  border: 2px dashed #d1d5db;
  border-radius: 14px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: #16a34a;
  background: #f0fdf4;
}
.upload-zone:focus-visible { outline: 3px solid #16a34a; outline-offset: 3px; }

.upload-icon-bg {
  width: 60px;
  height: 60px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #16a34a;
  margin-bottom: 6px;
  transition: background 0.2s, transform 0.2s;
}
.upload-zone:hover .upload-icon-bg {
  background: #dcfce7;
  transform: translateY(-2px);
}

.upload-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: #111;
}
.upload-hint {
  font-size: 0.8rem;
  color: #9ca3af;
}

/* ── Buttons ─────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 10px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  text-decoration: none;
  user-select: none;
}
.btn:focus-visible { outline: 3px solid #16a34a; outline-offset: 3px; }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
}
.btn-primary:hover:not(:disabled) {
  background: #15803d;
  border-color: #15803d;
  box-shadow: 0 4px 16px rgba(22,163,74,.3);
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-outline {
  background: transparent;
  color: #16a34a;
  border-color: #d1d5db;
}
.btn-outline:hover { border-color: #16a34a; background: #f0fdf4; }

.btn-ghost {
  background: transparent;
  color: #374151;
  border-color: #e5e7eb;
}
.btn-ghost:hover { background: #f3f4f6; border-color: #d1d5db; }

.btn-full { width: 100%; }

/* ── Preview ─────────────── */
.preview-section { display: flex; flex-direction: column; gap: 14px; }

.image-card {
  position: relative;
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Placeholder shown when image has no src yet */
.image-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 10px,
      rgba(0,0,0,.018) 10px,
      rgba(0,0,0,.018) 20px
    );
  border-radius: inherit;
  pointer-events: none;
}

.image-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #d1d5db;
  user-select: none;
  pointer-events: none;
}
.image-placeholder svg { opacity: .6; }
.image-placeholder span {
  font-size: 0.78rem;
  font-weight: 500;
  color: #d1d5db;
  letter-spacing: 0.02em;
}

.image-card img {
  position: relative; /* above ::before */
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.remove-btn {
  position: absolute;
  top: 10px; right: 10px;
  width: 30px; height: 30px;
  background: rgba(255,255,255,.92);
  border: 1px solid #e5e7eb;
  border-radius: 50%;
  color: #6b7280;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.remove-btn:hover { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.remove-btn:focus-visible { outline: 2px solid #dc2626; }

.error-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 0.83rem;
  padding: 10px 14px;
  border-radius: 8px;
}

/* ── Loading ─────────────── */
.loading-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 52px 0 48px;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid #e5e7eb;
  border-top-color: #16a34a;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin-bottom: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: #111;
}
.loading-sub {
  font-size: 0.8rem;
  color: #9ca3af;
}

/* ── Result ──────────────── */
.result-section { display: flex; flex-direction: column; gap: 14px; }

.result-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #86efac;
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
}

.result-icon-wrap {
  width: 48px;
  height: 48px;
  background: #16a34a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin: 0 auto 16px;
  box-shadow: 0 4px 12px rgba(22,163,74,.35);
}

.result-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #16a34a;
  margin-bottom: 10px;
}
.result-class {
  font-size: 2.2rem;
  font-weight: 800;
  color: #14532d;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  line-height: 1.1;
  margin-bottom: 8px;
}
.result-conf {
  font-size: 0.88rem;
  color: #166534;
  font-weight: 500;
  background: rgba(255,255,255,.6);
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
}

/* ── Global error ─────────── */
.global-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 0.84rem;
  line-height: 1.55;
  padding: 14px 16px;
  border-radius: 10px;
}
.global-error svg { flex-shrink: 0; margin-top: 1px; }

/* ── FOOTER ────────────────────────────── */
.site-footer {
  background: #0f172a;
  padding: 52px 24px;
  text-align: center;
}
.footer-inner {
  max-width: 400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.footer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  letter-spacing: -0.01em;
}
.footer-tagline {
  font-size: 0.82rem;
  color: #475569;
  line-height: 1.5;
}
.model-status {
  font-size: 0.72rem;
  color: #334155;
  margin-top: 4px;
}
.model-status.ready { color: #4ade80; }
.model-status.error { color: #f87171; }

/* ── Responsive ─────────────────────────── */
@media (max-width: 640px) {
  .hero { padding: 72px 20px 64px; }
  .how, .classifier-section { padding: 64px 20px; }
  .steps { grid-template-columns: 1fr; gap: 14px; }
  .step { padding: 28px 20px; }
  .card { padding: 24px 20px; border-radius: 16px; }
  .hero-actions { flex-direction: column; }
}
