/* ============================================================
   AI Prompt Builder - CSS Design System v2
   Design: Data Visualization Aesthetics with Modular Grid System
   - Color-coded categories (cyan=camera, magenta=lighting, yellow=style, green=composition)
   - IBM Plex typography for technical precision
   - Zero border-radius, sharp professional aesthetic
   - Animated previews for camera movements & temporal effects
   ============================================================ */

/* ---- CSS Custom Properties (Light Theme) ---- */
:root {
  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

  --bg: #f0f2f5;
  --bg-card: #ffffff;
  --bg-muted: #e8eaed;
  --bg-input: #ffffff;
  --bg-overlay: rgba(0,0,0,0.5);

  --fg: #1a1d24;
  --fg-secondary: #4a4f5a;
  --fg-muted: #6b7280;
  --fg-placeholder: #9ca3af;

  --border: #c8ccd4;
  --border-hover: rgba(26, 29, 36, 0.25);
  --border-active: #3b5998;

  --primary: #3b5998;
  --primary-fg: #f0f4ff;
  --primary-hover: #2d4a85;

  --ring: rgba(59, 89, 152, 0.35);

  /* Category accent colors */
  --cat-camera: #0891b2;
  --cat-lighting: #c026d3;
  --cat-style: #ca8a04;
  --cat-composition: #16a34a;
  --cat-temporal: #e11d48;
  --cat-movement: #7c3aed;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);

  --toast-bg: #1a1d24;
  --toast-fg: #f0f2f5;
}

