/* ==========================================================
   EuroSAT Land Classifier — Dark Space Theme
   ========================================================== */

/* ── Variables ─────────────────────────────────────────── */
:root {
  --bg:           #020817;
  --surface:      #0d1526;
  --card:         #131f35;
  --card-hover:   #192841;
  --border:       #1e3050;
  --border-light: #2a4166;
  --primary:      #6366f1;
  --primary-glow: rgba(99,102,241,0.25);
  --secondary:    #8b5cf6;
  --accent:       #06b6d4;
  --accent-dim:   rgba(6,182,212,0.15);
  --text:         #e2e8f0;
  --text-muted:   #64748b;
  --text-dim:     #94a3b8;
  --success:      #10b981;
  --error:        #ef4444;
  --warn:         #f59e0b;
  --font:         'Inter', system-ui, -apple-system, sans-serif;
  --radius:       14px;
  --radius-sm:    8px;
  --radius-xs:    5px;
  --shadow:       0 8px 32px rgba(0,0,0,0.5);
  --shadow-sm:    0 2px 12px rgba(0,0,0,0.3);
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}
img, canvas { display: block; }
button { font-family: var(--font); cursor: pointer; }

/* ── Star field background ─────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.15) 0%, transparent 100%),
    radial-gradient(1px 1px at 80% 10%, rgba(255,255,255,0.1)  0%, transparent 100%),
    radial-gradient(1px 1px at 60% 70%, rgba(255,255,255,0.1)  0%, transparent 100%),
    radial-gradient(1px 1px at 40% 80%, rgba(255,255,255,0.08) 0%, transparent 100%),
    radial-gradient(2px 2px at 70% 45%, rgba(255,255,255,0.06) 0%, transparent 100%),
    radial-gradient(1px 1px at 15% 60%, rgba(255,255,255,0.07) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 85%, rgba(255,255,255,0.08) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

/* ══════════════════════════════════════════════════════════
   HERO HEADER
   ══════════════════════════════════════════════════════════ */
.hero-header {
  position: relative;
  z-index: 1;
  background: linear-gradient(160deg, #0d1526 0%, #1a1040 50%, #0d1526 100%);
  border-bottom: 1px solid var(--border);
  padding: 3.5rem 2rem 3rem;
  text-align: center;
  overflow: hidden;
}

.hero-header::before {
  content: '';
  position: absolute;
  top: -60%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 600px;
  background: radial-gradient(ellipse,
    rgba(99,102,241,0.12) 0%,
    rgba(139,92,246,0.06) 40%,
    transparent 70%);
  pointer-events: none;
}

.hero-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent, rgba(99,102,241,0.5), rgba(139,92,246,0.5), transparent);
}

.header-content { position: relative; z-index: 1; }

.satellite-icon {
  font-size: 4.5rem;
  display: inline-block;
  margin-bottom: 1rem;
  animation: satellite-float 4s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(99,102,241,0.4));
}

@keyframes satellite-float {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50%       { transform: translateY(-12px) rotate(5deg); }
}

