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

:root {
  --bg-primary: #f4faf4;
  --bg-secondary: #ffffff;
  --text-primary: #2c3e50;
  --text-secondary: #444444;
  --text-muted: #555555;
  --header-bg: linear-gradient(135deg, #1b5e20 0%, #388e3c 100%);
  --primary-color: #27ae60;
  --accent-color: #388e3c;
  --accent-light: #81c784;
  --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  --border-color: #e0e0e0;
  --input-bg: #fafafa;
  --input-text: #1b5e20;
  --card-bg: #ffffff;
  --preview-bg: #f1f8e9;
  --prediction-bg: #f1f8e9;
  --error-bg: #ffebee;
  --error-text: #c62828;
  --success-bg: #e8f5e9;
  --success-text: #2e7d32;
  --transition-speed: 0.3s;
}



html, body {
  overflow-x: hidden;
  max-width: 100%;
}

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

.chat-box {
  width: 100%;
  height: 500px;
  background: var(--bg-secondary);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
  transition: background var(--transition-speed), border var(--transition-speed);
}

.messages {
  flex-grow: 1;
  overflow-y: auto;
  margin-bottom: 1rem;
  padding-right: 0.5rem;
}

.messages::-webkit-scrollbar {
  width: 6px;
}

.messages::-webkit-scrollbar-thumb {
  background: #c8e6c9;
  border-radius: 10px;
}

body {
  background: var(--bg-primary);
  min-height: 100vh;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  transition: background var(--transition-speed), color var(--transition-speed);
  padding-top: 80px; /* Offset for fixed header */
}


.user,
.bot-message {
  margin: 0.8rem 0;
  padding: 0.8rem 1.2rem;
  border-radius: 15px;
  max-width: 85%;
  line-height: 1.5;
  font-size: 0.95rem;
}

.user {
  background: #388e3c;
  color: white;
  align-self: flex-end;
  margin-left: auto;
  border-bottom-right-radius: 2px;
}

.bot-message {
  background: var(--bg-primary);
  color: var(--text-primary);
  align-self: flex-start;
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 2px;
}

.bot-icon {
  font-size: 1.2rem;
  margin-bottom: 0.3rem;
}

/* Thinking Indicator Styles */
.thinking-indicator {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0;
}

.thinking-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

.thinking-dot {
  width: 7px;
  height: 7px;
  background: var(--accent-color);
  border-radius: 50%;
  animation: thinking-bounce 1.4s infinite ease-in-out both;
}

.thinking-dot:nth-child(1) { animation-delay: -0.32s; }
.thinking-dot:nth-child(2) { animation-delay: -0.16s; }

.thinking-bar-container {
  width: 50px;
  height: 3px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
  overflow: hidden;
}

.thinking-bar {
  width: 100%;
  height: 100%;
  background: var(--accent-color);
  animation: thinking-progress 1.5s infinite ease-in-out;
}

@keyframes thinking-bounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

@keyframes thinking-progress {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(0); }
  100% { transform: translateX(100%); }
}

/* Follow-up Question Chip */
.follow-up-chip-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.6rem 0 0.2rem 0;
  padding: 0.8rem 1rem;
  background: linear-gradient(135deg, rgba(56, 142, 60, 0.07), rgba(129, 199, 132, 0.07));
  border: 1px dashed rgba(56, 142, 60, 0.35);
  border-radius: 14px;
  animation: chip-fade-in 0.4s ease;
}

@keyframes chip-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.follow-up-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-color);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.follow-up-chip {
  display: inline-block;
  background: transparent;
  border: 1.5px solid var(--accent-color);
  color: var(--text-primary);
  border-radius: 100px;
  padding: 0.5rem 1rem;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  line-height: 1.4;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.follow-up-chip:hover {
  background: var(--accent-color);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(56, 142, 60, 0.25);
}

/* Disabled input while awaiting a response */
#userInput:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}


/* Page Progress Bar */
#page-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--accent-light);
  z-index: 9999;
  transition: width 0.4s ease, opacity 0.4s ease;
  box-shadow: 0 0 10px rgba(129, 199, 132, 0.5);
  pointer-events: none;
  opacity: 0;
}

