:root {
  /* Backgrounds */
  --bg-primary: #F4F2EC;
  --bg-secondary: #ECEAE1;
  --bg-elevated: #FAFAF7;

  /* Text */
  --text-primary: #111110;
  --text-secondary: #6B6860;
  --text-tertiary: #A9A59E;

  /* Accent */
  --accent: #C4622D;
  --accent-muted: #EDD5C4;

  /* Borders */
  --border: #D6D2C8;
  --input-border: #D6D2C8;
  --border-strong: #111110;

  /* Workspace specific */
  --workspace-bg: #A9A59E;
  --workspace-label: #242320;
  --modal-overlay: rgba(17, 17, 16, 0.8);
}

[data-theme="dark"] {
  /* Backgrounds */
  --bg-primary: #111110;
  --bg-secondary: #1B1A17;
  --bg-elevated: #242320;

  /* Text */
  --text-primary: #F0EDE5;
  --text-secondary: #87847D;
  --text-tertiary: #57544E;

  /* Accent */
  --accent: #D4724A;
  --accent-muted: #271A12;

  /* Borders */
  --border: #2A2924;
  --input-border: #D6D2C8;
  --border-strong: #F0EDE5;

  /* Workspace specific */
  --workspace-bg: #A9A59E;
  --workspace-label: #242320;
  --modal-overlay: rgba(17, 17, 16, 0.9);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg-primary: #111110;
    --bg-secondary: #1B1A17;
    --bg-elevated: #242320;
    --text-primary: #F0EDE5;
    --text-secondary: #87847D;
    --text-tertiary: #57544E;
    --accent: #D4724A;
    --accent-muted: #271A12;
    --border: #2A2924;
    --border-strong: #F0EDE5;
    --workspace-bg: #A9A59E;
    --workspace-label: #242320;
    --modal-overlay: rgba(17, 17, 16, 0.9);
  }
}

/* Base reset and typography */
* {
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
  box-sizing: border-box;
}

body {
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  line-height: 1.75;
  margin: 0;
  padding: 20px;
  background: var(--bg-primary);
  color: var(--text-primary);
}

/* Typography hierarchy */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.15;
  margin: 0;
  color: var(--text-primary);
}

h1 {
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 3.5rem);
  letter-spacing: -0.02em;
  line-height: 0.95;
}

h2 {
  font-size: clamp(1.25rem, 2.5vw, 2rem);
  line-height: 1.05;
}

h3 {
  font-size: clamp(1rem, 2vw, 1.5rem);
}

/* Top-right toggles */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  padding: 10px 22px;
  background: var(--bg-primary);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  cursor: pointer;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: all 150ms ease;
}

.theme-toggle:hover {
  background: var(--text-primary);
  color: var(--bg-primary);
}

.workspace-toggle {
  position: fixed;
  top: 20px;
  right: 80px; /* Position to the left of theme toggle */
  z-index: 10000;
  padding: 10px 16px;
  margin: 4px 4px;
  height: 40px;
  border: 1px solid var(--border-strong);
    background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: all 150ms ease;
  vertical-align: center;
}

.workspace-toggle:hover {
  background: var(--text-primary);
  color: var(--bg-primary);
}

/* Layout containers */
.container {
  max-width: 1500px;
  margin: 0 auto;
  height: 100vh;
  overflow: hidden;
}

.content-with-sidebars {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 24px;
  height: 100%;
}

.content-with-sidebars > * {
  max-width: 50%;
  padding: 16px;
  overflow-y: auto;
}

/* Workspace container - fixed, no scroll */
#workspaceContainer {
  overflow-y: visible !important;
}

/* Grid container - scrollable left sidebar */
#gridContainer {
  max-height: 100vh;
  overflow-y: auto;
  padding-right: 8px; /* Space for scrollbar */
}

@media (min-width: 768px) {
  .content-with-sidebars > * {
    width: 50%;
  }
  .content-with-sidebars > *:nth-child(1) {
    width: 100%;
  }
}