/* ---- Dark Theme ---- */
[data-theme="dark"] {
  --bg: #0c0e12;
  --bg-card: #14171e;
  --bg-muted: #1c2028;
  --bg-input: #1c2028;
  --bg-overlay: rgba(0,0,0,0.7);

  --fg: #e8eaed;
  --fg-secondary: #b0b5bf;
  --fg-muted: #6b7280;
  --fg-placeholder: #4a4f5a;

  --border: rgba(255,255,255,0.1);
  --border-hover: rgba(255,255,255,0.2);
  --border-active: #5b8dd9;

  --primary: #5b8dd9;
  --primary-fg: #0c0e12;
  --primary-hover: #4a7cc8;

  --ring: rgba(91, 141, 217, 0.4);

  --cat-camera: #22d3ee;
  --cat-lighting: #e879f9;
  --cat-style: #facc15;
  --cat-composition: #4ade80;
  --cat-temporal: #fb7185;
  --cat-movement: #a78bfa;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);

  --toast-bg: #e8eaed;
  --toast-fg: #0c0e12;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { font-family: var(--font-sans); background: var(--bg); color: var(--fg); line-height: 1.6; min-height: 100vh; transition: background 0.3s ease, color 0.3s ease; }

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.3; }
.font-mono { font-family: var(--font-mono); }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-muted { color: var(--fg-muted); }
.text-secondary { color: var(--fg-secondary); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.uppercase { text-transform: uppercase; }
.tracking-tight { letter-spacing: -0.025em; }

/* ---- Layout ---- */
.container { width: 100%; max-width: 1440px; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 640px) { .container { padding: 0 1.5rem; } }
@media (min-width: 1024px) { .container { padding: 0 2rem; } }

.grid-12 { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 1024px) { .grid-12 { grid-template-columns: 2fr 1fr; } }

/* ---- Card ---- */
.card { background: var(--bg-card); border: 2px solid var(--border); padding: 1.5rem; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.card:hover { box-shadow: var(--shadow-sm); }

/* ---- Header ---- */
.header { background: var(--bg-card); border-bottom: 2px solid var(--border); padding: 1rem 0; position: sticky; top: 0; z-index: 100; backdrop-filter: blur(12px); }
[data-theme="dark"] .header { background: rgba(20, 23, 30, 0.92); }
.header-inner { display: flex; align-items: center; justify-content: space-between; }
.header-brand { display: flex; align-items: center; gap: 0.75rem; }
.header-brand svg { width: 2rem; height: 2rem; color: var(--primary); }
.header-brand h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.025em; }
.header-brand p { font-size: 0.875rem; color: var(--fg-muted); font-family: var(--font-mono); }

/* ---- Theme Toggle Button ---- */
.btn-theme-toggle { display: flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; border: 2px solid var(--border); background: transparent; color: var(--fg); cursor: pointer; transition: all 0.2s ease; }
.btn-theme-toggle:hover { border-color: var(--border-hover); background: var(--bg-muted); }
.btn-theme-toggle svg { width: 1.25rem; height: 1.25rem; }

/* ---- Tabs ---- */
.tabs-list { display: grid; grid-template-columns: 1fr 1fr; border: 2px solid var(--border); background: var(--bg-muted); margin-bottom: 1.5rem; }
.tab-trigger { display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.75rem 1rem; font-family: var(--font-sans); font-size: 0.9375rem; font-weight: 600; border: none; background: transparent; color: var(--fg-muted); cursor: pointer; transition: all 0.2s ease; }
.tab-trigger:hover { color: var(--fg); background: rgba(255,255,255,0.3); }
[data-theme="dark"] .tab-trigger:hover { background: rgba(255,255,255,0.05); }
.tab-trigger.active { background: var(--primary); color: var(--primary-fg); }
.tab-trigger svg { width: 1.125rem; height: 1.125rem; }

/* ---- Form Elements ---- */
label { display: flex; align-items: center; gap: 0.5rem; font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
label svg { width: 1rem; height: 1rem; }
textarea, select, input[type="text"] { width: 100%; font-family: var(--font-mono); font-size: 0.875rem; padding: 0.75rem; border: 2px solid var(--border); background: var(--bg-input); color: var(--fg); outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease; resize: vertical; }
textarea:focus, select:focus, input[type="text"]:focus { border-color: var(--border-active); box-shadow: 0 0 0 3px var(--ring); }
textarea::placeholder, input::placeholder { color: var(--fg-placeholder); }
textarea.subject-area { min-height: 80px; }
textarea.detail-area { min-height: 60px; }
select { font-family: var(--font-sans); cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2.5rem; }
.field-group { margin-bottom: 1.5rem; }

/* ---- Search / Filter Input ---- */
.search-input-wrap { position: relative; margin-bottom: 1rem; }
.search-input-wrap svg { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); width: 1rem; height: 1rem; color: var(--fg-muted); pointer-events: none; }
.search-input-wrap input { padding-left: 2.5rem; font-family: var(--font-sans); resize: none; }

/* ---- Category Filter Chips ---- */
.filter-chips { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-bottom: 1rem; }
.filter-chip { display: inline-flex; align-items: center; padding: 0.25rem 0.625rem; font-size: 0.75rem; font-weight: 600; border: 1px solid var(--border); background: transparent; color: var(--fg-secondary); cursor: pointer; transition: all 0.15s ease; font-family: var(--font-sans); }
.filter-chip:hover { border-color: var(--border-hover); background: var(--bg-muted); }
.filter-chip.active { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }

/* ---- Accordion ---- */
.accordion { border: 2px solid var(--border); }
.accordion-item { border-bottom: 1px solid var(--border); }
.accordion-item:last-child { border-bottom: none; }
.accordion-trigger { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 1rem; font-family: var(--font-sans); font-size: 0.9375rem; font-weight: 600; border: none; background: transparent; color: var(--fg); cursor: pointer; transition: background 0.15s ease; text-align: left; }
.accordion-trigger:hover { background: var(--bg-muted); }
.accordion-trigger-left { display: flex; align-items: center; gap: 0.5rem; }
.accordion-trigger-left svg { width: 1.25rem; height: 1.25rem; }
.accordion-trigger .chevron { width: 1.25rem; height: 1.25rem; transition: transform 0.25s ease; color: var(--fg-muted); }
.accordion-item.open .accordion-trigger .chevron { transform: rotate(180deg); }
.accordion-content { max-height: 0; overflow: hidden; transition: max-height 0.35s ease, padding 0.35s ease; }
.accordion-item.open .accordion-content { max-height: 5000px; padding: 0 1rem 1rem 1rem; }

/* Category border indicators */
.cat-style { border-left: 4px solid var(--cat-style); }
.cat-camera { border-left: 4px solid var(--cat-camera); }
.cat-lighting { border-left: 4px solid var(--cat-lighting); }
.cat-composition { border-left: 4px solid var(--cat-composition); }
.cat-movement { border-left: 4px solid var(--cat-movement); }
.cat-temporal { border-left: 4px solid var(--cat-temporal); }

/* ---- Option Grid (style/camera/lighting/lens/mood cards) ---- */
.option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; max-height: 480px; overflow-y: auto; padding-right: 0.5rem; }
@media (min-width: 768px) { .option-grid.grid-3 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .option-grid { grid-template-columns: 1fr; } }

