/* ===== Animations ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity:1; transform:none; } }
@keyframes slideInLeft { from { transform: translateX(-40px); opacity:0 } to { transform:none; opacity:1 } }
@keyframes shakeX { 0%,100% { transform: translateX(0) } 25% { transform: translateX(-6px) } 50% { transform: translateX(6px) } 75% { transform: translateX(-4px) } }

/* Optional rainbow animation for custom button */
@keyframes rainbowShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ===== Page ===== */
:root {
 /* --bg: #5aa3e2; */ 
  --bg: #d2ebf7; /* petflap blue */ 
  --accent: #284ece;
  --white: #f3f0f0;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: rgb(18, 23, 28);
  animation: fadeIn .6s ease both;
}
.page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 18px 30px 80px;
}

/* ===== Header ===== */
h1 {
  font-size: 2.4rem;
  color: #262728;
  margin: 6px 0 22px;
  text-align: left;
  padding-left: 6px;
  animation: slideInLeft .6s ease both;
  font-weight: 800;
}
h1::after {
  content: "";
  display: block;
  height: 4px;
  background: var(--white);
  margin-top: 12px;
  border-radius: 2px;
}

/* ===== Section title ===== */
h2 {
  margin: 12px 0;
  color: #262728;
  font-size: 1.1rem;
  font-weight: 700;
}

/* ===== Option groups ===== */
.option-group { margin: 30px 0; }

/* ===== Buttons grid ===== */
.buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 18px;
  margin-top: 8px;
}

/* Base button */
.buttons button {
  border: none;
  padding: 26px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
  outline: none;
  min-height: 60px;
}

/* Hover & selected */
.buttons button:hover,
.buttons button:focus {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}
/* Keep the colour-coded backgrounds when selected */
.color-black.selected {
  background: black;
  color: white;
}

.color-white.selected {
  background: white;
  color: black;
}

.color-silver.selected {
  background: silver;
  color: black;
}

.color-custom.selected {
  background: linear-gradient(45deg, white, silver, black);
  color: white;
}

/* Fallback for all other buttons */
.buttons button.selected {
  transform: translateY(-4px);
  border: 3.5px solid var(--accent);
  box-shadow: 0 6px 14px rgba(70, 74, 70, 0.15);
}

/* ===== Colour-coded buttons ===== */
.color-white { background: #fff; color: #333; }
.color-black { background: #000; color: #fff; }
.color-silver { background: #c0c0c0; color: #000; }
/* Custom rainbow button */
.color-custom {
  background: linear-gradient(45deg, white, silver, black);
  background-size: 600% 600%;
  animation: rainbowShift 10s ease infinite;
  color: #fff;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* ===== Non-colour option buttons fallback ===== */
.option-group:not(#ColourGroup):not(#ExternalColourGroup):not(#TrunkingColourGroup):not(#InternalColourGroup) .buttons button {
  background: rgb(230, 230, 230);
  color: #262626;
}

/* ===== Submit button ===== */
#submitBtn {
  margin: 40px auto 0;
  display: block;
  padding: 14px 28px;
  font-size: 18px;
  font-weight: 800;
  color: var(--white);
  background: var(--accent);
  border-radius: 10px;
  border: none;
  box-shadow: 0 6px 18px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: transform .18s ease, background .18s;
}
#submitBtn:hover {
  transform: translateY(-2px);
}
#submitBtn.shake {
  animation: shakeX .45s linear;
}

/* ===== Results grid ===== */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 18px;
}
.selection {
  background: var(--white);
  padding: 14px 16px;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
  font-weight: 700;
}
.selection .sel-label { color:#666; font-size:0.9rem; margin-bottom:4px; }
.selection .sel-value { font-size:1.05rem; color:#123; }

/* ===== Nav buttons ===== */
.back-btn,
.continue-btn {
  background: var(--white);
  color: var(--accent);
  padding: 12px 18px;
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
.results-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 26px;
}

/* Hidden */
.hidden { display: none; }

/* Responsive */
@media (max-width:640px) {
  h1 { font-size: 1.8rem; }
  .buttons { grid-template-columns: 1fr; gap: 12px; }
  .page { padding: 14px; }
}