@media (min-width: 1024px) {
  .content-with-sidebars > * {
    width: 50%;
  }
  .content-with-sidebars > *:nth-child(1) {
    width: 25%;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    padding: 16px;
  }
}

/* Sidebar */
#sidebar {
  max-width: 25%;
  max-height: 100vh;
  overflow-y: auto;
  padding-right: 8px; /* Space for scrollbar */
 margin-top:20px;
}

.sticky {
  position: sticky;
  background: var(--bg-elevated);
  padding: 16px 8px 8px 8px;
  z-index: 1000;
  border: 1px solid var(--border);
  max-height: calc(100vh - 40px); /* Account for top offset */
  overflow-y: auto;
}

#workspaceContainer.sticky {
  align-self: flex-start;
  position: sticky;
  top: 20px;
  overflow-y: visible;
  max-height: none;
}

#sidebar.sticky {
  align-self: flex-start;
}

.sidebar.collapsed {
  width: 40px !important;
  min-width: 40px !important;
  overflow: hidden;
}

.sidebar.collapsed > div:not(.sidebar-toggle-container) {
  display: none;
}

/* Controls and inputs */
.right-controls {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.search-bar {
  padding: 12px 16px;
  margin-bottom: 16px;
  display: inline-block;
  border: 1px solid var(--input-border);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  font-size: 0.9rem;
}

.search-bar:focus {
  outline: none;
  border-color: var(--border-strong);
}

.search-bar::placeholder {
  color: var(--text-secondary);
}

input[type="range"] {
  width: 80%;
  margin: 8px 0;
}

input[type="color"] {
  padding: 4px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
}

input[type="checkbox"] {
  margin-right: 8px;
}

/* Buttons */
button {
  margin: 4px 0;
  height: 40px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: all 150ms ease;
  vertical-align: center;
}

button:hover {
  background: var(--text-primary);
  color: var(--bg-primary);
}

button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #FAFAF7;
}

button.clear {
  background: var(--accent);
  border-color: var(--accent);
  color: #FAFAF7;
  margin-top: 16px;
}

button.fullscreen {
    background: var(--accent);
  border-color: var(--accent);
  color: #FAFAF7;
  margin-top: 16px;
}

button.clear:hover {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: var(--bg-primary);
}

.ctrl-btn {
  padding: 6px 12px;
  font-size: 0.72rem;
  vertical-align: top;
 justify-content: center
}

