/* =========================
   GLOBAL RESET
========================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", system-ui, sans-serif;
}

body {
  min-height: 100vh;
  color: #222;
  background: linear-gradient(
    -45deg,
    #556b2f,
    #007e6e,
    #f0e491,
    #2d3c59
  );
  background-size: 400% 400%;
  animation: gradientShift 20s ease infinite;
  transition: background 0.4s ease, color 0.4s ease, opacity 0.4s ease;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* =========================
   DARK MODE
========================= */
body.dark {
  background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
  color: #f1f1f1;
}

/* ===== NAVBAR FIX ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: 64px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

body.dark .navbar {
  background: rgba(20,20,20,0.95);
}

/* Left side */
.nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-wrap {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
}

.logo-wrap img {
  width: 26px;
  height: 26px;
}

.brand-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: #2e7d32;
}

/* Center tagline */
.tagline {
  font-size: 0.95rem;
  opacity: 0.8;
  white-space: nowrap;
}

/* Right side */
.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* =========================
   CONTAINER & CARDS
========================= */
.container {
  max-width: 1100px;
  margin: 40px auto;
  padding: 20px;
}

h1, h2 {
  text-align: center;
  margin-bottom: 20px;
}

.card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.15);
  position: relative;
}

body.dark .card {
  background: rgba(40,40,40,0.9);
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 5px;
  width: 100%;
  background: linear-gradient(90deg,#4caf50,#81c784);
  border-radius: 16px 16px 0 0;
}

/* =========================
   FORMS
========================= */
form {
  max-width: 420px;
  margin: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

input, button {
  padding: 12px 14px;
  border-radius: 10px;
  border: none;
  font-size: 1rem;
}

input {
  background: #f5f7fa;
  outline: none;
}

body.dark input {
  background: #333;
  color: #eee;
}

input:focus {
  box-shadow: 0 0 0 2px #4caf50;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 0.9rem;
  font-weight: 600;
}

/* =========================
   BUTTONS
========================= */
.btn {
  background: linear-gradient(45deg,#4caf50,#66bb6a);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,.2);
}

.btn:active {
  transform: scale(0.96);
}

/* =========================
   LOCATION GROUP
========================= */
.location-group {
  display: flex;
  gap: 10px;
}

.location-group input {
  flex: 1;
}

/* =========================
   ALERT
========================= */
.alert {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #e8f5e9;
  color: #1b5e20;
  text-align: center;
  font-weight: 600;
}

.alert.hidden {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

/* =========================
   SPINNER & LOADING
========================= */
.hidden {
  display: none !important;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid rgba(255,255,255,0.4);
  border-top: 3px solid #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.submit-btn.loading {
  pointer-events: none;
  background: #9ca3af;
}

.submit-btn.loading span {
  opacity: 0;
}

/* =========================
   NGO FOOD LIST
========================= */
.food-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 24px;
  justify-items: center;
}

.collect-btn {
  background: #22c55e;
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
}

.collect-btn:hover {
  background: #16a34a;
}

.collect-btn.loading {
  background: #9ca3af;
  pointer-events: none;
}

.card.fade-out {
  animation: fadeOut 0.4s forwards;
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateY(20px);
  }
}

/* =========================
   LOGIN PAGE
========================= */
.login-wrapper {
  min-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 20px;
}

.login-card {
  max-width: 560px;
  background: rgba(255,255,255,0.95);
  border-radius: 22px;
  padding: 26px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.25);
  text-align: center;
}

body.dark .login-card {
  background: rgba(30,30,30,0.95);
}

/* =========================
   MOBILE
========================= */
@media (max-width: 768px) {
  .navbar {
    padding: 0 12px;
  }

  .brand-name {
    font-size: 1.25rem;
  }

  .tagline {
    font-size: 0.8rem;
  }
}

/* =========================
   AUTH PAGES FINAL FIX
========================= */

.login-wrapper {
  min-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 20px;
}

.hero-logo img {
  width: 120px;
  height: auto;
  margin-bottom: 10px;
}

.login-card {
  width: 100%;
  max-width: 520px;
  background: rgba(255,255,255,0.95);
  border-radius: 22px;
  padding: 28px 26px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.25);
  text-align: center;
}

.login-card h2 {
  margin-bottom: 6px;
}

.login-card p {
  opacity: 0.8;
  margin-bottom: 18px;
}

.login-card input,
.login-card select {
  width: 100%;
}

body.dark .login-card {
  background: rgba(30,30,30,0.95);
}

/* =========================
   NGO CARD SIZE FIX
========================= */

.food-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  justify-items: center;
}

.food-list .card {
  width: 100%;
  max-width: 520px;     /* 👈 PERFECT size */
  padding: 18px 20px;
}

.map-container {
  width: 100%;
  height: 150px;
  border-radius: 12px;
  overflow: hidden;
  margin: 10px 0;
}

.map-container iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* =========================
   COUNTDOWN RING
========================= */

.countdown-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background:
    conic-gradient(
      var(--ring) calc(var(--percent) * 1%),
      #e5e7eb 0
    );
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  margin: 12px auto;
  color: #111;
}

body.dark .countdown-ring {
  background:
    conic-gradient(
      var(--ring) calc(var(--percent) * 1%),
      #1f2937 0
    );
  color: #fff;
}

/* =========================
   URGENT BADGE
========================= */
.urgent-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #dc2626;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.6px;
  animation: pulse 1.4s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* =========================
   COUNTDOWN RING ANIMATION
========================= */
.countdown-ring {
  transition: background 0.8s ease;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* =========================
   OPEN IN MAPS FIX
========================= */
.map-link,
.card a {
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
}

body.dark .map-link,
body.dark .card a {
  color: #60a5fa;
}

.map-link:hover,
.card a:hover {
  text-decoration: underline;
}

/* =========================
   CARD ACTIONS FIX
========================= */
.card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
}

/* Collect button polish */
.collect-btn {
  background: #22c55e;
  color: #fff;
  padding: 10px 20px;
  border-radius: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
}

.collect-btn:hover {
  background: #16a34a;
}

.collect-btn:active {
  transform: scale(0.96);
}

