/* assets/css/crate-calculator.css */

.cc-calculator * {
  font-family: "Gotham Rounded", Sans-serif;
}

/* Layout */
#crate-calculator-form {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
  align-items: start;
}

#measurement_guides { position: relative; }
#measurement_guides > div { transition: opacity 0.2s ease; }
#measurement_guides > div.blank { opacity: 1!important; }
#measurement_guides > div:not(.blank) {
  position: absolute;
  inset: 0;
}
#measurement_guides > div:not(.active) {
    opacity: 0;
    pointer-events: none;
}

.cc-field { display: flex; flex-direction: column; gap: 6px; }
.cc-field label { font-weight: 600; }
.cc-field input[type="number"],
.cc-field input[type="text"],
.cc-field input[type="email"],
.cc-field textarea {
  padding: 10px 12px;
  border: 1px solid #d4d7dd;
  border-radius: 8px;
}

/* Grid helpers */
.cc-col-12 { grid-column: span 12; }
.cc-col-6  { grid-column: span 6; }
.cc-col-4  { grid-column: span 4; }
.cc-col-3  { grid-column: span 3; }

/* Unit and snub radios */
.cc-radio-group { display: flex; flex-direction: row; flex-wrap: wrap; gap: 0.5rem 1.5rem; align-items: center; margin-bottom: 1.5rem; }
.cc-radio-group div[role="group"] { display: flex; gap: 1.5rem; }
.cc-radio-group p { flex-basis: 100%; font-size: 0.75em; }
.cc-radio-group div label { font-weight: 400; }

/* Recommendation panel */
.cc-rec {
  grid-column: span 12;
  border: 1px solid #e6e8eb;
  border-radius: 12px;
  padding: 16px;
  background: #fafbfc;
}
.cc-rec h3 { margin: 0 0 8px; font-size: 18px; }
#crate-recommendation { font-weight: 700; }

.cc-rec-grid { display: grid; gap: 8px; }

/* Buttons */
.cc-actions {
  grid-column: span 12;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

button.cc-btn, .cc-btn {
  --ha-ctv-btn-txt-clr: #FFFFFF;
  --ha-ctv-btn-bg-clr: #000000;
  --ha-ctv-btn-txt-hvr-clr: #FFFFFF;
  --ha-ctv-btn-bg-hvr-clr: #DD5C2F;
  border: none;
  font-family: "Gotham Rounded", Sans-serif;
  font-size: 17px;
  font-weight: 300;
  text-transform: uppercase;
  padding: 15px 30px 15px 30px!important;
  overflow: hidden;
  border-radius: .5em;
  background: var(--ha-ctv-btn-bg-clr);
  color: var(--ha-ctv-btn-txt-clr);
  position: relative;
  z-index: 0;
  display: inline-block;
  max-width: 100%;
  text-align: center;
  text-decoration: none;
  line-height: 1;
  transition: all .3s;
}
button.cc-btn:hover, .cc-btn:hover, button.cc-btn:focus, .cc-btn:focus {
  background: var(--ha-ctv-btn-bg-hvr-clr);
  color: var(--ha-ctv-btn-txt-hvr-clr);
}

  button.cc-btn.primary {
  background: #0b5fff;
  border-color: #0b5fff;
  color: #fff;
}
button.cc-btn[disabled] { opacity: 0.6; cursor: not-allowed; }

/* Loading state for submit */
#crate-submit[data-loading="1"] { position: relative; color: transparent; }
#crate-submit[data-loading="1"]::after {
  content: 'Submitting…';
  color: #fff;
  position: absolute; inset: 0; display: grid; place-items: center;
}

.cc-fields { max-height: 100rem; padding: 1rem 0 0; }
.cc-actions { max-height: 3rem; margin-top: 2rem; }
.cc-fields, .cc-actions { transition: all 0.25s ease-in-out; overflow: hidden; }
.cc-locked .cc-fields, .cc-locked .cc-actions { max-height: 0; }

.cc-required, .cc-recommendation { margin-bottom: 1rem; }
.cc-required strong, .cc-recommendation strong { display: block; color: #DD5C2F; }

.cc-label { font-weight: bold; }
.cc-label.required::after {
  content: '*';
  display: inline-block;
  margin-left: 0.25em;
  color: #DD5C2F;
}
.cc-field small { display: block; font-size: 0.75em; }

.cc-hidden { display: none!important; }

/* 2-column grid */
.cc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem 1.5rem; /* row / column */
  align-items: start;
  margin: 1.5rem 0;
}

/* each field fills its cell */
.cc-grid .cc-field {
  min-width: 0; /* prevent overflow */
}

/* span a field across both columns when needed */
.cc-grid .cc-field.full {
  grid-column: 1 / -1;
}

/* inputs/selects stretch */
.cc-grid .cc-field input,
.cc-grid .cc-field select {
  width: 100%;
}

.cc-results { display: flex; gap: 1rem; align-items: center; min-height: 180px; }
.cc-results > div { flex-basis: calc(50% - 0.5rem); }
/* Photo */
.cc-photo { max-width: 100%; max-height: 180px; display: block; margin: 0 0 0 auto; width: auto; border-radius: 8px; border: 1px solid #eee; }

/* stack on small screens */
@media (max-width: 768px) {
  .cc-grid {
    grid-template-columns: 1fr;
  }
}


body.cc-has-thankyou .hide-on-thankyou { display: none; }
.show-on-thankyou { display: none; }
body.cc-has-thankyou .show-on-thankyou { display: block; }



/* Jotform container */
#crate-jotform { grid-column: span 12; }
#crate-jotform iframe { width: 100%; min-height: 720px; border: 0; border-radius: 12px; }

/* Small screens */
@media (max-width: 640px) {
  #crate-calculator-form { grid-template-columns: repeat(6, 1fr); }
  .cc-col-6 { grid-column: span 6; }
  .cc-col-4 { grid-column: span 6; }
  .cc-col-3 { grid-column: span 6; }
}


/* Honeypot wrapper */
.cc-hp-wrap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}