.hero-header h1 {
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, #a5b4fc 0%, #c084fc 45%, #67e8f9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  color: var(--text-dim);
  font-size: 1.05rem;
  margin-bottom: 1.75rem;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.badge-row {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.badge {
  background: rgba(99,102,241,0.12);
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: #a5b4fc;
  backdrop-filter: blur(4px);
}
.badge.green  { background: rgba(16,185,129,0.1);  border-color: rgba(16,185,129,0.25);  color: #6ee7b7; }
.badge.cyan   { background: rgba(6,182,212,0.1);   border-color: rgba(6,182,212,0.25);   color: #67e8f9; }

/* ══════════════════════════════════════════════════════════
   MAIN LAYOUT
   ══════════════════════════════════════════════════════════ */
.main-content {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ══════════════════════════════════════════════════════════
   TABS
   ══════════════════════════════════════════════════════════ */
.tab-nav {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  padding: 0.35rem;
  width: fit-content;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.6rem 1.5rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.tab-btn:hover { color: var(--text); background: var(--card); }
.tab-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  box-shadow: 0 2px 16px rgba(99,102,241,0.4);
}

.tab-content { display: block; animation: fadeIn 0.25s ease; }
.tab-content.hidden { display: none; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════
   PANELS / CARDS
   ══════════════════════════════════════════════════════════ */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s;
}
.panel:hover { border-color: var(--border-light); }

.panel h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.panel h3 {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.85rem;
}
.panel-desc {
  color: var(--text-dim);
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

/* ══════════════════════════════════════════════════════════
   UPLOAD TAB — TWO COLUMN
   ══════════════════════════════════════════════════════════ */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

/* ── Dropzone (now a <label> for native file-picker activation) ─ */
.dropzone {
  display: block;        /* labels are inline by default — must be block */
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3.5rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  background: linear-gradient(135deg,
    rgba(99,102,241,0.02), rgba(139,92,246,0.02));
  position: relative;
  overflow: hidden;
}
.dropzone::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%,
    rgba(99,102,241,0.04), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}
.dropzone:hover { border-color: var(--primary); }
.dropzone:hover::after { opacity: 1; }
.dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(6,182,212,0.07);
  transform: scale(1.01);
}

.dz-icon { font-size: 3.5rem; margin-bottom: 0.75rem; line-height: 1; }
.dz-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.4rem; }
.dz-sub   { font-size: 0.82rem; color: var(--text-muted); }

.dz-types {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}
.dz-type-badge {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  font-family: 'Courier New', monospace;
}
.dz-type-badge.rgb { border-color: rgba(99,102,241,0.4); color: #a5b4fc; }
.dz-type-badge.tif { border-color: rgba(16,185,129,0.4); color: #6ee7b7; }

/* ── Preview ─────────────────────────────────────────────── */
.preview-container {
  margin-top: 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--surface);
}
.preview-label-bar {
  padding: 0.4rem 0.85rem;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.preview-canvas {
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  max-height: 320px;
  object-fit: contain;
}

/* ══════════════════════════════════════════════════════════
   RESULTS PANEL
   ══════════════════════════════════════════════════════════ */
.results-panel { animation: slideUp 0.35s ease; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Top prediction card */
.top-prediction {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  background: linear-gradient(135deg, var(--surface), rgba(99,102,241,0.05));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
}
.top-prediction::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: linear-gradient(180deg, var(--primary), var(--secondary));
  border-radius: 4px 0 0 4px;
}

.pred-emoji { font-size: 3.2rem; line-height: 1; flex-shrink: 0; }
.pred-name  {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.15rem;
  letter-spacing: -0.01em;
}
.pred-conf {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.pred-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.model-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.28rem 0.85rem;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 1.1rem;
}

/* Confidence bars */
.conf-section h3 { margin-bottom: 0.85rem; }

.conf-bars {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.conf-row {
  display: grid;
  grid-template-columns: 150px 1fr 54px;
  align-items: center;
  gap: 0.6rem;
  padding: 0.28rem 0.5rem;
  border-radius: var(--radius-xs);
  transition: background 0.15s;
}
.conf-row:hover { background: rgba(255,255,255,0.03); }
.conf-row.top-class {
  background: rgba(99,102,241,0.07);
  border: 1px solid rgba(99,102,241,0.15);
}

.conf-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 500;
  overflow: hidden;
  white-space: nowrap;
}
.conf-emoji { font-size: 0.95rem; flex-shrink: 0; }
.conf-name  { overflow: hidden; text-overflow: ellipsis; }

.conf-bar-wrap {
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  height: 7px;
  overflow: hidden;
}
.conf-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 4px;
  transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

.conf-pct {
  font-size: 0.78rem;
  font-weight: 600;
  text-align: right;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* ══════════════════════════════════════════════════════════
   MAP TAB
   ══════════════════════════════════════════════════════════ */
.map-instruction {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--accent-dim);
  border: 1px solid rgba(6,182,212,0.2);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  font-size: 0.88rem;
  color: #67e8f9;
  margin-bottom: 1.25rem;
}

.map-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 1.5rem;
  height: 700px;
}
@media (max-width: 1100px) {
  .map-layout { grid-template-columns: 1fr; height: auto; }
}

.map-container-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  height: 100%;
  min-height: 520px;
  box-shadow: var(--shadow);
}
#map-container {
  width: 100%;
  height: 100%;
  min-height: 520px;
}

/* Leaflet dark overrides */
.leaflet-container { background: #0d1526 !important; }
.leaflet-control-zoom a {
  background: var(--card) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
.leaflet-control-attribution {
  background: rgba(13,21,38,0.8) !important;
  color: var(--text-muted) !important;
  font-size: 0.68rem !important;
}

.map-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  max-height: 700px;
}

/* Map placeholder */
.map-placeholder {
  text-align: center;
  padding: 2.5rem 1.5rem;
  flex: 1;
}
.ph-icon {
  font-size: 4rem;
  display: block;
  margin-bottom: 1rem;
  opacity: 0.6;
  animation: pulse 3s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1);    opacity: 0.6; }
  50%       { transform: scale(1.05); opacity: 0.8; }
}
.ph-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
.ph-sub   { font-size: 0.82rem; color: var(--text-muted); line-height: 1.5; }

/* Tile preview in map sidebar */
.coords-text {
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.tile-preview-canvas {
  width: 100%;
  height: auto;
  border-radius: var(--radius-xs);
  image-rendering: pixelated;
}

/* ══════════════════════════════════════════════════════════
   LOADING OVERLAY
   ══════════════════════════════════════════════════════════ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2,8,23,0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.15s ease;
}

.loading-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 3.5rem;
  text-align: center;
  box-shadow: var(--shadow);
  min-width: 240px;
}

.spinner-ring {
  width: 52px;
  height: 52px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-right-color: var(--secondary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin: 0 auto 1.2rem;
}

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

.loading-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}
#loading-text {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ══════════════════════════════════════════════════════════
   ERROR TOAST
   ══════════════════════════════════════════════════════════ */
.error-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #1a0a0a;
  border: 1px solid rgba(239,68,68,0.5);
  border-left: 3px solid var(--error);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.3rem;
  font-size: 0.88rem;
  color: #fca5a5;
  z-index: 9998;
  max-width: 400px;
  box-shadow: var(--shadow);
  animation: slideUp 0.3s ease;
  line-height: 1.5;
}

/* ══════════════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════════════ */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  line-height: 2;
}
.footer a { color: var(--primary); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════════
   UTILITY
   ══════════════════════════════════════════════════════════ */
.hidden { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ══════════════════════════════════════════════════════════
   SENTINEL HUB SETTINGS BUTTON + BADGE
   ══════════════════════════════════════════════════════════ */
.sh-settings-btn {
  background: none;
  border: none;
  padding: 0;
  margin-left: auto;
  flex-shrink: 0;
  cursor: pointer;
}

.sh-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(99,102,241,0.1);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: #a5b4fc;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.sh-badge:hover { background: rgba(99,102,241,0.2); border-color: rgba(99,102,241,0.5); }
.sh-badge.connected {
  background: rgba(16,185,129,0.1);
  border-color: rgba(16,185,129,0.3);
  color: #6ee7b7;
}

/* Make map instruction flex so the badge sits on the right */
.map-instruction {
  display: flex !important;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════════
   CREDENTIALS MODAL
   ══════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2,8,23,0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
  padding: 1rem;
}

.modal-card {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: calc(var(--radius) + 2px);
  padding: 2rem;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  animation: slideUp 0.25s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.modal-header h2 { font-size: 1.2rem; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-xs);
  transition: color 0.2s, background 0.2s;
}
.modal-close:hover { color: var(--text); background: rgba(255,255,255,0.06); }

.modal-desc {
  font-size: 0.88rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
  line-height: 1.6;
}
.modal-desc a { color: var(--accent); text-decoration: none; }
.modal-desc a:hover { text-decoration: underline; }

/* How-to steps */
.how-to {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.84rem;
}
.how-to summary {
  cursor: pointer;
  color: var(--text-dim);
  font-weight: 500;
  user-select: none;
}
.how-to ol {
  margin: 0.75rem 0 0 1.2rem;
  line-height: 2;
  color: var(--text-muted);
}
.how-to a { color: var(--accent); }

/* Form inputs */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}
.form-group input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.form-group input::placeholder { color: var(--text-muted); }

/* Buttons */
.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}
.btn-primary {
  flex: 1;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.7rem 1.2rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  box-shadow: 0 2px 12px rgba(99,102,241,0.35);
}
.btn-primary:hover  { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.7rem 1rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.btn-secondary:hover { background: var(--card-hover); color: var(--text); }

.modal-note {
  font-size: 0.76rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

