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

/* CSS Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #15803d;
  --secondary: #ca8a04;
  --accent: #16a34a;
  --background: #f0fdf4;
  --white: #ffffff;
  --text: #333333;
  --light-gray: #f3f4f6;
  --border: #e5e7eb;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--background);
  color: var(--text);
  line-height: 1.6;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Header and Navigation */
header {
  background-color: var(--white);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  font-size: 1.8rem;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2rem;
  align-items: center;
}

.nav-links .btn{
  color: var(--white);
  padding: 10px 15px;
}

.nav-links .btn:hover{
  color: var(--white);
}

.nav-links a {
  color: var(--text);
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--primary);
}

/* Mobile Navigation */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--text);
}

/* Main Content */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.hero {
  text-align: center;
  padding: 4rem 0rem;
}

.hero h1 {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.1rem;
  max-width: 800px;
  margin: 0 auto 1rem;
  color: var(--text);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--white);
}

.btn-primary:hover {
  background-color: var(--accent);
}

.btn-secondary {
  background-color: var(--secondary);
  color: var(--white);
}

.btn-secondary:hover {
  filter: brightness(1.1);
}

.btn-outline {
  border: 1px solid var(--primary);
  color: var(--primary);
  background-color: transparent;
}

.btn-outline:hover {
  background-color: var(--primary);
  color: var(--white);
}

.btn-outline-secondary{
  border: 1px solid var(--secondary);
  color: var(--secondary);
  background-color: transparent;
}

.btn-outline-secondary:hover {
  background-color: var(--secondary);
  color: var(--white);
}

.cta-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
}

/* Features Section */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin: 4rem 0;
}

.feature-card {
  background-color: var(--white);
  padding: 2rem;
  border-radius: 0.5rem;
  text-align: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.feature-card h3 {
  color: var(--primary);
  margin-bottom: 0.5rem;
}

/* Forms */
.form-container {
  max-width: 500px;
  margin: 2rem auto;
  padding: 2rem;
  background-color: var(--white);
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.form-title {
  text-align: center;
  margin-bottom: 2rem;
  color: var(--primary);
}

.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

input, textarea, select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  font-family: inherit;
  font-size: 1rem;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.1);
}

/* Diagnosis Page */
.diagnosis-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 768px) {
  .diagnosis-container {
    grid-template-columns: 1fr 1fr;
  }
}

.diagnosis-form {
  background-color: var(--white);
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.image-preview {
  width: 100%;
  height: 200px;
  border: 2px dashed var(--border);
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.image-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.image-buttons {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* Diagnosis Results */
.results-container {
  background-color: var(--white);
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.result-section {
  margin-bottom: 1.5rem;
}

.result-section h3 {
  color: var(--primary);
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

/* History Page */
h1.history{
  font-size: clamp(1.5rem, 3.2975vw + -.0609rem, 2rem);
}

.history-container {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap:0 1.5rem;
}

.history-sidebar {
  background-color: var(--white);
  padding: 1rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  height: fit-content;
}

.history-item {
  padding: 1rem;
  border-radius: 0.375rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.history-item:hover {
  background-color: var(--light-gray);
}

.history-item.active {
  background-color: var(--primary);
  color: var(--white);
}

.history-details {
  background-color: var(--white);
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  height: fit-content !important;
}

/* Mobile History Page */
@media (max-width: 768px) {
  .history-container {
    display: block;
  }
  
  .history-sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 80%;
    max-width: 300px;
    z-index: 1000;
    border-radius: 0;
    padding-top: 3.5rem;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .history-sidebar.active {
    transform: translateX(0);
    display: block;
  }
  
  .history-toggle-btn {
    display: inline-block;
    margin-bottom: 1rem;
    background-color: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
  }
  
  .history-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
  }
  
  .history-sidebar-overlay.active {
    display: block;
  }
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem;
  margin-top: 4rem;
  color: var(--text);
  font-size: 0.875rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  nav {
    padding: 0.75rem 1rem;
    position: relative;
  }
  
  .mobile-menu-btn {
    display: block;
  }
  
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--white);
    flex-direction: column;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    z-index: 100;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  }
  
  .nav-links.active {
    max-height: 300px;
  }
  
  .nav-links li {
    width: 100%;
  }
  
  .nav-links a {
    display: block;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
  }

  .nav-links .btn{
    margin: 8px 0;
    width: 95%;
  }
  
  .cta-buttons {
    flex-direction: column;
  }
  
  .hero h1 {
    font-size: 2rem;
  }
  
  .features {
    grid-template-columns: 1fr;
  }
  
  .form-container {
    padding: 1.5rem;
    margin: 1rem;
  }
  
  .image-buttons {
    flex-direction: column;
  }
}

/* For extra small devices */
@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.75rem;
  }
  
  .hero p {
    font-size: 1rem;
  }
  
  .feature-card {
    padding: 1.5rem;
  }
  
  main {
    padding: 1rem;
  }
}

/* Animation for menu transitions */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

/* Loader */
.loader-con{
  width: 100vw;
  height: 100vh;
  top: 0;
  left: 0;
  z-index: 999;
  position: fixed;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
}

.loader {
  width: 45px;
  aspect-ratio: 1;
  --c:no-repeat linear-gradient(var(--accent) 0 0);
  background: var(--c), var(--c), var(--c);
  animation: 
    l16-1 1s infinite,
    l16-2 1s infinite;
}

@keyframes l16-1 {
 0%,100% {background-size:20% 100%}
 33%,66% {background-size:20% 40%}
}

@keyframes l16-2 {
 0%,33%   {background-position: 0 0   ,50% 100%,100% 0}
 66%,100% {background-position: 0 100%,50% 0   ,100% 100%}
}

/* Floating Buttons */
.agroscan-buttons {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%) translateX(100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  transition: transform 0.6s ease-in-out, opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
}

.agroscan-buttons.slide-in {
  transform: translateY(-50%) translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.agroscan-buttons.slide-out {
  transform: translateY(-50%) translateX(100%);
  opacity: 0;
  pointer-events: none;
}

.float-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  text-decoration: none;
  font-weight: bold;
  font-family: Arial, sans-serif;
  color: white;
  border-radius: 8px 0 0 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  transition: background-color 0.3s;
}

.whatsapp-btn {
  background-color: #15803d;
}

.whatsapp-btn:hover {
  background-color: #0e5e2a;
}

.sms-btn {
  background-color: dodgerblue;
}

.sms-btn:hover {
  background-color: #1c78d6;
}

.float-btn i {
  font-size: 18px;
}

.close-btn {
  align-self: flex-end;
  background: #444;
  color: white;
  font-size: 18px;
  border: none;
  padding: 4px 8px;
  border-radius: 4px 0 0 4px;
  cursor: pointer;
  margin-right: 4px;
  transition: background 0.3s;
}

.close-btn:hover {
  background: #222;
}

@media (max-width: 768px) {
  .float-btn {
    font-size: 14px;
    padding: 10px 12px;
  }
}