/* ==========================================================================
   Adobe Color & Adobe Express Replicated Theme & Layout
   ========================================================================== */

:root {
  --rooster-yellow: #FFD500;
  --bg-app: #121214;
  --bg-surface: #1e1e24;
  --bg-surface-elevated: #282832;
  --bg-input: #151518;
  --border-color: #34343e;
  --border-active: #ffffff;
  --border-focus: #3b82f6;

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --icon-ring: rgba(255, 255, 255, 0.22);
  --icon-line: rgba(255, 255, 255, 0.88);
  --icon-dot: #ffffff;

  --accent-blue: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --success: #10b981;

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Overrides */
body.light-theme {
  --bg-app: #f5f6f8;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ebeef2;
  --bg-input: #e2e5e9;
  --border-color: #d1d5db;
  --border-active: #111827;
  --border-focus: #2563eb;

  --text-main: #111827;
  --text-muted: #4b5563;
  --text-dim: #9ca3af;

  --icon-ring: rgba(0, 0, 0, 0.15);
  --icon-line: rgba(0, 0, 0, 0.8);
  --icon-dot: #111827;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* ==========================================================================
   Header Navigation
   ========================================================================== */
.app-header {
  height: 46px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(0,0,0,0.3);
}

.brand-icon-inner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-surface);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--rooster-yellow, #FFD500);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

body.light-theme .brand-title {
  color: #b45309;
  text-shadow: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface-elevated);
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
}

.btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: var(--text-muted);
}

.btn-primary {
  background-color: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
}

/* ==========================================================================
   Swatch Lock Padlock Button
   ========================================================================== */
.btn-lock-swatch {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  opacity: 0.65;
  z-index: 10;
}

.tall-swatch-column:hover .btn-lock-swatch {
  opacity: 1;
}

.btn-lock-swatch:hover {
  background: rgba(0, 0, 0, 0.85);
  transform: scale(1.1);
}

.btn-lock-swatch.locked {
  opacity: 1;
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
}

/* ==========================================================================
   Global Adjustments Popover Dropdown
   ========================================================================== */
.popover-container {
  position: relative;
}

.global-adjust-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-lg);
  width: 320px;
  z-index: 80;
  display: none;
  flex-direction: column;
  gap: 14px;
}

.global-adjust-dropdown.open {
  display: flex;
  animation: slideInDown 0.2s ease forwards;
}

@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.adjust-slider-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.adjust-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.adjust-range {
  width: 100%;
  accent-color: var(--accent-blue);
  cursor: pointer;
}

/* ==========================================================================
   Slide-Over Drawer (Biblioteca de Paletas Guardadas)
   ========================================================================== */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 440px;
  max-width: 90vw;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer-backdrop.active .drawer-panel {
  transform: translateX(0);
}

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  flex: 1;
}

.save-current-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.save-input-row {
  display: flex;
  gap: 8px;
}

.save-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 8px 12px;
  font-size: 0.88rem;
  outline: none;
}

.save-input:focus {
  border-color: var(--accent-blue);
}

.saved-palettes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.saved-palette-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: var(--transition);
}

.saved-palette-card:hover {
  border-color: var(--text-muted);
}

.saved-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.saved-card-name {
  font-weight: 700;
  font-size: 0.9rem;
}

.saved-card-meta {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.saved-card-strip {
  display: flex;
  height: 28px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.saved-strip-item {
  flex: 1;
  height: 100%;
}

.saved-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ==========================================================================
   VIEW 3: UI Mockup Preview
   ========================================================================== */
.preview-view-container {
  display: none;
  flex-direction: column;
  gap: 20px;
  max-width: 1540px;
  width: 100%;
  margin: 12px auto;
  padding: 0 24px 24px;
  flex: 1;
}

.preview-view-container.active {
  display: flex;
}

.mockup-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 12px;
}

.mockup-frame {
  background: #ffffff;
  color: #111827;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 540px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.mockup-window-header {
  height: 38px;
  background: rgba(0, 0, 0, 0.05);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
}

.window-dots {
  display: flex;
  gap: 6px;
}

.window-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #cbd5e1;
}

