/* Production CSS served from /public/styles */
/* Contents copied from src/styles/garden.css */
@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,600&display=swap');

:root {
  --container-max: 1280px;
  --surface: #ffffff;
  --surface-2: #f7fafc;
  --border: #000000;
  --text: #000000;
  --muted: #111111;
  --primary: #000000; /* buttons now black */
  --primary-hover: #222222; /* subtle hover lighter than black */
  --radius: 16px;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #ffffff; /* full site background white */
  color: var(--text);
  font-family: 'Bricolage Grotesque', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-weight: 400;
  font-optical-sizing: auto;
  overflow-x: hidden;
}

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  background: transparent; /* no panel background */
  border-radius: 0;
  padding: 0; /* no extra padding to avoid scroll */
  box-shadow: none; /* remove drop shadow */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1 {
  text-align: center;
  color: var(--text);
  margin: 8px 0 6px;
  font-size: 2.2rem;
  font-family: 'Bricolage Grotesque', system-ui, -apple-system, sans-serif;
  font-weight: 600;
  font-optical-sizing: auto;
}
.titlebar {
  position: fixed;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0; /* fixed element */
  z-index: 40;
}

/* Floating bottom nav */
.bottombar {
  position: fixed;
  left: 50%;
  bottom: 30px; /* 30px from bottom */
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  z-index: 50;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
}
.bottombar-user {
  flex: 0 1 auto;
  width: 180px; /* smaller input */
  padding: 8px 10px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  min-width: 140px;
}
.bottombar-actions {
  display: flex;
  gap: 8px;
}
button {
  padding: 8px 14px;
  background: var(--primary);
  color: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: 'Bricolage Grotesque', system-ui, -apple-system, sans-serif;
  font-weight: 400;
  cursor: pointer;
  box-shadow: none;
  transition: background 140ms ease, transform 80ms ease, opacity 140ms ease;
}
button.icon-btn { 
  padding: 0; 
  background: transparent; 
  border: none; 
  display: grid; 
  place-items: center; 
  position: relative; 
  cursor: pointer;
  transition: transform 80ms ease;
}
button:not(.icon-btn):hover { background: var(--primary-hover); }
button:not(.icon-btn):active { transform: translateY(1px); }
button.icon-btn:active { transform: scale(0.95); }
button:disabled { opacity: 0.7; cursor: default; }

/* Icon hover states */
.icon-btn .icon-hover {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 140ms ease;
}
.icon-btn .icon-normal {
  opacity: 1;
  transition: opacity 140ms ease;
}
.icon-btn:hover .icon-hover {
  opacity: 1;
}
.icon-btn:hover .icon-normal {
  opacity: 0;
}

