/* Import theme system */
@import url('theme.css');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-secondary, #f8fff8);
  color: var(--text-primary, #333);
  line-height: 1.8;
  min-height: 100vh;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 15px;
}

/* Header styles */
header {
  text-align: center;
  margin-bottom: 30px;
  padding: 30px 20px;
  background: linear-gradient(135deg, #4caf50, #66bb6a);
  color: white;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(45, 90, 39, 0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 20px;
}

.header-content h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin: 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header-icon {
  font-size: 28px;
  color: white;
}


header > h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 15px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

header > p {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  opacity: 0.9;
  margin-bottom: 20px;
}

/* Back button styling */
.back-button {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 500;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  margin-top: 10px;
}

.back-button:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.back-button:active {
  transform: scale(0.95);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .header-content {
    flex-direction: row;
    gap: 10px;
    padding: 0 10px;
  }

  .header-icon {
    font-size: 24px;
  }

  .back-button {
    font-size: 12px;
    padding: 8px 15px;
    min-width: fit-content;
    white-space: nowrap;
  }
}

@media (max-width: 480px) {
  .header-content {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
  }

  .header-content h1 {
    order: 1;
    font-size: 18px;
  }

  .header-icon {
    order: 0;
    font-size: 20px;
  }

  .back-button {
    order: 2;
    font-size: 11px;
    padding: 6px 12px;
    margin-top: 5px;
  }
}

.main-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
  margin-bottom: 40px;
}

.analysis-section {
  background: var(--bg-primary, white);
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 8px 25px var(--shadow-light, rgba(0, 0, 0, 0.1));
  border: 2px solid #e8f5e8;
}

.analysis-section h2 {
  color: #2d5a27;
  margin-bottom: 25px;
  font-size: clamp(1.5rem, 3vw, 1.8rem);
  text-align: center;
}

.upload-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  align-items: start;
}

.upload-zone {
  min-height: 400px;
}

.upload-area {
  border: 3px dashed #4a7c59;
  border-radius: 15px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #f8fff8;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.upload-area:hover {
  border-color: #2d5a27;
  background: #f0fff0;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(45, 90, 39, 0.2);
}

.upload-area.dragover {
  border-color: #2d5a27;
  background: #e8f5e8;
  transform: scale(1.02);
  box-shadow: 0 8px 25px rgba(45, 90, 39, 0.3);
}

.upload-icon {
  font-size: 4rem;
  color: #4a7c59;
  margin-bottom: 20px;
  transition: transform 0.3s ease;
}

.upload-area:hover .upload-icon {
  transform: scale(1.1);
}

.upload-text {
  color: #2d5a27;
  font-size: 1.1rem;
  font-weight: 500;
  text-align: center;
}

.file-input {
  display: none;
}