.mockup-navbar {
  height: 60px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.mockup-brand {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.mockup-nav-links {
  display: flex;
  gap: 24px;
  font-size: 0.88rem;
  font-weight: 600;
  opacity: 0.8;
}

.mockup-hero {
  padding: 60px 32px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  max-width: 800px;
  margin: 0 auto;
}

.mockup-badge {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mockup-headline {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.mockup-subtext {
  font-size: 1.05rem;
  line-height: 1.6;
  opacity: 0.75;
  max-width: 600px;
}

.mockup-cta-row {
  display: flex;
  gap: 14px;
  margin-top: 10px;
}

.mockup-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 30px 32px 50px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.mockup-card-item {
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.mockup-card-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid currentColor;
  background: rgba(0, 0, 0, 0.04);
  margin-bottom: 2px;
}

.mockup-card-svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ==========================================================================
   VIEW 4: Accessibility & Color Blindness Matrix
   ========================================================================== */
.accessibility-view-container {
  display: none;
  flex-direction: column;
  gap: 20px;
  max-width: 1540px;
  width: 100%;
  margin: 12px auto;
  padding: 0 24px 24px;
  flex: 1;
}

.accessibility-view-container.active {
  display: flex;
}

.accessibility-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.blindness-row-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.blindness-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.blindness-title {
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.blindness-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.blindness-strip-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.blindness-swatch-box {
  height: 65px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-end;
  padding: 8px;
  font-family: monospace;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid rgba(0, 0, 0, 0.15);
  box-shadow: var(--shadow-sm);
}

/* WCAG Matrix Table */
.contrast-matrix-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.matrix-table th, .matrix-table td {
  padding: 10px 12px;
  text-align: center;
  border: 1px solid var(--border-color);
}

.matrix-table th {
  background: var(--bg-surface-elevated);
  font-weight: 700;
}

/* ==========================================================================
   VIEW 5: CSS Gradients Generator
   ========================================================================== */
.gradients-view-container {
  display: none;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  max-width: 1540px;
  width: 100%;
  margin: 12px auto;
  padding: 0 24px 24px;
  flex: 1;
}

.gradients-view-container.active {
  display: grid;
}

.gradient-canvas-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.gradient-preview-screen {
  flex: 1;
  min-height: 400px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  transition: background 0.2s ease;
}

.gradient-settings-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gradient-stops-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.grad-stop-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.grad-stop-pill.active {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.15);
}

.grad-stop-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.btn-svg-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.badge-svg-icon {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.intro-hero {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.intro-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--rooster-yellow, #ffd500);
  background: rgba(255, 213, 0, 0.12);
  padding: 3px 9px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 213, 0, 0.25);
  width: fit-content;
}

.intro-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.25;
  color: var(--text-main);
}

.intro-desc {
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.mode-navigation-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 6px;
}

.tool-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.tool-tab-btn:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.08);
}

.tool-tab-btn.active {
  color: #ffffff;
  background-color: var(--accent-blue);
  border-color: var(--accent-blue);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

/* ==========================================================================
   Main Studio Layout
   ========================================================================== */
.app-container {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 24px;
  max-width: 1600px;
  width: 100%;
  margin: 12px auto;
  padding: 0 24px 24px;
  box-sizing: border-box;
}

/* Left Panel: Color Wheel & Harmony Carousel */
.wheel-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wheel-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px 18px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.wheel-canvas-wrapper {
  position: relative;
  width: 330px;
  height: 330px;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

#colorWheelCanvas {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  touch-action: none;
  cursor: default;
}

/* Sliders below wheel */
.wheel-quick-controls {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-surface-elevated);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-label {
  color: var(--text-muted);
  font-weight: 500;
}

.control-slider {
  accent-color: var(--accent-blue);
  cursor: pointer;
  width: 90px;
}

/* ==========================================================================
   Horizontal Harmony Rules Carousel (Matching Image 1 & 2)
   ========================================================================== */
.harmony-section {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.harmony-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.harmony-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.harmony-current-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-blue);
}

.harmony-carousel-container {
  display: flex;
  align-items: center;
  position: relative;
  gap: 6px;
}

.carousel-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 0.85rem;
  transition: var(--transition);
}

.carousel-btn:hover {
  background: var(--border-color);
}

.harmony-track {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 4px 2px;
}

.harmony-track::-webkit-scrollbar {
  display: none;
}

/* Lineart SVG Harmony Button */
.harmony-btn {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1.5px solid transparent;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
  position: relative;
  padding: 4px;
}

.harmony-btn:hover {
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.08);
}

body.light-theme .harmony-btn:hover {
  border-color: rgba(0, 0, 0, 0.35);
  background: rgba(0, 0, 0, 0.06);
}

.harmony-btn.active {
  background: var(--bg-surface);
  border-color: var(--border-active);
  box-shadow: 0 0 0 1px var(--border-active), var(--shadow-sm);
}

/* SVG Lineart inside button */
.harmony-svg {
  width: 32px;
  height: 32px;
  overflow: visible;
}

.harmony-svg .ring {
  stroke: var(--icon-ring);
  stroke-width: 2.2;
  fill: none;
}

.harmony-svg .line {
  stroke: var(--icon-line);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.harmony-svg .dot {
  fill: var(--icon-dot);
}

.harmony-btn.active .harmony-svg .line {
  stroke: var(--text-main);
  stroke-width: 2.2;
}

.harmony-btn.active .harmony-svg .dot {
  fill: var(--accent-blue);
}

/* Tooltip on hover */
.harmony-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 60;
  box-shadow: var(--shadow-md);
  border: 1px solid #374151;
}

.harmony-btn:hover .harmony-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

/* ==========================================================================
   Right Panel: Tall Vertical Swatches Palette (Matching Image 1)
   ========================================================================== */
.palette-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 520px;
}

.palette-swatches-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  flex: 1;
  min-height: 480px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
}

.tall-swatch-column {
  display: flex;
  flex-direction: column;
  position: relative;
  transition: var(--transition);
  cursor: pointer;
}