#page-progress.active {
  opacity: 1;
  width: 70%;
}

#page-progress.finish {
  width: 100%;
  opacity: 0;
}

main {
  transition: opacity 0.3s ease;
}

main.loading {
  opacity: 0.6;
  pointer-events: none;
}


input {
  width: 80%;
  padding: 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  color: var(--input-text);
  background: var(--input-bg);
  margin-top: 10px;
}

.chat-input-container {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  background: var(--bg-primary);
  padding: 0.5rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.chat-box input {
  flex-grow: 1;
  padding: 0.7rem;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.95rem;
  margin: 0;
  width: auto;
  min-width: 0;
}

button {
  padding: 0.6rem 1rem;
  border: none;
  background: var(--accent-color);
  color: white;
  border-radius: 5px;
  cursor: pointer;
}

/* Legacy footer removed in favor of main-footer */

.chat-box button {
  padding: 0.7rem 1.2rem;
  background: #388e3c;
  border-radius: 10px;
  font-weight: 600;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.chat-box button:hover {
  transform: scale(1.05);
  background: #2e7d32;
}

.btn {
  position: relative;
  margin-top: 0;
}

header {
  background: var(--header-bg);
  color: #fff;
  padding: 1rem 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 2000;
  transition: all 0.3s ease;
}

header.scrolled {
  padding: 0.8rem 2rem;
  background: rgba(27, 94, 32, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}


header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  cursor: pointer;
}

header h1 span {
  color: #81c784;
}

header nav {
  margin-right: 2rem;
}

header ul {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  list-style: none;
  font-size: 1.1rem;
}

header nav ul li a {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  padding: 0.5rem 0;
}

header nav ul li a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: #81c784;
  transition: width 0.3s ease;
}

header nav ul li a:hover {
  color: #fff;
}

header nav ul li a:hover::after {
  width: 100%;
}

/* Responsive Navbar Toggle */
.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: white;
  font-size: 1.8rem;
  cursor: pointer;
  z-index: 1001;
  transition: transform 0.3s ease;
}

.menu-toggle:hover {
  transform: scale(1.1);
}

@media (max-width: 1024px) {
  .menu-toggle {
    display: block;
  }
  
  header {
    padding: 1rem 1.5rem;
  }
  
  header nav {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: linear-gradient(135deg, #1b5e20 0%, #388e3c 100%);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    transform: translateY(-20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    z-index: 999;
    margin-right: 0;
  }
  
  header nav.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  
  header ul {
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 1.5rem 0;
  }
  
  header nav ul li {
    width: 100%;
    text-align: center;
  }
  
  header nav ul li a {
    display: block;
    padding: 1.2rem 2rem;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }
  
  header nav ul li:last-child a {
    border-bottom: none;
  }

  header nav ul li a::after {
    display: none;
  }
  
  header nav ul li a:hover {
    background: rgba(255,255,255,0.1);
    color: #81c784;
  }
}


select#available_crop_scan {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  margin-left: 0.5rem;
  outline: none;
  transition: background 0.2s;
}

select#available_crop_scan:hover {
  background: rgba(255, 255, 255, 0.2);
}

select#available_crop_scan option {
  background: #1b5e20;
  color: #fff;
}



.section1 {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2.5rem;
  padding: 3rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.subsection {
  flex: 1;
  min-width: 350px;
  max-width: 600px;
  display: flex;
  flex-direction: column;
}

.chat-box-container {
  flex: 1;
  min-width: 350px;
  max-width: 600px;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  background: var(--bg-secondary);
  border-radius: 20px;
  box-shadow: var(--card-shadow);
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 480px;
  border: 1px solid var(--border-color);
  transition: background var(--transition-speed), border var(--transition-speed);
}

.container h1 {
  font-size: 1.6rem;
  color: var(--accent-color);
  margin-bottom: 0.5rem;
}

.container h5 {
  color: var(--text-secondary);
  margin-bottom: 1.2rem;
}

form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

label {
  font-weight: 500;
  margin-bottom: 0.3rem;
}

input[type="file"] {
  padding: 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--input-bg);
  color: var(--text-primary);
}

