* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --green-dark:  #1a5c2a;
  --green-mid:   #2d8a45;
  --green-light: #4caf50;
  --green-pale:  #e8f5e9;
  --green-accent:#a5d6a7;
  --yellow:      #fbc02d;
  --red:         #e53935;
  --orange:      #fb8c00;
  --blue:        #1976d2;
  --blue-light:  #e3f2fd;
  --text-dark:   #1b2e1e;
  --text-mid:    #3d5c42;
  --text-light:  #6a8c6e;
  --white:       #ffffff;
  --bg:          #f0f7f1;
  --shadow:      0 4px 20px rgba(45,138,69,.12);
  --radius:      16px;
}

/* ── Base ── */
body {
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text-dark);
  min-height: 100vh;
  direction: rtl;
}

[lang="en"] body,
html[data-lang="en"] body {
  direction: ltr;
}

/* ── Header ── */
header {
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-mid) 100%);
  color: var(--white);
  padding: 1.25rem 1.5rem 1.75rem;
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='40' cy='40' r='30' fill='none' stroke='%23ffffff' stroke-opacity='0.04' stroke-width='1'/%3E%3C/svg%3E");
  pointer-events: none;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  position: relative;
  z-index: 1;
}

/* School Brand */
.school-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.school-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(255,255,255,.12);
  padding: 4px;
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
}

.school-text {
  display: flex;
  flex-direction: column;
}

.school-name {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
}

.school-sub {
  font-size: 0.75rem;
  opacity: 0.75;
  margin-top: 2px;
}

/* Lang Toggle */
.lang-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  background: rgba(255,255,255,.18);
  color: var(--white);
  border: 1.5px solid rgba(255,255,255,.4);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(4px);
  font-family: inherit;
}

.lang-btn:hover {
  background: rgba(255,255,255,.3);
  transform: translateY(-1px);
}

.lang-icon { font-size: 1rem; }

/* Header Title */
.header-title {
  text-align: center;
  position: relative;
  z-index: 1;
}

.logo {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.tagline {
  font-size: 0.95rem;
  opacity: 0.85;
}

/* ── Main ── */
main {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Card ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(45,138,69,.08);
}

/* ── Upload Card ── */
.upload-card h2 {
  color: var(--green-dark);
  margin-bottom: 1.25rem;
  font-size: 1.15rem;
}

.drop-zone {
  border: 2.5px dashed var(--green-accent);
  border-radius: var(--radius);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s;
  background: var(--green-pale);
  overflow: hidden;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--green-mid);
  background: #d4edda;
}

#drop-content {
  text-align: center;
  color: var(--text-light);
  pointer-events: none;
}

.drop-icon { font-size: 3.5rem; display: block; margin-bottom: 0.5rem; }
#drop-content p   { margin: 0.2rem 0; }
#drop-content .hint { font-size: 0.8rem; opacity: 0.7; }

.preview-img {
  width: 100%;
  max-height: 380px;
  object-fit: contain;
  border-radius: calc(var(--radius) - 4px);
}

.upload-buttons {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

/* ── Buttons ── */
button {
  padding: 0.65rem 1.4rem;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-primary   { background: var(--green-mid); color: var(--white); }
.btn-primary:hover { background: var(--green-dark); transform: translateY(-1px); }

.btn-secondary {
  background: var(--green-pale);
  color: var(--green-dark);
  border: 1.5px solid var(--green-accent);
}
.btn-secondary:hover { background: var(--green-accent); }

.btn-success {
  background: linear-gradient(135deg, #2d8a45, #1a5c2a);
  color: var(--white);
  flex: 1;
  font-size: 1rem;
}
.btn-success:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(45,138,69,.35);
}
.btn-success:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Loading ── */
.loading {
  text-align: center;
  padding: 2.5rem;
  color: var(--green-mid);
  font-size: 1.05rem;
}

.spinner {
  width: 52px;
  height: 52px;
  border: 5px solid var(--green-pale);
  border-top-color: var(--green-mid);
  border-radius: 50%;
  animation: spin .9s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Results Grid ── */
#results { display: flex; flex-direction: column; gap: 1.25rem; }

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.result-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--green-light);
}

.identity-card { border-top-color: var(--green-mid); }
.health-card   { border-top-color: var(--red); }
.water-card    { border-top-color: var(--blue); }
.issues-card   { border-top-color: var(--orange); }

.result-icon { font-size: 2rem; margin-bottom: 0.5rem; }

.result-card h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  margin-bottom: 0.75rem;
}

.result-value { font-size: 1.25rem; font-weight: 700; color: var(--text-dark); margin-bottom: 0.25rem; }
.result-sub   { font-size: 0.85rem; color: var(--text-light); margin-bottom: 0.15rem; font-style: italic; }
.result-desc  { font-size: 0.9rem; color: var(--text-mid); margin-top: 0.5rem; line-height: 1.5; }

/* Health Badge */
.health-badge {
  display: inline-block;
  padding: 0.35rem 1rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}
.health-excellent { background: #c8e6c9; color: #1b5e20; }
.health-good      { background: #dcedc8; color: #33691e; }
.health-fair      { background: #fff9c4; color: #f57f17; }
.health-poor      { background: #ffccbc; color: #bf360c; }
.health-critical  { background: #ffcdd2; color: #b71c1c; }

/* Issues */
.issues-list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.25rem; }

.issue-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-mid);
  line-height: 1.4;
}

.issue-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.issue-dot.warning { background: var(--orange); }
.issue-dot.danger  { background: var(--red); }
.issue-dot.info    { background: var(--blue); }
.issue-dot.ok      { background: var(--green-light); }

/* Recommendations */
.recommendations-card h3 {
  color: var(--green-dark);
  font-size: 1.1rem;
  margin-bottom: 1.25rem;
}

.recommendations-content { display: flex; flex-direction: column; gap: 0.9rem; }

.rec-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  border-right: 4px solid var(--green-light);
}

html[data-lang="en"] .rec-item {
  border-right: none;
  border-left: 4px solid var(--green-light);
}

.rec-item.water   { background: var(--blue-light);  border-color: var(--blue); }
.rec-item.fert    { background: #fff8e1;             border-color: var(--yellow); }
.rec-item.pest    { background: #fce4ec;             border-color: var(--red); }
.rec-item.light   { background: #fff9c4;             border-color: #f9a825; }
.rec-item.general { background: var(--green-pale);   border-color: var(--green-mid); }

.rec-icon  { font-size: 1.5rem; flex-shrink: 0; }
.rec-body  { flex: 1; }
.rec-title { font-weight: 700; font-size: 0.95rem; color: var(--text-dark); margin-bottom: 0.25rem; }
.rec-text  { font-size: 0.88rem; color: var(--text-mid); line-height: 1.55; }

/* Reset */
.reset-btn { width: 100%; padding: 0.85rem; font-size: 1rem; margin-top: 0.5rem; }

/* ── Footer ── */
footer {
  text-align: center;
  padding: 1.25rem;
  color: var(--text-light);
  font-size: 0.85rem;
  border-top: 1px solid var(--green-accent);
  background: var(--white);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.footer-logo {
  width: 30px;
  height: 30px;
  object-fit: contain;
  border-radius: 6px;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .results-grid    { grid-template-columns: 1fr; }
  .upload-buttons  { flex-direction: column; }
  .school-name     { font-size: 0.82rem; }
  .logo            { font-size: 1.6rem; }
  .header-inner    { gap: 0.5rem; }
}

/* ── Utility ── */
.hidden { display: none !important; }