/* Custom scrollbar */
.option-grid::-webkit-scrollbar { width: 6px; }
.option-grid::-webkit-scrollbar-track { background: var(--bg-muted); }
.option-grid::-webkit-scrollbar-thumb { background: var(--border); }
.option-grid::-webkit-scrollbar-thumb:hover { background: var(--fg-muted); }

/* ---- Option Card ---- */
.option-card { border: 2px solid var(--border); background: var(--bg-card); cursor: pointer; transition: all 0.2s ease; overflow: hidden; position: relative; }
.option-card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.option-card.selected { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.option-card-img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; background: var(--bg-muted); }
.option-card-body { padding: 0.625rem 0.75rem; }
.option-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 0.125rem; gap: 0.5rem; }
.option-card-title { font-size: 0.8125rem; font-weight: 600; }
.option-card-desc { font-size: 0.6875rem; color: var(--fg-muted); line-height: 1.4; }
.option-card .count-badge { position: absolute; top: 0.5rem; right: 0.5rem; font-size: 0.625rem; padding: 0.125rem 0.375rem; background: var(--bg-overlay); color: #fff; font-weight: 600; }

/* ---- Animated Preview Box (for Camera Movements & Temporal Effects) ---- */
.anim-preview { width: 100%; aspect-ratio: 16 / 10; background: var(--bg-muted); position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.anim-preview-scene { position: absolute; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.anim-preview-scene .scene-bg { position: absolute; inset: 0; background: linear-gradient(135deg, var(--bg-muted) 0%, var(--bg-card) 50%, var(--bg-muted) 100%); }
[data-theme="dark"] .anim-preview-scene .scene-bg { background: linear-gradient(135deg, #1a1d24 0%, #23272f 50%, #1a1d24 100%); }
.anim-preview-scene .scene-obj { width: 40px; height: 40px; background: var(--primary); position: relative; z-index: 1; }
.anim-preview-scene .scene-obj-circle { width: 36px; height: 36px; border-radius: 50%; background: var(--cat-camera); position: relative; z-index: 1; }
.anim-preview-scene .scene-horizon { position: absolute; bottom: 35%; left: 0; right: 0; height: 2px; background: var(--border-hover); z-index: 0; }
.anim-preview-scene .scene-grid { position: absolute; inset: 0; background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 20px 20px; opacity: 0.3; z-index: 0; }
.anim-preview-label { position: absolute; bottom: 0.375rem; left: 0.375rem; font-size: 0.5625rem; font-family: var(--font-mono); color: var(--fg-muted); background: var(--bg-card); padding: 0.125rem 0.375rem; border: 1px solid var(--border); z-index: 5; text-transform: uppercase; letter-spacing: 0.05em; }

/* ---- Camera Movement Animations ---- */
.option-card:hover .anim-pan-left .scene-grid { animation: anim-pan-left 2s ease-in-out infinite; }
.option-card:hover .anim-pan-right .scene-grid { animation: anim-pan-right 2s ease-in-out infinite; }
.option-card:hover .anim-tilt-up .scene-grid { animation: anim-tilt-up 2s ease-in-out infinite; }
.option-card:hover .anim-tilt-down .scene-grid { animation: anim-tilt-down 2s ease-in-out infinite; }
.option-card:hover .anim-dolly-in .scene-obj { animation: anim-dolly-in 2s ease-in-out infinite; }
.option-card:hover .anim-dolly-out .scene-obj { animation: anim-dolly-out 2s ease-in-out infinite; }
.option-card:hover .anim-dolly-zoom .scene-obj { animation: anim-dolly-zoom 2s ease-in-out infinite; }
.option-card:hover .anim-dolly-zoom .scene-grid { animation: anim-dolly-zoom-bg 2s ease-in-out infinite; }
.option-card:hover .anim-tracking .scene-obj { animation: anim-tracking 2s ease-in-out infinite; }
.option-card:hover .anim-crane-up .scene-grid { animation: anim-crane-up 2s ease-in-out infinite; }
.option-card:hover .anim-crane-down .scene-grid { animation: anim-crane-down 2s ease-in-out infinite; }
.option-card:hover .anim-steadicam .scene-obj { animation: anim-steadicam 3s ease-in-out infinite; }
.option-card:hover .anim-handheld .anim-preview-scene { animation: anim-handheld 0.5s ease-in-out infinite; }
.option-card:hover .anim-orbit .scene-obj { animation: anim-orbit 3s linear infinite; }
.option-card:hover .anim-whip-pan .anim-preview-scene { animation: anim-whip-pan 1.5s ease-in-out infinite; }
.option-card:hover .anim-zoom-in .scene-obj { animation: anim-zoom-in 2s ease-in-out infinite; }
.option-card:hover .anim-zoom-out .scene-obj { animation: anim-zoom-out 2s ease-in-out infinite; }
.option-card:hover .anim-roll .anim-preview-scene { animation: anim-roll 3s ease-in-out infinite; }
.option-card:hover .anim-fly-through .scene-grid { animation: anim-fly-through 2s linear infinite; }
.option-card:hover .anim-fly-through .scene-obj { animation: anim-dolly-in 2s ease-in-out infinite; }
.option-card:hover .anim-follow .scene-obj { animation: anim-follow 2.5s ease-in-out infinite; }
.option-card:hover .anim-reveal .scene-obj { animation: anim-reveal 2.5s ease-in-out infinite; }
.option-card:hover .anim-boom .scene-grid { animation: anim-boom 2s ease-in-out infinite; }
.option-card:hover .anim-cable-cam .scene-obj { animation: anim-cable-cam 2.5s ease-in-out infinite; }
.option-card:hover .anim-cable-cam .scene-grid { animation: anim-cable-cam-bg 2.5s ease-in-out infinite; }
.option-card:hover .anim-360-rotation .scene-obj { animation: anim-360 3s linear infinite; }

@keyframes anim-pan-left { 0%,100% { transform: translateX(0); } 50% { transform: translateX(20px); } }
@keyframes anim-pan-right { 0%,100% { transform: translateX(0); } 50% { transform: translateX(-20px); } }
@keyframes anim-tilt-up { 0%,100% { transform: translateY(0); } 50% { transform: translateY(15px); } }
@keyframes anim-tilt-down { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-15px); } }
@keyframes anim-dolly-in { 0%,100% { transform: scale(1); } 50% { transform: scale(1.5); } }
@keyframes anim-dolly-out { 0%,100% { transform: scale(1); } 50% { transform: scale(0.6); } }
@keyframes anim-dolly-zoom { 0%,100% { transform: scale(1); } 50% { transform: scale(1.4); } }
@keyframes anim-dolly-zoom-bg { 0%,100% { transform: scale(1); } 50% { transform: scale(0.7); } }
@keyframes anim-tracking { 0%,100% { transform: translateX(0); } 50% { transform: translateX(30px); } }
@keyframes anim-crane-up { 0%,100% { transform: translateY(0); } 50% { transform: translateY(20px); } }
@keyframes anim-crane-down { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-20px); } }
@keyframes anim-steadicam { 0%,100% { transform: translate(0,0); } 25% { transform: translate(10px,-5px); } 50% { transform: translate(20px,0); } 75% { transform: translate(10px,5px); } }
@keyframes anim-handheld { 0% { transform: translate(0,0) rotate(0deg); } 25% { transform: translate(2px,-1px) rotate(0.5deg); } 50% { transform: translate(-1px,2px) rotate(-0.5deg); } 75% { transform: translate(-2px,-1px) rotate(0.3deg); } 100% { transform: translate(0,0) rotate(0deg); } }
@keyframes anim-orbit { 0% { transform: translateX(0) translateY(0); } 25% { transform: translateX(15px) translateY(-8px) scale(0.9); } 50% { transform: translateX(0) translateY(0) scale(0.8); } 75% { transform: translateX(-15px) translateY(8px) scale(0.9); } 100% { transform: translateX(0) translateY(0) scale(1); } }
@keyframes anim-whip-pan { 0%,40% { transform: translateX(0); filter: blur(0); } 45% { transform: translateX(-100%); filter: blur(4px); } 55% { transform: translateX(100%); filter: blur(4px); } 60%,100% { transform: translateX(0); filter: blur(0); } }
@keyframes anim-zoom-in { 0%,100% { transform: scale(1); } 50% { transform: scale(1.8); } }
@keyframes anim-zoom-out { 0%,100% { transform: scale(1.5); } 50% { transform: scale(0.7); } }
@keyframes anim-roll { 0%,100% { transform: rotate(0deg); } 25% { transform: rotate(8deg); } 75% { transform: rotate(-8deg); } }
@keyframes anim-fly-through { 0% { background-position: 0 0; } 100% { background-position: 20px 20px; } }
@keyframes anim-follow { 0%,100% { transform: translateX(-20px); } 50% { transform: translateX(20px); } }
@keyframes anim-reveal { 0% { transform: translateX(-40px); opacity: 0; } 30% { transform: translateX(-40px); opacity: 0; } 60% { transform: translateX(0); opacity: 1; } 100% { transform: translateX(0); opacity: 1; } }
@keyframes anim-boom { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-25px); } }
@keyframes anim-cable-cam { 0%,100% { transform: translate(-15px, 10px); } 50% { transform: translate(15px, -10px); } }
@keyframes anim-cable-cam-bg { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-10px, 5px); } }
@keyframes anim-360 { 0% { transform: rotate(0deg) translateX(15px) rotate(0deg); } 100% { transform: rotate(360deg) translateX(15px) rotate(-360deg); } }