#filename {
  display: block;
  font-size: 0.95rem;
  color: #388e3c;
  margin-top: 0.2rem;
  margin-bottom: 0.5rem;
  word-break: break-all;
}

#preview-container {
  width: 100%;
  min-height: 120px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--preview-bg);
  border-radius: 10px;
  border: 1px dashed var(--accent-light);
  margin-bottom: 0.5rem;
  overflow: hidden;
}

#preview {
  max-width: 100%;
  max-height: 180px;
  display: block;
  margin: 0 auto;
}

.crop-selection {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

select#available_crop_scan {
  background: #f1f8e9;
  border: 1px solid #a5d6a7;
  color: #1b5e20;
  padding: 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

select#available_crop_scan:focus {
  border-color: #388e3c;
}

select#available_crop_scan option {
  background: #fff;
  color: #1b5e20;
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  align-items: center;
}

.ai-button,
#reset-btn {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.ai-button {
  background: #388e3c;
  color: #fff;
}

.ai-button:hover {
  background: #2e7031;
}

#reset-btn {
  background: #e0e0e0;
  color: #333;
}

#reset-btn:hover {
  background: #bdbdbd;
}

#loading-spinner {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 1rem;
  justify-content: center;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 4px solid #c8e6c9;
  border-top: 4px solid #388e3c;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.prediction {
  width: 100%;
  margin-top: 1.5rem;
  background: var(--prediction-bg);
  border-radius: 15px;
  padding: 1.5rem;
  text-align: center;
  border: 1px solid var(--border-color);
}

.prediction h3 {
  color: var(--accent-color);
  margin-bottom: 0.5rem;
}

.prediction p {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

h2 {
  text-align: center;
}

body {
  background: #f2f8f2;
  font-family: Arial, sans-serif;
}





/* Section cards for market and input challenges */


.market-challenges,
.input-challenges {
  width: 100%;
  margin: 30px auto 30px;
  background: var(--bg-secondary);
  border-radius: 14px;
  box-shadow: var(--card-shadow);
  padding: 1.5rem 1.2rem 1.2rem 1.2rem;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s, background var(--transition-speed);
}

.section-content {
  display: flex;
  flex-direction: row;
  justify-content: space-evenly;
  align-items: center;
}

.farmer-market_p {
  width: 30%;
}

.farmer-market {
  width: 50%;
}

.farmer-market img {
  width: 90%;
  border-radius: 20px;
}

.fertilizers img {
  width: 90%;
  border-radius: 20px;
}

.fertilizers_p {
  width: 30%;
}

.fertilizers {
  width: 50%;
}

.market-challenges:hover,
.input-challenges:hover {
  box-shadow: 0 4px 24px rgba(56, 142, 60, 0.16);
}

.section-header h2 {
  color: var(--accent-color);
  font-size: 1.3rem;
  margin-bottom: 0.7rem;
  border-bottom: 1px var(--accent-color) solid;
  text-align: left;
}

.section-content p {
  color: var(--text-primary);
  font-size: 1.08rem;
  line-height: 1.6;
}

.video-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -1;
}

.video-bg {
  min-width: 100%;
  min-height: 100%;
  object-fit: cover;
}

.video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.7) 100%);
}



.intro-hero {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem;
  position: relative;
  z-index: 10;
}

.hero-content {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 3rem 4rem;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  max-width: 900px;
}

.hero-content h1 {
  font-size: 5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  color: #fff;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.hero-content h1 span {
  color: #81c784;
}

.hero-content .slogan {
  font-size: 1.8rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 2.5rem;
  font-weight: 500;
}

.cta-group {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
}

.btn-primary,
.btn-secondary {
  padding: 1rem 2.5rem;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
}

.btn-primary {
  background: #388e3c;
  color: #fff;
  box-shadow: 0 4px 15px rgba(56, 142, 60, 0.4);
}

.btn-primary:hover {
  background: #4caf50;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 2px solid #fff;
}

.btn-secondary:hover {
  background: #fff;
  color: #1b5e20;
  transform: translateY(-3px);
}

/* Animations */
.animate-up {
  animation: fadeInUp 1s ease-out forwards;
}

.animate-up-delay-1 {
  opacity: 0;
  animation: fadeInUp 1s ease-out 0.3s forwards;
}

