/* Add at the top to test if CSS is loading */
body {
  /*background: #f1eeea;
  font-family: var(--font-family);*/
}

/* Basic reset */
html,
body {
 /* margin: 0;
  padding: 0;*/
}

canvas {
  display: block;
  margin-top: -50px; /* Move grid up */
  background-color: #f1eeea; /* Set canvas background to match */
}

/* Logo styling */
.logo {
  position: fixed;
  top: 20px;
  left: 20px;
  font-family: var(--font-family);
  font-size: 48px;
  color: black;
  line-height: 0.95;
  text-align: left;
  background-color: #f1eeea; /* Match the background color */
}

.logo .light {
  font-weight: 400;
  font-size: 41px;
}

.logo .bold {
  font-weight: 700;
  font-style: italic;
}

/* Footer styling */
.toggle-container {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%) translateY(0);
  max-width: 1020px;
  width: auto;
  padding: 0;
  background-color: rgba(241, 238, 234, 0.95);
  border: 1px solid black;
  border-bottom: none;
  z-index: 100;
  transition: transform 0.3s ease-in-out;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  border-radius: 5px 5px 0 0;
}

/* Class for when the container is collapsed */
.toggle-container.collapsed {
  transform: translateX(-50%) translateY(100%); /* Fully hide the container */
}

/* The toggle button positioned at the top of the container */
.panel-toggle {
  position: absolute;
  top: -26px; /* Position at top of container, matching its height */
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 26px;
  background-color: #121212;
  border: 1px solid black;
  border-bottom: none;
  border-radius: 5px 5px 0 0;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 101;
}

/* The arrow SVG inside the toggle button */
.panel-toggle svg {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Animate the arrow in the toggle button */
#toggle-arrow {
  transition: transform 0.3s ease-in-out;
}

/* Make sure arrow is clearly visible */
.panel-toggle #toggle-arrow {
  visibility: visible !important;
  opacity: 1 !important;
}

/* Restore the original compact grid layout */
.controls-grid {
  display: grid;
  grid-template-columns: repeat(
    6,
    170px
  ); /* Increased column width for better spacing */
  gap: 0;
  border: 1px solid black;
  box-sizing: border-box;
  width: 100%;
}

/* Make first three columns slightly wider */
.control-pair:nth-child(-n + 3) {
  width: 170px; /* Equal width for consistency */
}

.control-pair:nth-child(n + 4):nth-child(-n + 6) {
  width: 170px; /* Equal width for consistency */
}

/* Ensure all control pairs have right borders */
.control-pair {
  display: flex;
  flex-direction: column;
  border-right: 1px solid black;
  flex: 1 1 auto;
  box-sizing: border-box;
}

/* Only remove border from the last control-pair */
.control-pair:last-child {
  border-right: none;
}

/* Color column styling - use flexbox for consistent sizing */
.color-column {
  display: flex;
  flex-direction: column;
  width: 170px; /* Match other columns */
  border-right: none;
}

.color-column .color-cell {
  flex: 1;
  height: 40px;
  border-bottom: 1px solid black;
  cursor: pointer;
  position: relative;
}

.color-column .color-cell:last-child {
  border-bottom: none;
}

/* Add active indicator for color cells */
.color-cell {
  position: relative;
}

.color-cell::before {
  content: "off";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #f1eeea;
  font-family: var(--font-family);
  font-size: 11.34px;
  font-weight: 700;
  text-transform: lowercase;
  z-index: 2;
  pointer-events: none;
}

.color-cell.active::before {
  content: "on";
}

/* Remove old checkmark styling */
.color-cell.active::after {
  display: none;
}

/* Remove horizontal color controls styling */
.color-controls {
  display: none;
}

/* Each control group is a self-contained unit with flex */
.slider-group,
.toggle-group {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0;
  padding: 0;
  flex: 1;
  /* Use flex to ensure consistent height */
  height: calc(100% / 2);
  box-sizing: border-box;
}

/* Label row styling - adjust padding */
.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 40px;
  margin: 0;
  padding: 0 15px; /* Slightly increased padding for readability */
  border-bottom: 1px solid black;
  box-sizing: border-box;
  background-color: #f1eeea;
}

/* Ensure all slider containers have consistent borders */
.slider-container {
  width: 100%;
  height: 40px;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background-color: #f1eeea;
  border-bottom: 1px solid black;
  box-sizing: border-box;
}

/* Toggle groups need each element to have border */
.toggle-group .label-row {
  border-bottom: 1px solid black;
}

.toggle-group .slider-container {
  width: 100%;
  height: 40px;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: transparent;
  border-bottom: 1px solid black;
  box-sizing: border-box;
  background-color: #f1eeea;
}

/* Input styling */
input[type="range"],
input[type="range"].toggle {
  -webkit-appearance: none;
  width: 100%;
  height: 40px;
  background: transparent;
  border-radius: 0;
  margin: 0;
  padding: 0;
  cursor: pointer;
}

/* Make slider thumb width relative to container width */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: calc(100% / 6);
  height: 40px;
  background: black;
  border-radius: 0;
  cursor: pointer;
  border: none;
}

input[type="range"]::-moz-range-thumb {
  width: calc(100% / 6);
  height: 40px;
  background: black;
  border-radius: 0;
  cursor: pointer;
  border: none;
}

/* Toggle-specific styling */
input[type="range"].toggle::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 50%; /* Half of the container width */
  height: 40px;
  background: black;
  border-radius: 0;
  cursor: pointer;
  border: none;
  position: relative;
}