/* ---- Temporal Effect Animations ---- */
.option-card:hover .anim-slow-mo .scene-obj { animation: anim-temporal-move 4s ease-in-out infinite; }
.option-card:hover .anim-ultra-slow .scene-obj { animation: anim-temporal-move 8s ease-in-out infinite; }
.option-card:hover .anim-timelapse .scene-obj { animation: anim-temporal-move 0.6s linear infinite; }
.option-card:hover .anim-timelapse .scene-bg { animation: anim-timelapse-bg 2s linear infinite; }
.option-card:hover .anim-hyperlapse .scene-obj { animation: anim-temporal-move 0.4s linear infinite; }
.option-card:hover .anim-hyperlapse .scene-grid { animation: anim-fly-through 0.5s linear infinite; }
.option-card:hover .anim-speed-ramp .scene-obj { animation: anim-speed-ramp 3s ease-in-out infinite; }
.option-card:hover .anim-reverse .scene-obj { animation: anim-reverse 2s ease-in-out infinite; }
.option-card:hover .anim-freeze-frame .scene-obj { animation: anim-freeze 3s ease-in-out infinite; }
.option-card:hover .anim-stop-motion .scene-obj { animation: anim-stop-motion 2s steps(8) infinite; }
.option-card:hover .anim-long-exposure .scene-obj { animation: anim-long-exposure 2s ease-in-out infinite; }
.option-card:hover .anim-bullet-time .scene-obj { animation: anim-bullet-time 3s ease-in-out infinite; }
.option-card:hover .anim-loop .scene-obj { animation: anim-loop 1.5s ease-in-out infinite; }
.option-card:hover .anim-day-night .scene-bg { animation: anim-day-night 3s ease-in-out infinite; }
.option-card:hover .anim-strobe .scene-bg { animation: anim-strobe 0.5s steps(2) infinite; }