/* Better icon rendering across browsers - smooth SVGs */
.icon-btn img {
  image-rendering: auto;
  image-rendering: smooth;
  shape-rendering: geometricPrecision;
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
/* Copy feedback style */
.copy-btn.copied { background: #1f2937; border-color: #000; }
/* Share modal tweaks */
.share-grid .row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; }
.copy-btn { padding: 6px 12px; font-size: 12px; margin-left: 8px; }
.code-field { 
  width: 100%; 
  max-width: 100%;
  font-family: monospace; 
  padding: 12px; 
  border: 1px solid #000; 
  border-radius: 6px; 
  resize: none; 
  box-sizing: border-box; 
  overflow-x: auto;
  overflow-y: auto;
  word-wrap: break-word;
  word-break: break-all;
  margin-top: 4px; 
  margin-bottom: 10px;
  min-height: fit-content;
  height: auto;
  field-sizing: content; /* Modern browsers */
}
.code-field.small { min-height: 60px; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: transparent;
  display: grid;
  place-items: center;
  z-index: 30;
}
.modal {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  width: min(560px, 92vw);
  max-width: 560px;
  padding: 20px 22px 22px;
  box-shadow: none; /* no dropshadow */
  overflow: hidden; /* prevent content overflow */
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-header h3 {
  font-family: 'Bricolage Grotesque', system-ui, -apple-system, sans-serif;
  font-weight: 600;
  font-optical-sizing: auto;
}
.modal-header button {
  /* Fix Safari X button vertical alignment */
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  min-height: 32px;
  min-width: 32px;
}
.modal-body { 
  color: var(--text); 
}
.modal-body ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.modal-body a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.modal-body a:hover {
  color: var(--primary-hover);
}

/* AGGRESSIVE fix for modal text fields - force constraints */
.modal-body .code-field {
  width: calc(100% - 20px) !important;
  max-width: calc(100% - 20px) !important;
  min-width: auto !important;
  margin: 4px 10px 10px 10px !important;
  box-sizing: border-box !important;
  display: block !important;
  position: relative !important;
}

/* Drawer */
.controls-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(360px, 90vw);
  background: var(--surface);
  border-left: 2px solid var(--border);
  box-shadow: none; /* no dropshadow */
  transform: translateX(100%);
  transition: transform 180ms ease;
  padding: 16px;
  z-index: 60; /* above titlebar (40) and bottombar (50) */
  overflow: auto;
  box-sizing: border-box;
}
.controls-drawer.open { transform: translateX(0); }
.drawer-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.drawer-header button {
  /* Fix Safari X button vertical alignment */
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  min-height: 32px;
  min-width: 32px;
}
.drawer-header h3 { 
  color: var(--text);
  font-family: 'Bricolage Grotesque', system-ui, -apple-system, sans-serif;
  font-weight: 600;
  font-optical-sizing: auto;
}
.drawer-section { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px; display: grid; gap: 12px; }
.drawer-section h4 { margin: 0 0 4px; font-size: 14px; font-weight: 600; color: var(--text); text-transform: none; letter-spacing: .04em; }
.drawer-section label { color: var(--muted); font-size: 14px; }
.drawer-section label.row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; }
.drawer-section label.row.with-range { grid-template-columns: 140px 1fr; }
.drawer-section .export-buttons { display: flex; gap: 8px; }
.drawer-section .bg-picker { display: flex; gap: 10px; align-items: center; }
.drawer-section input[type="number"], .drawer-section input[type="text"] {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px;
}
/* Dark form controls */
.drawer-section input[type="checkbox"] { accent-color: #000; width: 16px; height: 16px; }
.drawer-section input[type="range"] { accent-color: #000; -webkit-appearance: none; width: 100%; height: 8px; margin: 0; background: linear-gradient(to right, #000 0 var(--range-pct, 50%), #ddd var(--range-pct, 50%) 100%); border-radius: var(--radius); }
/* Improve range styling across browsers */
.drawer-section input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 0; height: 0; background: transparent; border: none; margin-top: 0; cursor: pointer; }
.drawer-section input[type="range"]::-moz-range-thumb { width: 0; height: 0; background: transparent; border: none; cursor: pointer; }
.drawer-section input[type="range"]::-ms-thumb { width: 0; height: 0; background: transparent; border: none; cursor: pointer; }
.drawer-section input[type="range"]::-webkit-slider-runnable-track { background: transparent; height: 8px; border-radius: var(--radius); }
.drawer-section input[type="range"]::-moz-range-track { background: #ddd; height: 8px; border-radius: var(--radius); }

.color-swatch { width: 28px; height: 28px; padding: 0; border: 1px solid var(--border); border-radius: 4px; appearance: none; background: none; }
.hex-input { width: 100px; }

/* Disabled/inactive state styling */
.drawer-section label.disabled {
  opacity: 0.5;
  pointer-events: none;
}
.drawer-section label.disabled span {
  color: #999;
}
.drawer-section label.disabled input[type="range"] {
  background: linear-gradient(to right, #ccc 0 var(--range-pct, 50%), #eee var(--range-pct, 50%) 100%);
  opacity: 0.6;
}
.drawer-section label.disabled select {
  color: #999;
  background-color: #f5f5f5;
  border-color: #ddd;
}

/* Garden root fills remaining viewport to allow centering */
.garden-root {
  flex: 1 1 auto;
  min-height: 0; /* allow child to size without overflow */
  display: flex;
  flex-direction: column;
}

/* Garden */
.garden-container {
  flex: 1 1 auto; /* take remaining height within garden-root */
  display: flex;
  align-items: center; /* vertical center */
  justify-content: center; /* horizontal center wrapper */
  min-height: 0; /* prevent flex overflow */
  border-radius: 16px;
}
.garden-canvas {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  padding: 0;
  margin: 0 auto; /* center the artwork */
}

/* Add rounded corners to the garden artwork */
.garden-canvas svg {
  border-radius: 16px;
  overflow: hidden;
}

/* Embed-specific overrides: the EmbedView mounts GardenClient with class "embed" */
.embed .garden-canvas {
  padding: 0 !important;
  min-height: 0 !important;
}

.tooltip {
  position: absolute;
  background: #ffffff;
  color: var(--text);
  padding: 6px 8px;
  border-radius: var(--radius);
  font-size: 14px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 2;
  border: 1px solid var(--border);
}

.loading-state, .error-state { text-align: center; padding: 24px 12px; color: var(--muted); }

@media (max-width: 768px) {
  .container { padding: 0; }
  h1 { font-size: 1.6rem; }
  .bottombar { bottom: 16px; padding: 8px 10px; }
  .bottombar-user { width: 140px; }
  /* Drawer goes full width on mobile */
  .controls-drawer { left: 0; right: 0; width: 100vw; max-width: 100vw; padding: 14px; }
  /* Fix modal positioning on mobile */
  .modal {
    width: min(560px, 90vw);
    max-height: 90vh;
    overflow-y: auto;
  }
}

