/*
 * Grower's Toolbar — Final Responsive & Theme Adaptive
 * Fixes: Overlap on small screens, flex overflow, and grid compression
 */

/* Container */
.grow-toolbar {
  font-family: inherit;
  color: inherit;
  max-width: 100%;
  overflow-x: hidden;
}

.grow-toolbar .wrap {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 4px 24px rgba(2,6,23,.06);
  box-sizing: border-box;
}

/* Grid Layout */
.grow-toolbar .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  align-items: start;
  width: 100%;
}

/* Card */
.grow-toolbar .card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}

/* Prevent overflow inside cards */
.grow-toolbar .card * {
  max-width: 100%;
  box-sizing: border-box;
  flex-shrink: 1;
}

/* Headings */
.grow-toolbar h3 {
  margin: 0;
  font-size: 15px;
  color: #111827;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  line-height: 1.3;
}

/* Text and small labels */
.grow-toolbar .muted {
  color: #6b7280;
  font-size: 12px;
}

/* Rows & Columns inside cards */
.grow-toolbar .row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  width: 100%;
}

.grow-toolbar .col {
  flex: 1 1 100%;
  min-width: 0;
}

/* Inputs, buttons, selects */
.grow-toolbar input,
.grow-toolbar select,
.grow-toolbar textarea,
.grow-toolbar button {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  background: #fff;
  color: inherit;
  font-family: inherit;
  box-sizing: border-box;
}

.grow-toolbar textarea {
  min-height: 100px;
  resize: vertical;
}

/* Buttons - theme adaptive */
.grow-toolbar button {
  cursor: pointer;
  border: 1px solid currentColor;
  background: var(--wp--preset--color--primary, #2e7d32);
  color: #fff;
  font-weight: 600;
  transition: all 0.2s ease;
}
.grow-toolbar button:hover {
  filter: brightness(0.95);
}
.grow-toolbar button.ghost {
  background: transparent;
  color: var(--wp--preset--color--primary, #2e7d32);
}

/* Stats */
.grow-toolbar .stat { font-weight: 700; }
.grow-toolbar .stat.success { color: #2e7d32; }
.grow-toolbar .stat.warning { color: #f59e0b; }
.grow-toolbar .stat.error { color: #dc2626; }

/* Links */
.grow-toolbar .link {
  color: var(--wp--preset--color--primary, #2e7d32);
  text-decoration: none;
  font-weight: 600;
  word-break: break-word;
}
.grow-toolbar .link:hover { text-decoration: underline; }

/* Moon, chart, visuals */
.grow-toolbar .moon {
  font-size: 44px;
  text-align: center;
  margin: 10px 0;
}
.grow-toolbar .chart {
  width: 100%;
  height: 200px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

/* Search results / strain links */
.grow-toolbar .search-results {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Focus states */
.grow-toolbar .card:focus-within {
  outline: 3px solid rgba(46,125,50,0.18);
  box-shadow: 0 0 0 4px rgba(46,125,50,0.06);
}

/* -------- Responsive Breakpoints -------- */

/* Tablet */
@media (max-width: 768px) {
  .grow-toolbar .wrap { padding: 12px; }
  .grow-toolbar h3 { font-size: 14px; }
  .grow-toolbar .grid { gap: 12px; }
}

/* Phones */
@media (max-width: 600px) {
  .grow-toolbar .grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
  .grow-toolbar h3 { font-size: 13px; }
  .grow-toolbar input,
  .grow-toolbar button { font-size: 14px; padding: 12px; }
}

/* Small phones (portrait) */
@media (max-width: 430px) {
  .grow-toolbar .grid { grid-template-columns: 1fr; }
  .grow-toolbar .row { flex-direction: column; gap: 6px; }
  .grow-toolbar h3 { font-size: 13px; }
  .grow-toolbar input,
  .grow-toolbar button,
  .grow-toolbar select { width: 100%; }
}
