/* --- Individual Harvest Card --- */
.harvest-card {
  position: relative;
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.harvest-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.harvest-accent {
  position: relative;
  height: 6px;
  width: 100%;
}
.harvest-accent::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    var(--harvest-accent-color, #10b981),
    transparent 80%
  );
  opacity: 0.4;
}
.harvest-content {
  padding: 20px 22px;
}

/* Top: name + dots indicator */
.harvest-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.harvest-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.harvest-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px var(--harvest-accent-color, #10b981);
}
.harvest-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.harvest-quick-stats {
  display: flex;
  gap: 16px;
}
.harvest-stat {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 3px 10px;
  background: var(--surface-inset);
  border-radius: 20px;
}
.harvest-stat i {
  font-size: 0.7rem;
  color: var(--text-tertiary);
}

/* Harvest progress indicator */
.harvest-progress {
  margin-bottom: 14px;
}
.harvest-progress-bar {
  height: 5px;
  background: var(--surface-inset);
  border-radius: 10px;
  overflow: hidden;
}
.harvest-progress-fill {
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(
    90deg,
    var(--color-primary),
    var(--harvest-accent-color, #10b981)
  );
  transition: width 0.6s ease;
}
.harvest-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Recolection action area */
.harvest-action {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: var(--surface-inset);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.harvest-qty-group {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--input-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--input-border);
  overflow: hidden;
  flex-shrink: 0;
}
.harvest-qty-btn {
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 1rem;
}
.harvest-qty-btn:hover {
  background: var(--surface-hover);
  color: var(--color-primary);
}
.harvest-qty-input {
  width: 48px;
  text-align: center;
  border: none;
  border-left: 1px solid var(--input-border);
  border-right: 1px solid var(--input-border);
  background: transparent;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--input-text);
  padding: 6px 0;
  font-family: var(--font-family);
}
.harvest-qty-input:focus {
  outline: none;
  background: var(--surface-hover);
}

/* Main recolect button - with pulse animation */
.harvest-btn {
  flex: 1;
  min-width: 120px;
  background: linear-gradient(
    135deg,
    var(--color-primary),
    var(--color-primary-dark)
  );
  color: white;
  border: none;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.25);
  white-space: nowrap;
  position: relative;
}
.harvest-btn::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--color-primary);
  opacity: 0;
  animation: harvest-pulse 2s ease-out infinite;
}
@keyframes harvest-pulse {
  0% {
    opacity: 0.5;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.08);
  }
}
.harvest-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.4);
}
.harvest-btn:active {
  transform: translateY(0) scale(0.98);
}

/* Footer */
.harvest-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.harvest-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-inset);
  padding: 3px 10px;
  border-radius: 20px;
}
.harvest-actions-row {
  display: flex;
  gap: 4px;
}
.harvest-action-link {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s ease;
  text-decoration: none;
}
.harvest-action-link:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

/* Success feedback overlay */
.harvest-feedback {
  position: absolute;
  inset: 0;
  background: rgba(16, 185, 129, 0.94);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
  opacity: 0;
  transform: scale(0.85);
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: var(--radius-xl);
  z-index: 5;
}
.harvest-feedback i {
  font-size: 2.8rem;
}
.harvest-feedback.show {
  opacity: 1;
  transform: scale(1);
}

/* --- Finished Crops (compact list) --- */
.finished-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.finished-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-inset);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}
.finished-card:hover {
  background: var(--surface-hover);
}
.finished-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.finished-name {
  font-weight: 500;
  color: var(--text-secondary);
  flex: 1;
}
.finished-stat {
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
  font-weight: 500;
}
.finished-benefit {
  color: var(--text-secondary);
  font-weight: 600;
}

/* --- Dashboard Empty State --- */
.dash-empty {
  text-align: center;
  padding: var(--space-12) var(--space-4);
}
.dash-empty-icon {
  font-size: 4rem;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}