input[type="range"].toggle::-moz-range-thumb {
  width: 50%; /* Half of the container width */
  height: 40px;
  background: black;
  border-radius: 0;
  cursor: pointer;
  border: none;
  position: relative;
}

/* Remove the existing on/off text indicators */
.toggle-group::before,
.toggle-group::after {
  display: none;
}

/* Add properly positioned on/off text */
.toggle-group .slider-container {
  position: relative;
}

/* Add the off text */
.toggle-group .slider-container::before {
  content: "off";
  position: absolute;
  left: 25%; /* Center in left half */
  top: 50%;
  transform: translateY(-50%);
  color: #f1eeea;
  font-family: var(--font-family);
  font-size: 11.34px; /* 8% increase from 10.5px */
  font-weight: 700;
  text-transform: lowercase;
  z-index: 2;
  pointer-events: none;
  text-align: center;
  width: 20px; /* Set width for centering */
  margin-left: -10px; /* Center the text */
}

/* Add the on text */
.toggle-group .slider-container::after {
  content: "on";
  position: absolute;
  right: 25%; /* Center in right half */
  top: 50%;
  transform: translateY(-50%);
  color: #f1eeea;
  font-family: var(--font-family);
  font-size: 11.34px; /* 8% increase from 10.5px */
  font-weight: 700;
  text-transform: lowercase;
  z-index: 2;
  pointer-events: none;
  text-align: center;
  width: 20px; /* Set width for centering */
  margin-right: -10px; /* Center the text */
}

/* Hide the value text for toggles in the 4th column */
.control-pair:nth-child(4) .toggle-group .slider-value {
  display: none;
}

/* Button styling - use flexbox for consistent sizing */
.print-button {
  width: 100%;
  height: 80px;
  padding: 0;
  margin: 0;
  background: black;
  color: #f1eeea;
  border: none;
  border-radius: 0;
  font-family: var(--font-family);
  font-weight: 900;
  font-size: 12.6px;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid black;
  /* Make buttons share space evenly */
  flex: 1;
  box-sizing: border-box;
}

.print-button:last-child {
  border-bottom: none;
}

/* Text styling - ensure proper spacing */
.slider-label,
.toggle-group .slider-label {
  font-family: var(--font-family);
  font-weight: 900;
  font-size: 12.6px;
  text-transform: uppercase;
  white-space: nowrap;
  text-align: left;
  padding-left: 0;
  min-width: 70px; /* Minimum width for labels */
}

.slider-value,
.toggle-group .slider-value {
  font-family: var(--font-family);
  font-weight: 900;
  font-size: 12.6px;
  text-transform: uppercase;
  text-align: right;
  padding-right: 0;
  min-width: 30px; /* Minimum width for values */
}

/* Remove bottom borders for last items */
.control-pair > *:last-child .label-row:last-child,
.control-pair > *:last-child .slider-container:last-child {
  border-bottom: none;
}

/* Rules Overlay */
.rules-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  pointer-events: none;
  z-index: 9998;
}

.rules-container .rules-overlay,
.rules-container .rules-close {
  pointer-events: auto;
}

.rules-overlay {
  position: fixed;
  top: 0;
  right: -100%;
  width: 50%;
  height: 100%;
  background-color: rgba(241, 238, 234, 0.95);
  z-index: 1000;
  overflow-y: auto;
  transition: right 0.3s ease-in-out;
  border-left: 1px solid black;
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
}

.rules-overlay.active {
  right: 0;
}

.rules-content {
  padding: 60px 40px 40px;
  max-width: 800px;
  margin: 0 auto;
}

/* Update rules typography to use Inter */
.rules-section {
  font-family: "Inter", var(--font-family), sans-serif;
}

.rules-section h3 {
  font-size: 28px;
  margin-bottom: 30px;
  font-weight: 700;
  color: #121212;
}

.rules-section h4 {
  font-size: 22px;
  margin: 25px 0 15px;
  font-weight: 600;
  color: #121212;
}

.rules-section h5 {
  font-size: 18px;
  margin: 20px 0 10px;
  font-weight: 600;
  color: #121212;
}

.rules-section ul {
  padding-left: 25px;
  margin-bottom: 15px;
}

.rules-section li {
  margin-bottom: 8px;
  line-height: 1.5;
  font-size: 16px;
}

.rules-section strong {
  font-weight: 600;
}

/* Update close button to be part of the overlay movement */
.rules-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 20px;
  background-color: #f1eeea;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.rules-close:hover {
  background-color: #e5e2de;
}

.rules-language {
  display: none;
}

.language-button {
  padding: 8px 16px;
  background: black;
  color: white;
  border: none;
  cursor: pointer;
  font-family: var(--font-family);
  font-size: 12px;
}

.language-button.active {
  opacity: 0.6;
}

:root {
  --font-family: "IBM Plex Sans", sans-serif;
}

/* FIXED COLOR CELL STYLING */
/* These must be at the end of the file to override other styles */
#color1 {
  background-color: #193f86;
}

#color2 {
  background-color: #db6e53;
}

#color3 {
  background-color: #eebab1;
}

#color4 {
  background-color: #f5c65b;
}

/* Find and update the SVG rect fill */
svg rect {
  fill: #121212 !important; /* Override any inline styles */
}

/* Update any remaining white elements */
.slider-container,
.toggle-group .slider-container,
.label-row {
  background-color: #f1eeea;
}
