/* Design Suite - Color Studio Stylesheet */

:root {
  /* Fonts */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  /* Transitions */
  --transition-fast: 0.12s ease;
  --transition-normal: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Light Theme Variables */
  --bg-color: #f6f6f7;
  --panel-bg: #ffffff;
  --panel-border: #e2e2e5;
  --text-primary: #1c1c1e;
  --text-secondary: #6e6e73;
  --text-muted: #aeaeb2;
  --accent-color: #000000;
  --accent-hover: #262626;
  --accent-bg-subtle: #f2f2f7;
  --grid-dot: #e2e2e5;
  --input-focus-ring: rgba(0, 0, 0, 0.05);
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
  /* Dark Theme Variables */
  --bg-color: #0d0d0f;
  --panel-bg: #1a1a1e;
  --panel-border: #2c2c2e;
  --text-primary: #f5f5f7;
  --text-secondary: #8e8e93;
  --text-muted: #48484a;
  --accent-color: #ffffff;
  --accent-hover: #d1d1d6;
  --accent-bg-subtle: #2c2c2e;
  --grid-dot: #222225;
  --input-focus-ring: rgba(255, 255, 255, 0.05);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

.app-container {
  display: flex;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

/* Left Toolbar Dock */
.left-toolbar {
  width: 56px;
  height: 100%;
  background-color: var(--panel-bg);
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  gap: 12px;
  z-index: 10;
  flex-shrink: 0;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.toolbar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 8px;
}

.toolbar-divider {
  width: 24px;
  height: 1px;
  background-color: var(--panel-border);
  margin: 4px 0;
  flex-shrink: 0;
}

.logo-icon {
  width: 36px;
  height: 36px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--accent-color);
}

.logo-icon svg {
  width: 22px;
  height: 22px;
}

.tool-btn {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all var(--transition-fast);
  padding: 0;
}

.tool-btn svg {
  width: 18px;
  height: 18px;
}

.tool-btn:hover {
  background-color: var(--accent-bg-subtle);
  color: var(--text-primary);
}

/* Tooltips */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: auto;
  left: 125%;
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background-color: var(--text-primary);
  color: var(--panel-bg);
  font-size: 10px;
  font-weight: 500;
  padding: 5px 9px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-fast);
  z-index: 100;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--panel-border);
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* Main Workspace Area */
.canvas-container {
  flex: 1;
  height: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.canvas-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-color);
  background-image: radial-gradient(var(--grid-dot) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  z-index: 1;
}