.current-zoom {
  padding: 6px 12px;
  font-size: 0.65rem;
  font-family: 'DM Mono', monospace;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.current-zoom {
    font-size: 0.85rem;
}

.sidebar-toggle {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
}

/* Different styling when in fullscreen mode */
.sidebar-toggle.fullscreen-exit {
  background: var(--accent);
  color: #FAFAF7;
  border-color: var(--accent);
}

/* Options and filters */
.options {
  display: flex;
  justify-content: flex-start;
  flex-direction: column;
}

.options h2 {
  color: var(--text-secondary);
  font-family: 'Syne', sans-serif;
  font-size: clamp(0.8rem, 3vw, 1.3rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.filters {
  margin-left: 16px;
  display: flex;
  flex-direction: column;
}

.color-filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.color-filters label {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* View controls */
.view-bar {
  display: flex;
  flex-direction: row;
  gap: 8px;
  margin-top: 16px;
  justify-content: space-between;
  align-items: flex-end;
}

/* Workspace controls */
.workspace-controls {
  display: flex;
  flex-direction: row;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.workspace-controls button {
  font-size: 0.72rem;
  padding: 6px 10px;
  margin: 0;
}

.workspace-controls button:disabled {
  background: var(--bg-secondary);
  border-color: var(--border);
  color: var(--text-tertiary);
  cursor: not-allowed;
}

.workspace-controls button:disabled:hover {
  background: var(--bg-secondary);
  color: var(--text-tertiary);
}

/* Loading state for PNG export */
.workspace.capturing {
  position: relative;
}

.workspace.capturing::after {
  content: 'Capturing High-Res PNG...';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--accent);
  color: #FAFAF7;
  padding: 12px 20px;
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  z-index: 10000;
  pointer-events: none;
  border: 1px solid var(--accent);
}

/* Image grid */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 16px;
  margin-top: 24px;
  padding: 0;
}

.image-card {
  text-align: center;
  cursor: grab;
  position: relative;
  background: var(--bg-elevated);
  padding: 12px;
  border: 1px solid var(--border);
  transition: border-color 150ms ease;
}

.image-card:hover {
  border-color: var(--accent);
}

.image-card img {
  width: 100%;
  min-height: 100px;
  height: auto;
  max-height: 150px;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.swatches {
  margin: 4px 0;
  display: flex;
  justify-content: center;
  gap: 4px;
}

.image-card > div:last-child {
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  line-height: 0.9rem;
  color: var(--text-secondary);
  margin-top: 8px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.image-card > div:last-child:hover {
  color: var(--accent);
}

/* Workspace */
.workspace {
  border: 2px solid var(--border-strong);
  aspect-ratio: 33 / 25;
  width: 100%;
  background: var(--workspace-bg);
  position: relative;
  overflow: hidden;
  height: auto;
  user-select: none;
  padding:0;
}

.workspace span, #workspaceLabel {
  font-family: 'Syne', sans-serif;
  font-weight: 900;
  font-style: normal;
  font-size: min(120vw, 1400px);
  color: var(--workspace-label);
  position: absolute;
  line-height: 0.95;
  letter-spacing: -0.05em;
  text-transform: uppercase;
 
}

#workspaceLabel {
  font-family: "Public Sans", serif;
   font-size: min(150vw, 1400px);
   margin-left: 20%;
}


.workspace-card {
  text-align: center;
  cursor: grab;
  position: relative;
}

.workspace-card:hover {
  border-color: var(--accent);
}

.workspace-card img {
  min-width: 50px;
  min-height: 50px;
  height: auto;
  max-height: 50px;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

/* Collapsed sidebar states */
.content-with-sidebars.sidebar-collapsed > *:nth-child(1) {
  width: 100% !important;
  max-width: 100% !important;
}

#sidebar.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  overflow: visible;
}

#sidebar.collapsed .sidebar {
  display: none !important;
}

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--modal-overlay);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--bg-elevated);
  padding: 32px;
  border: 1px solid var(--border);
  max-height: 80%;
  max-width: 80%;
  overflow: auto;
  color: var(--text-primary);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

th, td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--bg-secondary);
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
}

td {
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
}

/* Status and messaging */
.result-count {
  padding-top: 50px;
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* Decade dropdown */
.decade-dropdown-container {
  margin: 12px 0;
}

.decade-dropdown {
  width: 100%;
  min-height: 120px;
  padding: 8px 12px;
  border: 1px solid var(--input-border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: .9rem
  outline: none;
  overflow-y: auto;
}

.decade-dropdown:focus {
  border-color: var(--border-strong);
}

.decade-dropdown option {
  padding: 6px 4px;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: none;
  cursor: pointer;
  transition: all 150ms ease;
}

.decade-dropdown option:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.decade-dropdown option:checked {
  background: var(--accent);
  color: #FAFAF7;
}

/* Firefox-specific styling */
.decade-dropdown option:checked {
  background: var(--accent) !important;
  color: #FAFAF7 !important;
}

.decade-controls {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.decade-btn {
  flex: 1;
  padding: 6px 12px;
  font-size: 0.65rem;
  margin: 0;
}

/* Vue transitions */
.fade-enter-active, .fade-leave-active {
  transition: opacity 150ms ease;
}

.fade-enter-from, .fade-leave-to {
  opacity: 0;
}

/* Loading and error states */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.error {
  color: var(--accent);
  padding: 20px;
  text-align: center;
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.start-message {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
  font-family: 'Syne', sans-serif;
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

/* Utility classes */
.highlight {
  background-color: var(--accent-muted);
  padding: 2px 4px;
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
}