/* ========== Base Reset ========== */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background-color: #f5f5f5;
  transition: background-color 0.3s ease;
  overflow-x: hidden;
}

::selection {
  background-color: #3498db;
  color: #fff;
}

/* ========== Container Layout ========== */
.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
}

/* ========== Picker Section ========== */
.picker-section {
  background: rgba(255, 255, 255, 0.85);
  padding: 1.5rem;
  border-radius: 10px;
  max-width: 900px;
  width: 100%;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* ========== Header ========== */
#headerCode {
  font-size: 3rem;
  font-weight: bold;
  margin-bottom: 1rem;
  transition: color 0.3s ease;
}

/* ========== Buttons ========== */
.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.btn {
  padding: 0.6rem 1.2rem;
  background-color: #222;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  width: 15.8%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: background-color 0.3s ease, transform 0.1s ease;
}

.btn:hover {
  background-color: #444;
}

.btn:active {
  background-color: #000;
  transform: scale(0.97);
}

.btn.active,
.btn[aria-selected="true"] {
  background-color: #3498DB;
  color: #fff;
}

.btn:focus-visible {
  outline: 2px solid #3498db;
  outline-offset: 2px;
}

.btn[aria-selected="true"]:not(.active) {
  background-color: #222;
  color: #fff;
}


/* ========== Format Groups ========== */
.format-group {
  display: none;
  margin-bottom: 1.5rem;
}

.format-group.active {
  display: block;
}

/* ========== Value Cards & Export Layout ========== */
.values-export-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
}

.values-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  flex: 2;
}

.value-card {
  background: #fff;
  border: 2px solid #ccc;
  border-radius: 8px;
  height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  transition: background 0.3s ease;
}

.value-text {
  font-weight: bold;
  text-align: center;
  margin-bottom: 0.5rem;
}

.copy-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  font-size: 0.8rem;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  padding: 4px 8px;
  border-radius: 5px;
  cursor: pointer;
}

.copy-btn:hover {
  background: rgba(0,0,0,0.8);
}