.workspace-viewport {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  padding: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.workspace-panel {
  display: none;
  width: 100%;
  height: 100%;
  justify-content: center;
  align-items: center;
}

.workspace-panel.active {
  display: flex;
}

.export-display-card {
  width: 100%;
  max-width: 720px;
  padding: clamp(24px, 5vw, 48px);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  background: linear-gradient(145deg, var(--panel-bg), var(--accent-bg-subtle));
  box-shadow: var(--shadow-lg);
}

.export-display-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.export-display-kicker {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font: 700 10px/1 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.export-display-header h2 {
  color: var(--text-primary);
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.export-display-badge {
  flex-shrink: 0;
  padding: 6px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  color: var(--text-secondary);
  font: 600 10px/1 var(--font-mono);
  text-transform: uppercase;
}

.export-swatch-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  min-height: 112px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel-bg);
}

.export-preview-swatch {
  min-height: 112px;
  border-right: 1px solid rgba(255, 255, 255, 0.35);
}

.export-preview-swatch:last-child {
  border-right: 0;
}

.export-display-note {
  max-width: 580px;
  margin-top: 22px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.65;
}

/* Harmony Palette Display Card */
.harmony-display-card {
  width: 100%;
  max-width: 640px;
  background-color: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.harmony-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 12px;
}

.harmony-mode-title {
  font-size: 14px;
  font-family: var(--font-sans);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* Swatches Layout */
.swatches-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.swatch-card {
  flex: 1;
  height: 160px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  background-color: var(--panel-bg);
}

.swatch-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.swatch-color-box {
  flex: 1;
  width: 100%;
}

.swatch-info {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.swatch-hex {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
}

.swatch-name {
  font-size: 9px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Shades & Variations Layout */
.shades-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--panel-border);
  padding-top: 16px;
}

.section-subtitle {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.shades-row {
  display: flex;
  gap: 6px;
  width: 100%;
}

.shade-chip {
  flex: 1;
  height: 32px;
  border-radius: 4px;
  border: 1px solid var(--panel-border);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  font-family: var(--font-mono);
  font-size: 8px;
  color: transparent;
  font-weight: bold;
  transition: all var(--transition-fast);
}

.shade-chip:hover {
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  transform: scale(1.05);
}

/* Contrast Layout */
.contrast-layout {
  display: flex;
  gap: 24px;
  width: 100%;
  max-width: 680px;
  align-items: stretch;
}

/* Mockup preview card */
.mockup-preview-card {
  flex: 1.2;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mockup-header {
  padding: 10px 16px;
  background-color: rgba(0, 0, 0, 0.03);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.mockup-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.15);
}

.mockup-title {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  text-transform: uppercase;
}

.mockup-body {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mockup-body h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.mockup-body p {
  font-size: 13px;
  line-height: 1.6;
}

/* Contrast diagnostics card */
.contrast-results-card {
  flex: 0.8;
  background-color: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.result-score-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.score-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 4px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: var(--accent-bg-subtle);
}

.score-ratio {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.score-lbl {
  font-size: 9px;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: bold;
}

.compliance-badges {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.badge-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background-color: var(--accent-bg-subtle);
  border-radius: 6px;
  border: 1px solid var(--panel-border);
}

.badge-title {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.badge-status {
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: bold;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
}

.badge-status.status-pass {
  background-color: rgba(22, 163, 74, 0.1);
  color: #16a34a;
}

.badge-status.status-fail {
  background-color: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

.contrast-alert-box {
  font-size: 11px;
  line-height: 1.5;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background-color: var(--accent-bg-subtle);
  color: var(--text-secondary);
}

/* Right Sidebar Inspector */
.right-sidebar {
  width: 320px;
  height: 100%;
  background-color: var(--panel-bg);
  border-left: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

/* Sidebar Tab Headers */
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--panel-border);
  background-color: var(--panel-bg);
  flex-shrink: 0;
}

.tab-btn {
  flex: 1;
  padding: 14px 2px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
}

.tab-btn svg {
  width: 14px;
  height: 14px;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--text-primary);
  border-bottom-color: var(--text-primary);
}

/* Tab Contents */
.sidebar-tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.sidebar-tab-content::-webkit-scrollbar {
  width: 5px;
}
.sidebar-tab-content::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-tab-content::-webkit-scrollbar-thumb {
  background: var(--panel-border);
  border-radius: 3px;
}

.sidebar-tab-content.active {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Section Title */
.input-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 12px;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 6px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-field-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-field-wrapper label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.text-input {
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  font-family: var(--font-sans);
  background-color: var(--accent-bg-subtle);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
}

.text-input:focus {
  border-color: var(--text-primary);
  background-color: var(--panel-bg);
  box-shadow: 0 0 0 3px var(--input-focus-ring);
}

select.text-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%236e6e73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 32px;
}

/* Checkbox and Toggles */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 0;
}

.checkbox-label {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
  user-select: none;
}

/* Custom iOS Switch */
.switch-container {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
  flex-shrink: 0;
}

.switch-container input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--panel-border);
  transition: var(--transition-fast);
  border-radius: 20px;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: #ffffff;
  transition: var(--transition-fast);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

input:checked + .switch-slider {
  background-color: var(--text-primary);
}

input:checked + .switch-slider:before {
  transform: translateX(14px);
}

/* Color Pickers */
.color-picker-container {
  display: flex;
  gap: 8px;
  position: relative;
  align-items: center;
}

.color-picker-container input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  background: none;
  flex-shrink: 0;
}

.color-picker-container input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker-container input[type="color"]::-webkit-color-swatch {
  border: 1px solid var(--panel-border);
  border-radius: 6px;
}

/* Buttons */
.action-btn {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--accent-color);
  color: var(--panel-bg);
  border: 1px solid var(--accent-color);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all var(--transition-fast);
}

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

.action-btn.secondary {
  background-color: transparent;
  color: var(--text-primary);
  border-color: var(--panel-border);
}

.action-btn.secondary:hover {
  background-color: var(--accent-bg-subtle);
  border-color: var(--text-primary);
}

/* Toast */
.app-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: var(--text-primary);
  color: var(--panel-bg);
  font-size: 12px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 30px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.app-toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── Floating Navigation Pill ── */
.nav-pill {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 30px;
  padding: 5px 8px 5px 12px;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
  opacity: 0.75;
  pointer-events: auto;
  backdrop-filter: blur(8px);
}

.nav-pill:hover {
  opacity: 1;
  box-shadow: var(--shadow-lg);
}

.nav-pill-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  user-select: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-pill-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 20px;
  border: none;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
}

.nav-pill-btn svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.nav-pill-btn.back-hub {
  background-color: var(--accent-bg-subtle);
  color: var(--text-primary);
}

.nav-pill-btn.back-hub:hover {
  background-color: var(--text-primary);
  color: var(--panel-bg);
}

.nav-pill-btn.open-standalone {
  background-color: var(--accent-color);
  color: var(--panel-bg);
}

.nav-pill-btn.open-standalone:hover {
  background-color: var(--accent-hover);
}

/* ── Mobile Toggle Buttons ── */
.mobile-toggle-btn {
  display: none;
  position: absolute;
  top: 16px;
  z-index: 99;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-toggle-btn:hover {
  background-color: var(--accent-bg-subtle);
}

.mobile-toggle-btn.left-toggle {
  left: 16px;
}

.mobile-toggle-btn.right-toggle {
  right: 16px;
}

.sidebar-overlay {
  display: none;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0, 0, 0, 0.3);
  z-index: 90;
}

/* ── Responsive breakpoints ── */
@media (max-width: 768px) {
  .mobile-toggle-btn {
    display: flex;
  }

  .left-toolbar {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    box-shadow: none;
  }

  .left-toolbar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .right-sidebar {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    transform: translateX(100%);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    box-shadow: none;
  }

  .right-sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .nav-pill {
    top: 10px;
    left: auto;
    right: 10px;
    transform: none;
    padding: 4px 6px 4px 8px;
  }

  .nav-pill-label {
    display: none;
  }

  .nav-pill-btn {
    font-size: 10px;
    padding: 4px 8px;
  }
}