.btn {
  background: linear-gradient(135deg, #4a7c59 0%, #2d5a27 100%);
  color: white;
  padding: 15px 35px;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(45, 90, 39, 0.3);
  margin-top: 20px;
  width: 100%;
  max-width: 300px;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(45, 90, 39, 0.4);
}

.btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.results-zone {
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

.preview-container {
  text-align: center;
  margin-bottom: 25px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fff8;
  border-radius: 10px;
  border: 2px solid #e8f5e8;
}

.preview-image {
  max-width: 100%;
  max-height: 250px;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border: 3px solid #e8f5e8;
}

.loading {
  display: none;
  text-align: center;
  color: #4a7c59;
  margin: 20px 0;
}

.spinner {
  border: 4px solid #e8f5e8;
  border-top: 4px solid #4a7c59;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

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

.result-card {
  background: linear-gradient(135deg, #f8fff8 0%, #e8f5e8 100%);
  border-radius: 12px;
  padding: 20px;
  margin: 15px 0;
  border-left: 5px solid #4a7c59;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.disease-name {
  font-size: 1.4rem;
  font-weight: bold;
  color: #2d5a27;
  margin-bottom: 12px;
}

.confidence {
  font-size: 1.1rem;
  color: #4a7c59;
  margin-bottom: 15px;
  font-weight: 600;
}

.description {
  color: #555;
  margin-bottom: 15px;
  line-height: 1.6;
}

.treatment {
  background: white;
  padding: 18px;
  border-radius: 8px;
  border: 1px solid #e8f5e8;
  margin-top: 15px;
}

.treatment h4 {
  color: #2d5a27;
  margin-bottom: 12px;
  font-size: 1.1rem;
}

.severity {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 15px;
}

.severity.low {
  background: #d4edda;
  color: #155724;
}
.severity.medium {
  background: #fff3cd;
  color: #856404;
}
.severity.high {
  background: #f8d7da;
  color: #721c24;
}

.features-section {
  background: var(--bg-primary, white);
  padding: 40px;
  border-radius: 15px;
  box-shadow: 0 8px 25px var(--shadow-light, rgba(0, 0, 0, 0.1));
  border: 2px solid #e8f5e8;
  margin-bottom: 40px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
  margin-top: 30px;
}

.feature-card {
  text-align: center;
  padding: 30px 20px;
  background: linear-gradient(135deg, #f8fff8 0%, #ffffff 100%);
  border-radius: 12px;
  border: 2px solid #e8f5e8;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(45, 90, 39, 0.2);
  border-color: #4a7c59;
}

.feature-icon {
  font-size: 3rem;
  color: #4a7c59;
  margin-bottom: 15px;
}

.feature-card h3 {
  color: #2d5a27;
  margin-bottom: 15px;
  font-size: 1.3rem;
}

.no-results {
  text-align: center;
  color: #666;
  font-style: italic;
  padding: 40px;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 30px;
  border-radius: 15px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  position: absolute;
  right: 20px;
  top: 20px;
}

.close:hover {
  color: #2d5a27;
}

.modal h2 {
  color: #2d5a27;
  margin-bottom: 20px;
  font-size: 1.8rem;
}

.modal-section {
  margin-bottom: 25px;
}

.modal-section h3 {
  color: #4a7c59;
  margin-bottom: 10px;
  font-size: 1.2rem;
}

.plant-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.plant-item {
  background: #f8fff8;
  padding: 15px;
  border-radius: 8px;
  border-left: 4px solid #4a7c59;
}

.plant-item h4 {
  color: #2d5a27;
  margin-bottom: 5px;
}

.plant-item p {
  color: #666;
  font-size: 0.9rem;
}

.status-indicator {
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 20px;
  text-align: center;
  font-weight: 500;
}

.status-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.status-warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .upload-container {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .features-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 10px;
  }

  .analysis-section,
  .features-section {
    padding: 20px;
  }

  .upload-area {
    min-height: 250px;
    padding: 30px 15px;
  }

  .upload-icon {
    font-size: 3rem;
  }

  .modal-content {
    margin: 10% auto;
    padding: 20px;
    width: 95%;
  }

  .plant-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 20px 15px;
  }

  .upload-area {
    min-height: 200px;
    padding: 20px 10px;
  }

  .upload-text {
    font-size: 1rem;
  }

  .btn {
    padding: 12px 25px;
    font-size: 1rem;
  }
}

/* Animation for drag and drop */
.upload-area.drag-animation {
  animation: dragPulse 0.6s ease-in-out;
}

@keyframes dragPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}
/* Floating Chatbot Button */
#chatbotBtn {
  position: fixed;
  bottom: 100px; /* 20px above scroll-to-top button */
  right: 30px;
  width: 60px;
  height: 60px;
  background-color: #4caf50; /* greenish theme */
  color: #fff;
  font-size: 28px;
  text-align: center;
  line-height: 60px;
  border-radius: 50%;
  box-shadow: 0 6px 18px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  z-index: 1100; /* above scroll-to-top button */
}

#chatbotBtn:hover {
  transform: translateY(-4px) scale(1.1);
  box-shadow: 0 8px 22px rgba(0,0,0,0.35);
  background-color: #43a047; /* slightly darker green on hover */
}

/* Mobile responsiveness: hide on very small screens */
@media (max-width: 400px) {
  #chatbotBtn {
    display: none;
  }
}