/* ========== Export Section ========== */
.export-section {
  background: #fafafa;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 1rem;
  flex: 1;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.export-section h3 {
  margin: 0;
  font-size: 1.2rem;
}

.export-btn {
  background: #eee;
  border: 1px solid #ccc;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.export-btn:hover {
  background: #ddd;
}

.export-btn:active {
  transform: scale(0.98);
}

.export-section textarea {
  width: 100%;
  height: 150px;
  font-family: monospace;
  font-size: 0.9rem;
  resize: vertical;
  padding: 0.5rem;
}

/* ========== Palette Cards ========== */
.cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.color-card {
  width: 120px;
  height: 120px;
  background: #ccc;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.card-text {
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-weight: bold;
  padding: 0.3rem 0.5rem;
  border-radius: 5px;
  text-align: center;
}

/* ========== Compliance Section ========== */
.compliance-section {
  margin-top: 2rem;
  background: #fafafa;
  padding: 1rem;
  border: 1px solid #ddd;
  border-radius: 10px;
}

.compliance-section h3 {
  margin-top: 0;
}

.compliance-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.compliance-card {
  background-color: #e4e4e4;
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.compliance-card h4 {
  margin-top: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #333;
}

.compliance-card p {
  font-size: 1rem;
  margin: 0.5rem 0 0;
}

#contrastAdvice {
  font-weight: bold;
  color: #444;
  margin-top: 1rem;
  text-align: center;
}

.pass { color: green; font-weight: bold; }
.fail { color: red; font-weight: bold; }

.preview-section {
  margin-top: 2rem;
  text-align: center;
}

#textPreview {
  padding: 1rem;
  margin-top: 1rem;
  background: var(--preview-bg, #ffffff);
  color: var(--preview-fg, #000000);
  border-radius: 8px;
  font-size: 1.1rem;
  line-height: 1.5;
  margin-left: auto;
  margin-right: auto;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: background 0.3s, color 0.3s;
}

.font-color-picker label {
  margin-right: 0.5rem;
  font-weight: bold;
}

#fontColorInput {
  margin-bottom: 0.5rem;
}
#accessibilityHeading,
.compliance-section > p {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

/* ========== Input Styling ========== */
.color-format-inputs {
  display: flex;
  gap: 20px;
  margin: 2em 0;
  flex-wrap: wrap;
  justify-content: center; /* <-- center horizontally */
  align-items: center;
}


.color-input {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 160px;
}

.color-input label {
  font-size: 0.9rem;
  margin-bottom: 0;
  text-align: left;
  width: 50px;
}

.color-input input {
  width: 100%;
  padding: 8px;
  font-size: 0.9rem;
  border-radius: 5px;
  border: 1px solid #ccc;
  box-sizing: border-box;
}

.simple-picker {
  display: flex;
  align-items: center;
  gap: 10px;
}

.simple-picker input[type="color"] {
  width: 130px;
  height: 40px;
  border: none;
  padding: 0;
}

.simple-picker input[type="text"] {
  width: 120px;
  padding: 8px;
  font-size: 0.9rem;
  border-radius: 5px;
  border: 1px solid #ccc;
  box-sizing: border-box;
}

/* ========== Sliders ========== */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 5px;
  background: #ccc;
  outline: none;
  transition: background 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb,
input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #888;
  cursor: pointer;
  border: none;
  transition: background 0.3s ease;
}

.dynamic-thumb input[type="range"]::-webkit-slider-thumb,
.dynamic-thumb input[type="range"]::-moz-range-thumb {
  background: var(--slider-thumb-bg, #888);
}

/* ========== Footer ========== */
.branded-footer {
  margin-top: 60px;
  padding: 32px 0 1px 12px;
  text-align: center;
  font-weight: bold;
  background-color: #121212;
  color: #fff;
  position: relative;
  width: 100%;
}

.branded-footer .footer-border {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  width: 100%;
  background: linear-gradient(to right,
    #1976d2, #007acc, #7b61ff, #d473d4, #9c27b0,
    #e26d5c, #ff9800, #ffa600, #ffae42, #92b25a,
    #2e7d32, #3aa76d, #1976d2);
  background-size: 200% auto;
  animation: borderScrollHorizontal 30s linear infinite;
  z-index: 1;
}

@keyframes borderScrollHorizontal {
  0% { background-position: 200% center; }
  100% { background-position: 0% center; }
}

.footer-text {
  margin: 1em auto 2.5em;
  font-size: 0.95rem;
  max-width: 90%;
  line-height: 1.6;
}

.footer-text a {
  color: #61DBFB;
  text-decoration: none;
  margin-left: 0.5em;
  transition: color 0.3s ease;
}

.footer-text a:hover {
  color: #fff;
  font-weight: bold;
  text-align: center;
  margin-top: 1rem;
  margin-right: 0.5rem;
}

/* ========== Responsive ========== */
@media (max-width: 600px) {
  .btn-group,
  .color-format-inputs,
  .values-export-container {
    flex-direction: column;
    align-items: center;
  }

  .color-input,
  .simple-picker {
    width: 100%;
    max-width: 100%;
    margin-bottom: 10px;
  }
}

@media (max-width: 900px) {
  .btn-group {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
  }
  .btn {
    width: 100%;
    max-width: 300px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }
  .values-cards {
    grid-template-columns: none;
    gap: 1rem;
  }
  .export-section {
    max-width: 100%;
  }
}

@media (max-width: 414px) {
  .btn { text-align: center; }
  .cards-container {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .color-card,
  .value-card {
    width: 100%;
    max-width: 300px;
  }
  .export-section {
    width: 100%;
    max-width: 350px;
    margin-top: 1rem;
  }
  .compliance-section {
    padding: 1rem;
  }
}
.preview-section.horizontal-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: center;
  align-items: center;
  margin-top: 2rem;
  text-align: left;
}

#fontColorCanvasContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#fontColorCanvasContainer label {
  margin-bottom: 0.5rem;
  font-weight: bold;
}

#fontColorCanvas {
  width: 200px;
  height: 200px;
  border: 2px solid #ccc;
  border-radius: 8px;
  cursor: crosshair;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.font-color-code {
  margin-top: 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  background: #f0f0f0;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-left: auto;
  margin-right: auto;
  transition: background 0.3s ease, color 0.3s ease;
}

.font-color-code span {
  font-family: monospace;
  color: #2c3e50;
  background: #ffffff;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
}
.copy-color-btn {
  background: #3498db;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: 0.75rem;
  transition: background 0.3s ease, transform 0.1s ease;
}

.copy-color-btn:hover {
  background: #2980b9;
}

.copy-color-btn:active {
  transform: scale(0.96);
}
.font-input-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
}

.font-input-wrapper label {
  min-width: 90px;
  text-align: right;
}

.font-input-wrapper input {
  width: 110px;
  padding: 6px 10px;
  font-family: monospace;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 5px;
  background: #fff;
  color: #333;
  transition: border 0.3s ease, box-shadow 0.3s ease;
}

.font-input-wrapper input:focus {
  border-color: #3498db;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
  outline: none;
}

.bg-color-picker {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  margin: 1rem 0 2rem;
  font-size: 1.1rem;
  font-weight: 600;
  flex-wrap: nowrap;
}

.bg-color-picker label {
  min-width: 130px;
  white-space: nowrap;
}

.bg-color-picker input[type="color"] {
  width: 100%;
  max-width: 100%;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  flex: 1;
}
