/* Visually hide native color input but keep it accessible */
.color-input-hidden {
  position: fixed;
  left: -10000px;
  top: -10000px;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
  border: 0;
}
/* styles.css
   Styling for the Comic Speech Bubble Generator web app.  The page
   uses a simple, clean layout with space for controls above and a
   canvas area below where the bubbles will be drawn.
 */

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background-color: #0b0f19; /* slate-950 */
  color: #e5e7eb; /* zinc-200 */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header {
  background: linear-gradient(180deg, #0f172a 0%, #0b1220 100%);
  padding: 1rem 1.25rem;
  text-align: center;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: #e5e7eb;
}

header p {
  margin: 0.5rem 0 0;
  color: #94a3b8;
}

main {
  flex: 1;
  display: flex;
  flex-direction: row; /* controls on the left */
  align-items: stretch;
  gap: 1rem;
  padding: 1rem;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 320px; /* sidebar width */
  flex: 0 0 320px;
  padding: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.9) 0%, rgba(10, 15, 28, 0.9) 100%);
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(6px);
  height: fit-content;
  align-self: flex-start;
}

.controls textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 110px;
  padding: 0.75rem 0.875rem;
  font-size: 0.95rem;
  resize: vertical;
  border-radius: 0;
  border: 1px solid #334155; /* slate-700 */
  background: #0f172a; /* slate-900 */
  color: #e5e7eb;
  outline: none;
}
.controls textarea::placeholder {
  color: #64748b;
}

.controls select,
.controls input[type="color"],
.controls input[type="range"],
.controls button {
  width: 100%;
  box-sizing: border-box;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  border-radius: 0;
  border: 1px solid #334155;
  background-color: #0f172a;
  color: #e5e7eb;
  outline: none;
}

/* remove custom color picker styles (reverting to native input) */

/* Tail direction dropdown and tail length slider use the same flex sizing as other controls */
.controls label {
  font-size: 0.85rem;
  color: #94a3b8;
}

.controls input[type="range"] {
  margin: 0.25rem 0 0.5rem;
  accent-color: #22d3ee; /* cyan-400 */
}

.controls button {
  background: linear-gradient(180deg, #7c3aed 0%, #4f46e5 100%);
  color: white;
  border: none;
  cursor: pointer;
  transition: transform 0.05s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.35);
}

.controls button:hover {
  opacity: 0.95;
}
.controls button:active {
  transform: translateY(1px);
}

.viewport {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
  height: 700px;
  overflow: hidden;
  border: 1px dashed #334155;
}

.bubble-container {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 0;
  background-color: #0b1220;
  transform-origin: 0 0;
}

/* Color presets row */
.color-presets {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.35rem;
}
.preset-row { display: flex; align-items: center; gap: 0.5rem; }
.preset-label { font-size: 0.8rem; color: #94a3b8; }
.color-presets .color-chip {
  width: 28px;
  height: 28px;
  border-radius: 0;
  border: 1px solid rgba(148,163,184,0.25);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}
.color-presets .color-chip:focus-visible {
  outline: 2px solid #22d3ee;
  outline-offset: 2px;
}

/* Spectrum strip (rainbow gradient) */
.spectrum-wrapper { position: relative; width: 100%; }
.spectrum {
  width: 100%;
  height: 14px;
  background: linear-gradient(90deg, red, #ff0, #0f0, #0ff, #00f, #f0f, red);
  border: 1px solid #334155;
  cursor: crosshair;
  box-sizing: border-box;
}
.spectrum-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
}
.spectrum + .preset-row { margin-top: 0.5rem; }

/* Zoom controls row */
.zoom-row { display: flex; gap: 0.5rem; }

/* Text inside bubbles uses Comic Sans to better match classic comic styles */
.bubble-text {
  cursor: default;
  user-select: none;
}

/* Selected bubble highlight */
.bubble-text.selected {
  outline: 2px solid #22d3ee;
  outline-offset: 2px;
}

/* Delete button styling adapted for dark theme */
.bubble-delete-button {
  background: #0b1220 !important;
  color: #e5e7eb !important;
  border: 1px solid #475569 !important;
  box-shadow: 0 2px 8px rgba(2, 6, 23, 0.5);
  border-radius: 0 !important;
}

/* Keep delete button above outlines/handles */
.bubble-text { position: relative; }
.bubble-delete-button { z-index: 10001; }
.tail-handle { z-index: 10000; }

/* Prevent delete button from being hidden by text span */
.bubble-content { position: relative; z-index: 1; }
}
#paperCanvas {
#  no change, keep block shape
}

/* Prevent textarea overlap with controls by adding spacing */
textarea#bubbleText { margin-bottom: 0.5rem; }

/* Ensure the canvas fills the container */
#paperCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Inline checkbox label alignment */
.inline-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}