@keyframes anim-temporal-move { 0%,100% { transform: translateX(-20px); } 50% { transform: translateX(20px); } }
@keyframes anim-timelapse-bg { 0% { background: linear-gradient(135deg, #87CEEB 0%, #FFD700 50%, #87CEEB 100%); } 33% { background: linear-gradient(135deg, #FF6B35 0%, #FF4500 50%, #FF6B35 100%); } 66% { background: linear-gradient(135deg, #1a1a3e 0%, #0d0d2b 50%, #1a1a3e 100%); } 100% { background: linear-gradient(135deg, #87CEEB 0%, #FFD700 50%, #87CEEB 100%); } }
@keyframes anim-speed-ramp { 0% { transform: translateX(-25px); } 30% { transform: translateX(-5px); } 40% { transform: translateX(0); } 60% { transform: translateX(0); } 70% { transform: translateX(5px); } 100% { transform: translateX(25px); } }
@keyframes anim-reverse { 0% { transform: translateX(20px); } 100% { transform: translateX(-20px); } }
@keyframes anim-freeze { 0%,30% { transform: translateX(-20px); } 35%,65% { transform: translateX(0); filter: brightness(1.2); } 70%,100% { transform: translateX(20px); } }
@keyframes anim-stop-motion { 0% { transform: translateX(-20px); } 100% { transform: translateX(20px); } }
@keyframes anim-long-exposure { 0%,100% { transform: translateX(-15px); filter: blur(0); } 25% { filter: blur(3px); } 50% { transform: translateX(15px); filter: blur(0); } 75% { filter: blur(3px); } }
@keyframes anim-bullet-time { 0%,40% { transform: translateX(-10px) scale(1); } 45%,55% { transform: translateX(0) scale(1.3); filter: brightness(1.3); } 60%,100% { transform: translateX(10px) scale(1); } }
@keyframes anim-loop { 0% { transform: translateX(-15px) translateY(5px); } 25% { transform: translateX(0) translateY(-5px); } 50% { transform: translateX(15px) translateY(5px); } 75% { transform: translateX(0) translateY(-5px); } 100% { transform: translateX(-15px) translateY(5px); } }
@keyframes anim-day-night { 0%,100% { background: linear-gradient(180deg, #87CEEB 0%, #e0f0ff 100%); } 50% { background: linear-gradient(180deg, #0d1b2a 0%, #1b2838 100%); } }
@keyframes anim-strobe { 0%,49% { opacity: 1; } 50%,100% { opacity: 0.2; } }

/* ---- Badge ---- */
.badge { display: inline-block; font-size: 0.6875rem; font-weight: 600; padding: 0.125rem 0.5rem; background: var(--bg-muted); color: var(--fg-secondary); white-space: nowrap; border: 1px solid var(--border); }
.badge-selected { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.badge-outline { background: transparent; border: 1px solid var(--border); font-family: var(--font-mono); }
.badge-count { font-size: 0.625rem; padding: 0.0625rem 0.375rem; margin-left: 0.25rem; background: var(--bg-muted); color: var(--fg-muted); }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.625rem 1.25rem; font-family: var(--font-sans); font-size: 0.875rem; font-weight: 600; border: 2px solid transparent; cursor: pointer; transition: all 0.2s ease; white-space: nowrap; }
.btn svg { width: 1rem; height: 1rem; }
.btn-primary { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline { background: transparent; color: var(--fg); border-color: var(--border); }
.btn-outline:hover { background: var(--bg-muted); border-color: var(--border-hover); }
.btn-outline:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-full { width: 100%; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.75rem; }
.btn-row { display: flex; gap: 0.5rem; }
.btn-row .btn { flex: 1; }

/* ---- Prompt Output Panel ---- */
.prompt-panel { position: sticky; top: 5rem; display: flex; flex-direction: column; gap: 1rem; }
.prompt-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.25rem; }
.prompt-output { border: 2px solid var(--border); background: var(--bg-muted); padding: 1rem; min-height: 200px; max-height: 400px; overflow-y: auto; font-family: var(--font-mono); font-size: 0.875rem; line-height: 1.7; white-space: pre-wrap; word-break: break-word; color: var(--fg); }
.prompt-placeholder { color: var(--fg-placeholder); font-style: italic; }

/* ---- Active Parameters Card ---- */
.params-table { width: 100%; }
.params-row { display: flex; justify-content: space-between; padding: 0.375rem 0; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.params-row:last-child { border-bottom: none; }
.params-label { color: var(--fg-muted); }
.params-value { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500; max-width: 60%; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Pro Tips Card ---- */
.tips-card { background: var(--bg-muted); border: 2px solid var(--border); padding: 1rem; }
.tips-card h4 { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; margin-bottom: 0.5rem; }
.tips-card h4 svg { width: 1rem; height: 1rem; }
.tips-list { list-style: none; font-size: 0.75rem; color: var(--fg-muted); }
.tips-list li { padding: 0.125rem 0; }

/* ---- Toast Notification ---- */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem; }
.toast { background: var(--toast-bg); color: var(--toast-fg); padding: 0.75rem 1.25rem; font-size: 0.875rem; font-weight: 500; box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 0.5rem; animation: toast-in 0.3s ease, toast-out 0.3s ease 2.5s forwards; max-width: 360px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(1rem); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(1rem); } }

/* ---- Footer ---- */
.footer { border-top: 2px solid var(--border); margin-top: 3rem; padding: 1.5rem 0; text-align: center; font-size: 0.875rem; color: var(--fg-muted); font-family: var(--font-mono); }

/* ---- Video-only sections ---- */
.video-only { display: none; }
body.mode-video .video-only { display: block; }

/* ---- Section Stats ---- */
.section-stats { display: flex; align-items: center; gap: 0.5rem; font-size: 0.6875rem; color: var(--fg-muted); font-family: var(--font-mono); margin-left: auto; margin-right: 0.75rem; }

/* ---- No Results ---- */
.no-results { text-align: center; padding: 2rem 1rem; color: var(--fg-muted); font-size: 0.875rem; }

/* ---- Utility ---- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-4 { margin-top: 1rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.gap-4 { gap: 1rem; }
.hidden { display: none !important; }

/* ============================================================
   AI Prompt Builder v3 - Additional Styles
   New: tool hint, strength meter, presets, history panel,
        color category, new badges, multi-select indicators
   ============================================================ */

/* ---- Tool Hint ---- */
.tool-hint {
  margin-top: 0.375rem;
  font-size: 0.75rem;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  min-height: 1rem;
  line-height: 1.5;
}

/* ---- Label Optional ---- */
.label-optional {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--fg-muted);
  margin-left: 0.25rem;
}

/* ---- Header Actions ---- */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ---- Prompt Strength Meter ---- */
.strength-bar-track {
  width: 100%;
  height: 6px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  overflow: hidden;
}
.strength-bar {
  height: 100%;
  transition: width 0.4s ease, background-color 0.4s ease;
  background: var(--fg-muted);
}
.strength-bar.strength-weak  { background: #ef4444; }
.strength-bar.strength-fair  { background: #f59e0b; }
.strength-bar.strength-good  { background: #3b82f6; }
.strength-bar.strength-strong { background: #22c55e; }

.strength-label-weak  { color: #ef4444 !important; border-color: #ef4444 !important; }
.strength-label-fair  { color: #f59e0b !important; border-color: #f59e0b !important; }
.strength-label-good  { color: #3b82f6 !important; border-color: #3b82f6 !important; }
.strength-label-strong { color: #22c55e !important; border-color: #22c55e !important; }

/* ---- Tool Badge in Prompt Header ---- */
#tool-badge {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.05em;
  color: var(--primary);
  border-color: var(--primary);
}

/* ---- Color Category ---- */
.cat-color { border-left: 4px solid #ec4899; }

/* ---- Multi-select indicator: subtle checkmark overlay on selected ---- */
.option-card.selected::after {
  content: '✓';
  position: absolute;
  top: 0.375rem;
  right: 0.375rem;
  width: 1.25rem;
  height: 1.25rem;
  background: var(--primary);
  color: var(--primary-fg);
  border-radius: 50%;
  font-size: 0.6875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.25rem;
  text-align: center;
  font-weight: 700;
  z-index: 5;
}

/* ---- Presets Grid ---- */
.presets-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.625rem 0.5rem;
  border: 2px solid var(--border);
  background: var(--bg-muted);
  color: var(--fg);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
}
.preset-btn:hover {
  border-color: var(--primary);
  background: var(--bg-card);
  color: var(--primary);
}
.preset-btn.preset-video {
  border-color: var(--cat-movement);
  color: var(--cat-movement);
  background: var(--bg-muted);
}
.preset-btn.preset-video:hover {
  background: var(--bg-card);
}
.preset-emoji {
  font-size: 1.25rem;
  line-height: 1;
}
.preset-label {
  font-size: 0.625rem;
  line-height: 1.2;
}

/* ---- History Panel ---- */
.history-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-card);
  border-left: 2px solid var(--border);
  z-index: 200;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0,0,0,0.2);
  transition: transform 0.3s ease;
}
.history-panel.hidden {
  display: none;
}
.history-panel-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.history-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 2px solid var(--border);
  flex-shrink: 0;
}
.history-panel-header h3 {
  font-size: 1rem;
  font-weight: 700;
}
.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.history-item {
  border: 1px solid var(--border);
  padding: 0.75rem;
  background: var(--bg-muted);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.history-item-meta {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
}
.history-time {
  font-size: 0.625rem;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  margin-left: auto;
}
.history-item-text {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--fg-secondary);
  line-height: 1.5;
  word-break: break-word;
}
.history-copy-btn {
  align-self: flex-start;
}
.badge-image { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.badge-video { background: var(--cat-movement); color: #fff; border-color: var(--cat-movement); }

/* ---- mt-4 refinement ---- */
.mt-4 { margin-top: 1rem; }

/* ---- Responsive: history panel ---- */
@media (max-width: 640px) {
  .history-panel { width: 100vw; }
  .presets-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   Image Lightbox & Context Menu — AI Prompt Builder v4
   ============================================================ */

/* ---- Lazy image placeholder ---- */
.option-card-img.lazy-img {
  background: var(--bg-muted);
  /* Subtle shimmer animation while not yet loaded */
  animation: lazy-shimmer 1.6s ease-in-out infinite;
  background-size: 200% 100%;
  background-image: linear-gradient(
    90deg,
    var(--bg-muted) 25%,
    var(--bg-card) 50%,
    var(--bg-muted) 75%
  );
}
.option-card-img.lazy-img[data-src] {
  /* Still waiting: show shimmer */
}
.option-card-img.lazy-loaded,
.option-card-img:not([data-src]) {
  /* Loaded: stop shimmer, fade in */
  animation: none;
  background-image: none;
  transition: opacity 0.3s ease;
}
.option-card-img.img-error {
  animation: none;
  background: var(--bg-muted);
  min-height: 48px;
}
@keyframes lazy-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- Context Menu ---- */
.img-context-menu {
  position: fixed;
  z-index: 9000;
  min-width: 176px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
  padding: 0.25rem 0;
  opacity: 0;
  transform: scale(0.94) translateY(-4px);
  transform-origin: top left;
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}
.img-context-menu.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}
.ctx-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fg);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
}
.ctx-menu-item:hover {
  background: var(--bg-muted);
  color: var(--primary);
}
.ctx-menu-item svg {
  flex-shrink: 0;
  color: var(--fg-muted);
}
.ctx-menu-item:hover svg {
  color: var(--primary);
}

/* ---- Lightbox Overlay ---- */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 9100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.lightbox-overlay.lightbox-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Backdrop */
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Box */
.lightbox-box {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  border: 2px solid var(--border);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.28s cubic-bezier(0.34, 1.26, 0.64, 1);
}
.lightbox-overlay.lightbox-visible .lightbox-box {
  transform: translateY(0) scale(1);
}

/* Header */
.lightbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  border-bottom: 2px solid var(--border);
  flex-shrink: 0;
  gap: 0.75rem;
}
.lightbox-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.lightbox-title {
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lightbox-close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: transparent;
  border: 2px solid var(--border);
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.lightbox-close:hover {
  background: var(--bg-muted);
  border-color: var(--border-hover);
  color: var(--fg);
}
.lightbox-close:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Image area */
.lightbox-img-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  background: var(--bg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.lightbox-img {
  display: block;
  max-width: 100%;
  max-height: 58vh;
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.lightbox-img.lightbox-img-loaded {
  opacity: 1;
}
.lightbox-img-error {
  padding: 2rem;
  color: var(--fg-muted);
  font-size: 0.875rem;
  font-style: italic;
}

/* Spinner */
.lightbox-spinner {
  position: absolute;
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: lightbox-spin 0.7s linear infinite;
}
@keyframes lightbox-spin {
  to { transform: rotate(360deg); }
}

/* Description */
.lightbox-desc {
  padding: 0.625rem 1rem;
  font-size: 0.8125rem;
  color: var(--fg-muted);
  border-top: 1px solid var(--border);
  line-height: 1.5;
  flex-shrink: 0;
}

/* Footer */
.lightbox-footer {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 2px solid var(--border);
  flex-shrink: 0;
  justify-content: flex-end;
}
.lightbox-footer .btn {
  min-width: 90px;
}

/* Mobile adjustments */
@media (max-width: 640px) {
  .lightbox-box {
    max-width: 100%;
    max-height: 95vh;
  }
  .lightbox-img {
    max-height: 45vh;
  }
  .lightbox-footer {
    flex-direction: column-reverse;
  }
  .lightbox-footer .btn {
    width: 100%;
  }
}