.animate-up-delay-2 {
  opacity: 0;
  animation: fadeInUp 1s ease-out 0.6s forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .video-container {
    display: none;
  }

  .intro-hero {
    background: linear-gradient(135deg, #1b5e20 0%, #388e3c 15%, #ffffff 100%);
    padding: 1.5rem;
  }

  .hero-content {
    background: rgba(255, 255, 255, 0.9);
    padding: 2.5rem 1.5rem;
    width: 95%;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  }

  .hero-content h1 {
    font-size: 3.2rem;
    color: var(--accent-color);
  }

  .hero-content .slogan {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
  }

  .cta-group {
    flex-direction: column;
    gap: 1rem;
  }

  .btn-primary, .btn-secondary {
    width: 100%;
    padding: 0.9rem 1.5rem;
  }

  .btn-secondary {
    background: var(--bg-primary);
    color: var(--accent-color);
    border-color: var(--accent-color);
  }
}

/* Directory Page Styles */
.fertilisers-container {
  max-width: 1400px;
  margin: 3rem auto;
  padding: 2.5rem;
}

.fertilisers-header {
  text-align: center;
  margin-bottom: 3.5rem;
}

.fertilisers-header h2 {
  color: var(--accent-color);
  font-size: 2.8rem;
  font-weight: 800;
  margin-bottom: 0.8rem;
  letter-spacing: -0.02em;
}

.fertilisers-header p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto 2rem auto;
}

.firms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  padding: 1rem 0;
}
@media (max-width: 400px) {
  .firms-grid { grid-template-columns: 1fr; }
}

.firm-card {
  background: var(--bg-secondary);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border-color);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.firm-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  border-color: var(--accent-light);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.card-header h3 {
  font-size: 1.3rem;
  color: var(--accent-color);
  font-weight: 700;
  margin: 0;
}

.card-body p {
  margin: 0.8rem 0;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.95rem;
}

.card-body a {
  color: var(--accent-color);
  text-decoration: none;
}

.card-footer {
  margin-top: 1.8rem;
}

.btn-contact {
  width: 100%;
  padding: 0.8rem;
  background: var(--bg-primary);
  color: var(--accent-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-contact:hover {
  background: var(--accent-color);
  color: #fff;
}

.badge {
  padding: 0.4rem 1rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge.fertiliser {
  background: var(--preview-bg);
  color: var(--accent-color);
}

.badge.pesticide {
  background: #fff3e0;
  color: #ef6c00;
}

.badge.buyer {
  background: #e3f2fd;
  color: #1565c0;
}

.badge.farmer {
  background: var(--preview-bg);
  color: var(--accent-color);
  border: 1px solid var(--border-color);
}

.error-msg,
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem;
  background: var(--bg-secondary);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 1.1rem;
  border: 1px solid var(--border-color);
}




/* Modern Authentication Forms */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--bg-primary);
  position: relative;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

.auth-page::before {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(56, 142, 60, 0.05) 0%, transparent 70%);
  top: -100px;
  right: -100px;
  border-radius: 50%;
}

.auth-card {
  width: 100%;
  max-width: 650px;
  background: var(--bg-secondary);
  border-radius: 24px;
  box-shadow: var(--card-shadow);
  padding: 3rem;
  position: relative;
  z-index: 10;
  border: 1px solid var(--border-color);
  /* Prevent card from ever exceeding the viewport */
  box-sizing: border-box;
  overflow-x: hidden;
}

.auth-header-modern {
  text-align: center;
  margin-bottom: 2.5rem;
}

