/* ==========================================================================
   Plant ID Widget Styles
   Uses existing site CSS variables from index.css
   ========================================================================== */

/* Widget Container */
.plant-id-widget-container {
  margin-top: 24px;
  padding: 20px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 10px;
  text-align: center;
}

.plant-id-widget-container h3 {
  font-size: 1.4em;
  color: var(--primary);
  margin: 0 0 8px 0;
}

.plant-id-widget-container > p {
  color: var(--white);
  opacity: 0.9;
  margin: 0 0 16px 0;
  font-size: 1em;
}

/* Upload Area */
.pid-upload-area {
  border: 2px dashed var(--primary);
  border-radius: 10px;
  padding: 32px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: rgba(0, 184, 61, 0.05);
}

.pid-upload-area:hover {
  background: rgba(0, 184, 61, 0.15);
  border-color: var(--primary-light);
}

.pid-upload-area.dragover {
  background: rgba(0, 184, 61, 0.2);
  border-style: solid;
}

.pid-upload-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  fill: var(--primary);
}

.pid-upload-text {
  font-size: 1.1em;
  font-weight: 600;
  color: var(--primary-light);
  margin-bottom: 4px;
}

.pid-upload-hint {
  font-size: 0.85em;
  color: var(--grey);
}

.pid-file-input {
  display: none;
}

/* Preview */
.pid-preview {
  display: none;
  position: relative;
  margin-bottom: 16px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--grey-dark);
}

.pid-preview img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  display: block;
}

.pid-preview-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--white);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  line-height: 32px;
  text-align: center;
  transition: background 0.2s;
}

.pid-preview-remove:hover {
  background: var(--red);
}

/* Turnstile Container */
.pid-turnstile {
  display: flex;
  justify-content: center;
  margin: 16px 0;
  min-height: 65px;
}

/* Submit Button */
.pid-submit {
  width: 100%;
  padding: 14px 20px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 5px;
  font-size: 1.1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Mulish', sans-serif;
}

.pid-submit:hover:not(:disabled) {
  background: var(--primary-light);
  color: var(--black);
}

.pid-submit:disabled {
  background: var(--grey);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Loading State */
.pid-loading {
  display: none;
  text-align: center;
  padding: 32px 16px;
}

.pid-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--grey-dark);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: pid-spin 1s linear infinite;
  margin: 0 auto 16px;
}

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

.pid-loading p {
  color: var(--white);
  font-size: 1em;
  margin: 0;
}

/* Results Section */
.pid-results {
  display: none;
  margin-top: 16px;
  text-align: left;
}

.pid-identification {
  background: rgba(0, 184, 61, 0.1);
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  border-left: 4px solid var(--primary);
}

.pid-identification h4 {
  font-size: 1.2em;
  color: var(--primary-light);
  margin: 0 0 6px 0;
}

.pid-identification p {
  margin: 0 0 6px 0;
  color: var(--white);
}

.pid-confidence {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75em;
  font-weight: 600;
  text-transform: uppercase;
}

.pid-confidence.high {
  background: var(--green);
  color: var(--black);
}

.pid-confidence.medium {
  background: var(--yellow);
  color: var(--black);
}

.pid-confidence.low {
  background: var(--orange);
  color: var(--black);
}

.pid-features {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.9em;
  color: var(--grey-light);
  font-style: italic;
}

/* Matches Section */
.pid-matches h4 {
  font-size: 1.1em;
  color: var(--white);
  margin: 0 0 12px 0;
}

.pid-match-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.pid-match-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  margin-bottom: 8px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}

.pid-match-item:hover {
  background: rgba(0, 184, 61, 0.15);
  border-color: var(--primary);
}

.pid-match-info {
  flex: 1;
  min-width: 0;
}

.pid-match-name {
  font-weight: 600;
  color: var(--white);
  display: block;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pid-match-category {
  font-size: 0.8em;
  color: var(--grey);
}

.pid-match-reason {
  display: block;
  font-size: 0.75em;
  color: var(--grey-light);
  margin-top: 4px;
  font-style: italic;
}

.pid-features-summary {
  background: rgba(0, 184, 61, 0.1);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  border-left: 4px solid var(--primary);
}

.pid-features-summary .pid-features {
  margin: 0;
  padding: 0;
  border: none;
}

.pid-match-score {
  font-size: 0.75em;
  color: var(--black);
  background: var(--primary-light);
  padding: 4px 10px;
  border-radius: 10px;
  white-space: nowrap;
  margin-left: 10px;
  font-weight: 600;
}

/* No Matches */
.pid-no-matches {
  text-align: center;
  padding: 20px 16px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.pid-no-matches p {
  color: var(--grey-light);
  margin: 0 0 12px 0;
}

/* Error State */
.pid-error {
  display: none;
  background: rgba(229, 52, 36, 0.15);
  border: 1px solid var(--red);
  color: var(--red-light);
  padding: 16px;
  border-radius: 8px;
  text-align: center;
  margin-top: 16px;
}

.pid-error p {
  margin: 0 0 12px 0;
}

/* Action Buttons */
.pid-try-again {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 20px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 5px;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s ease;
  font-family: 'Mulish', sans-serif;
}

.pid-try-again:hover {
  background: var(--primary-light);
  color: var(--black);
}

.pid-browse-link {
  display: inline-block;
  padding: 10px 20px;
  background: var(--grey-dark);
  color: var(--white);
  border-radius: 5px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
}

.pid-browse-link:hover {
  background: var(--grey);
}

/* Responsive */
@media (max-width: 768px) {
  .plant-id-widget-container {
    padding: 16px;
    margin-top: 20px;
  }

  .plant-id-widget-container h3 {
    font-size: 1.2em;
  }

  .pid-upload-area {
    padding: 24px 16px;
  }

  .pid-upload-icon {
    width: 40px;
    height: 40px;
  }

  .pid-match-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .pid-match-score {
    margin-left: 0;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .pid-spinner {
    animation: none;
  }
}

.pid-upload-area:focus-visible,
.pid-submit:focus-visible,
.pid-try-again:focus-visible,
.pid-match-item:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}