.tall-swatch-color {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 12px;
  transition: background-color 0.15s ease;
}

/* Base color marker badge */
.tall-base-badge {
  align-self: flex-start;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-make-base {
  align-self: flex-start;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  border: none;
  color: #ffffff;
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: var(--radius-full);
  cursor: pointer;
  opacity: 0;
  transform: translateY(-4px);
  transition: var(--transition);
}

.tall-swatch-column:hover .btn-make-base {
  opacity: 1;
  transform: translateY(0);
}

.btn-make-base:hover {
  background: rgba(0, 0, 0, 0.8);
}

/* Bottom footer of each swatch */
.tall-swatch-footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  margin-top: auto;
}

.hex-text-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.hex-code-input {
  background: transparent;
  border: 1px solid transparent;
  color: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92rem;
  font-weight: 700;
  text-transform: uppercase;
  width: 80px;
  padding: 2px 4px;
  border-radius: 4px;
}

.hex-code-input:focus {
  outline: none;
  background: rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.4);
}

.copy-mini-btn {
  background: transparent;
  border: none;
  color: inherit;
  opacity: 0.75;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 0.85rem;
  transition: var(--transition);
}

.copy-mini-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.2);
}

/* Sliders drawer toggle */
.btn-toggle-sliders {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 0.72rem;
  opacity: 0.8;
  cursor: pointer;
  text-align: left;
  padding: 2px 0;
}

.btn-toggle-sliders:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Mini sliders embedded inside swatch */
.swatch-sliders-panel {
  display: none;
  flex-direction: column;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.swatch-sliders-panel.open {
  display: flex;
}

.mini-slider-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
}

.mini-slider-row label {
  width: 12px;
  font-weight: 700;
}

.mini-slider-row input[type="range"] {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  outline: none;
}

.mini-slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
}

/* Bottom Palette Action Bar (Matching Image 1) */
.palette-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  box-shadow: var(--shadow-sm);
}

.palette-preview-strip {
  display: flex;
  height: 24px;
  width: 130px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.strip-item {
  flex: 1;
  height: 100%;
}

.palette-bottom-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ==========================================================================
   Image Palette Extractor View (Matching Adobe Extract Theme)
   ========================================================================== */
.extractor-view-container {
  display: none;
  grid-template-columns: 1fr 400px;
  gap: 24px;
  max-width: 1540px;
  width: 100%;
  margin: 12px auto;
  padding: 0 24px 24px;
  flex: 1;
}

.extractor-view-container.active {
  display: grid;
}

.app-container.hidden {
  display: none;
}

.extractor-wrapper {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.extractor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.mood-selector {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mood-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.mood-buttons {
  display: flex;
  gap: 6px;
}

.mood-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.mood-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.mood-btn.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #ffffff;
}

.upload-label {
  cursor: pointer;
}

/* Image Stage */
.image-stage {
  position: relative;
  min-height: 420px;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  overflow: hidden;
  transition: var(--transition);
}

.image-stage.drag-active {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.08);
}

.drop-zone-placeholder {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 30px;
}

.drop-icon {
  font-size: 3rem;
  margin-bottom: 6px;
}

.drop-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}

.drop-subtext {
  font-size: 0.82rem;
  color: var(--text-dim);
}

.image-display-container {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.extracted-img {
  max-width: 100%;
  max-height: 520px;
  display: block;
  border-radius: var(--radius-sm);
  user-select: none;
  -webkit-user-drag: none;
}

/* Draggable Pins on Image */
.pins-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.image-pin {
  position: absolute;
  top: 0;
  left: 0;
  width: 32px;
  height: 32px;
  margin-left: -16px;
  margin-top: -16px;
  pointer-events: auto;
  cursor: grab;
  z-index: 10;
  transition: transform 0.05s ease-out;
}

.image-pin:active {
  cursor: grabbing;
  z-index: 20;
}

.pin-ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}

.image-pin:hover .pin-ring {
  transform: scale(1.15);
}

.pin-number {
  font-size: 0.75rem;
  font-weight: 800;
}

/* Extractor Side Panel */
.extractor-side-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.extractor-actions-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.extractor-actions-card h3 {
  font-size: 1rem;
  font-weight: 700;
}

.extractor-actions-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ==========================================================================
   Modals & Toast Notifications
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-window {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 580px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s ease;
}

.modal-backdrop.active .modal-window {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 70vh;
  overflow-y: auto;
}

.export-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.export-tab {
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.export-tab.active {
  background: var(--bg-surface-elevated);
  color: var(--accent-blue);
}

.export-code-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
  color: var(--text-main);
  white-space: pre-wrap;
  user-select: text;
  max-height: 220px;
  overflow-y: auto;
}

/* Toast alert */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: #111827;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 4px solid var(--accent-blue);
  animation: slideInUp 0.25s ease forwards;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 1100px) {
  .app-container, .extractor-view-container {
    grid-template-columns: 1fr;
  }
  .palette-swatches-grid {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .tall-swatch-column {
    min-height: 110px;
  }
}