.dash-empty h3 {
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}
.dash-empty p {
  color: var(--text-tertiary);
  max-width: 400px;
  margin: 0 auto var(--space-6);
  line-height: 1.7;
}

/* --- Responsive Dashboard --- */
@media (max-width: 768px) {
  .dash-stats {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
  .dash-stat-item {
    padding: var(--space-4);
  }
  .harvest-grid {
    grid-template-columns: 1fr;
  }
  .harvest-action {
    flex-direction: column;
    align-items: stretch;
  }
  .harvest-qty-group {
    justify-content: center;
  }
  .harvest-btn {
    width: 100%;
  }
  .harvest-top {
    flex-direction: column;
  }
  .dash-greeting h1 {
    font-size: var(--font-size-2xl);
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .dash-stats {
    grid-template-columns: repeat(3, 1fr);
  }
  .harvest-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.huerto-notification {
  top: 20px;
  right: 20px;
  z-index: 9999;
  max-width: min(360px, calc(100vw - 32px));
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
}

.huerto-notification .btn-close {
  margin-left: auto;
}

@media (pointer: coarse) {
  button,
  .btn,
  .btn-icon,
  .theme-btn,
  .user-btn,
  .hamburger,
  .mobile-nav-item,
  .dropdown-item-modern {
    min-height: 44px;
  }
  .btn-icon,
  .theme-btn,
  .user-btn {
    min-width: 44px;
  }
}

@media (max-width: 575px) {
  .crop-card .crop-metrics,
  .crop-card-wrapper .d-flex.gap-3 {
    flex-wrap: wrap;
  }
  .huerto-notification {
    left: 16px;
    right: 16px;
    top: 12px;
  }
}

@media (max-width: 767px) {
  #cropsTable thead {
    display: none;
  }
  #cropsTable,
  #cropsTable tbody {
    display: block;
    width: 100%;
  }
  #cropsTable tbody tr:not(.year-separator) {
    display: block;
    margin: 12px;
    padding: 8px 12px;
    border: 1px solid var(--border-default);
    border-radius: 12px;
    background: var(--card-bg);
  }
  #cropsTable tbody tr:not(.year-separator) td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-default);
    text-align: right;
  }
  #cropsTable tbody tr:not(.year-separator) td:last-child {
    border-bottom: 0;
  }
  #cropsTable tbody tr:not(.year-separator) td::before {
    content: attr(data-label);
    color: var(--text-tertiary);
    font-size: 0.78rem;
    font-weight: 600;
    text-align: left;
  }
  #cropsTable .year-separator {
    display: table;
    width: 100%;
  }
}

.crop-card-wrapper {
  transition:
    transform 0.25s ease,
    opacity 0.25s ease;
}
.crop-card-wrapper .card-modern {
  position: relative;
  background: #fff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
[data-theme="dark"] .crop-card-wrapper .card-modern {
  background: #14141c;
}
.dashboard-harvest-feedback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #059669;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: inherit;
  z-index: 5;
}
.dashboard-harvest-feedback[hidden] {
  display: none;
}
.dashboard-harvest-feedback i {
  font-size: 2rem;
}
.crop-card-wrapper.reorder-mode {
  cursor: grab;
}
.crop-card-wrapper.reorder-mode:active {
  cursor: grabbing;
}
.crop-card-wrapper.reorder-mode:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.crop-card-wrapper.reorder-mode .card-modern {
  border: 2px dashed var(--border-strong);
}
.crop-card-wrapper.dragging {
  opacity: 0.4;
  transform: scale(0.95);
}
.crop-card-wrapper.drag-over {
  border-radius: 14px;
}
.crop-card-wrapper.drag-over .card-modern {
  border: 2px solid var(--color-primary) !important;
  box-shadow: var(--shadow-glow);
}
@keyframes reorderFlash {
  0% {
    background: rgba(16, 185, 129, 0.15);
  }
  100% {
    background: transparent;
  }
}