.auth-header-modern h2 {
  color: var(--accent-color);
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.auth-header-modern p {
  color: var(--text-secondary);
  font-size: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.form-group.full-width {
  grid-column: span 2;
}

.form-label {
  display: block;
  font-weight: 600;
  color: var(--accent-color);
  margin-bottom: 0.6rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-input-modern {
  width: 100% !important;
  max-width: 100% !important;
  padding: 0.9rem 1.2rem !important;
  border: 1.5px solid var(--border-color) !important;
  border-radius: 12px !important;
  font-size: 1rem !important;
  transition: all 0.3s ease !important;
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  margin-top: 0 !important;
  box-sizing: border-box !important;
}

.form-input-modern:focus {
  border-color: var(--accent-color) !important;
  background: var(--bg-secondary) !important;
  box-shadow: 0 0 0 4px rgba(56, 142, 60, 0.1) !important;
  outline: none !important;
}

/* Password Toggle Styles */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper .form-input-modern {
  padding-right: 3rem !important; /* Make room for the toggle icon */
}

.password-toggle {
  position: absolute;
  right: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1rem;
  transition: color 0.2s ease;
  z-index: 10;
}

.password-toggle:hover {
  color: var(--accent-color);
}


.auth-submit-btn {
  width: 100%;
  padding: 1rem;
  background: var(--accent-color);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 12px rgba(56, 142, 60, 0.2);
}

.auth-submit-btn:hover {
  background: #2e7d32;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(46, 125, 50, 0.3);
}

.auth-footer-modern {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.auth-footer-modern a {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 700;
}

.auth-footer-modern a:hover {
  text-decoration: underline;
}

@media (max-width: 650px) {
  .auth-card {
    padding: 2rem 1.2rem;
    border-radius: 16px;
    margin: 0.5rem;
    /* Ensure card never causes viewport overflow */
    width: calc(100vw - 1rem);
    max-width: calc(100vw - 1rem);
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .form-group.full-width {
    grid-column: span 1;
  }

  .auth-page {
    padding: 0.5rem;
    align-items: flex-start;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
  }
}

@media (max-width: 400px) {
  .auth-card {
    padding: 1.5rem 1rem;
    margin: 0.25rem;
    width: calc(100vw - 0.5rem);
    max-width: calc(100vw - 0.5rem);
    border-radius: 12px;
  }

  .auth-page {
    padding: 0.25rem;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .auth-header-modern h2 {
    font-size: 1.6rem;
  }

  /* Collapse the 3-col sign-up grid in signin footer */
  .signup-type-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Base Responsive Fixes for Layouts */
@media (max-width: 768px) {
  .section1 {
    padding: 1.5rem 1rem;
    gap: 1.5rem;
  }
  
  .subsection, 
  .chat-box-container {
    min-width: 100%;
    max-width: 100%;
  }
  .container {
    padding: 1.5rem;
    min-height: auto;
  }

  /* Market Challenges and Input Challenges */
  .market-challenges,
  .input-challenges {
    margin: 1.5rem auto;
    padding: 1.5rem 1rem;
  }

  .section-content {
    flex-direction: column;
    text-align: center;
    gap: 1.5rem;
  }

  .farmer-market_p, 
  .fertilizers_p, 
  .farmer-market, 
  .fertilizers {
    width: 100%;
  }

  /* Make sure images stay within their containers */
  .farmer-market img,
  .fertilizers img {
    width: 100%;
    height: auto;
  }

  /* Directory Pages (Farmers, Market Buyers, Fertilisers) */
  .fertilisers-container {
    padding: 1.5rem 1rem;
    margin: 1.5rem auto;
  }

  .fertilisers-header h2 {
    font-size: 2rem;
  }

  .firms-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  /* Footer responsiveness */
  footer {
    padding: 1.5rem 1rem !important;
  }
  
  footer nav ul {
    flex-direction: column;
    gap: 1rem !important;
  }

  /* firm-card responsive overriding */
  .table-responsive {
    width: 100%;
    overflow-x: hidden;
  }

  .firm-card {
    min-width: 0;
    padding: 1.5rem;
  }

  .card-body p {
    flex-wrap: wrap;
    word-break: break-word; /* allows long emails/names to break instead of scrolling */
  }

  .card-header h3 {
    word-break: break-word;
  }

  /* Global font size responsive adjustments */
  html {
    font-size: 14px;
  }
}

@media (min-width: 769px) {
  html {
    font-size: 16px;
  }
}
.contact a{
  padding: 10px;
  background-color: var(--accent-color);
  color: white;
  border-radius: 20px;
  text-decoration: none;
}

/* Base Template Footer Styling */
.main-footer {
    background: var(--header-bg);
    color: white;
    padding: 4rem 2rem 2rem;
    margin-top: 4rem;
    transition: background var(--transition-speed);
}

.footer-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1.5fr;
    gap: 3rem;
}

.footer-column h3 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.footer-column h3 span {
    color: var(--accent-light);
}

.footer-column h4 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
    color: var(--accent-light);
}

.footer-column p {
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 1rem;
}

.footer-column ul {
    list-style: none;
    padding: 0;
}

.footer-column ul li {
    margin-bottom: 0.8rem;
}

.footer-column ul li a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-column ul li a:hover {
    color: white;
    padding-left: 5px;
}

.footer-column.contact p i {
    margin-right: 10px;
    color: var(--accent-light);
}

.social-icons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.social-icons a {
    color: white;
    font-size: 1.2rem;
    background: rgba(255, 255, 255, 0.1);
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.social-icons a:hover {
    background: var(--accent-light);
    transform: translateY(-3px);
}

.footer-bottom {
    max-width: 1200px;
    margin: 3rem auto 0;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .social-icons {
        justify-content: center;
    }
}

/* Floating Chat Widget */
.chat-widget-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.chat-toggle-btn {
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 0.8rem 1.5rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(56, 142, 60, 0.3);
  transition: all 0.3s ease;
}

.chat-toggle-btn:hover {
  transform: translateY(-3px);
  background: #2e7d32;
  box-shadow: 0 12px 32px rgba(56, 142, 60, 0.4);
}

.chat-toggle-btn i {
  font-size: 1.4rem;
}

.chat-box-container {
  position: absolute;
  bottom: 4.5rem;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 2rem);
  background: var(--bg-secondary);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-origin: bottom right;
}

.chat-box-container.hidden {
  opacity: 0;
  transform: scale(0.8) translateY(20px);
  pointer-events: none;
}

.chat-header {
  background: var(--header-bg);
  color: white;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-weight: 600;
}

.chat-header i {
  font-size: 1.2rem;
}

.chat-close-btn {
  margin-left: auto;
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.2rem;
  opacity: 0.8;
  transition: opacity 0.2s;
  padding: 0;
}

.chat-close-btn:hover {
  opacity: 1;
}

.chat-box {
  height: 450px;
  padding: 1rem;
}

@media (max-width: 480px) {
  .chat-widget-container {
    bottom: 1rem;
    right: 1rem;
  }
  .chat-box-container {
    width: calc(100vw - 2rem);
    height: 70vh;
    bottom: 4rem;
  }
}

/* Wallet & Monetization UI */
.wallet-mini {
  margin-left: auto;
  margin-right: 1rem;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.15);
  padding: 0.3rem 0.8rem;
  border-radius: 100px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.topup-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.topup-card {
  background: var(--bg-secondary);
  width: 100%;
  max-width: 400px;
  border-radius: 32px;
  padding: 2.5rem;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
  text-align: center;
  border: 1px solid var(--border-color);
  transform: translateY(20px);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.topup-overlay.active .topup-card {
  transform: translateY(0);
}

.topup-card h3 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: var(--text-headline);
}

.topup-card p {
  color: var(--text-body);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.topup-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.topup-input-group {
  text-align: left;
}

.topup-input-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-body);
}

.topup-input-group input {
  width: 100%;
  padding: 1rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  color: var(--text-headline);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s;
}

.topup-input-group input:focus {
  border-color: var(--accent-color);
}

.btn-topup {
  background: #25D366; /* M-Pesa Greenish */
  color: white;
  border: none;
  padding: 1.2rem;
  border-radius: 16px;
  font-weight: 800;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  transition: all 0.3s ease;
}

.btn-topup:hover {
  background: #128C7E;
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(37, 211, 102, 0.3);
}

.btn-topup:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.topup-close {
  background: transparent;
  border: none;
  color: var(--text-body);
  font-weight: 600;
  margin-top: 1.5rem;
  cursor: pointer;
}

.error-msg-card {
  background: rgba(216, 0, 12, 0.1);
  border: 1px solid #d8000c;
  color: #d8000c;
  padding: 1.5rem;
  border-radius: 16px;
  margin-bottom: 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

.error-msg-card i {
  font-size: 2rem;
}

.error-msg-card p {
  font-weight: 600;
  margin: 0;
}



