/* ==========================================================================
   Forms — Toast, Validation, Spinner, Success
   ========================================================================== */

/* ---------- Toast Notification ---------- */
.cs-toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%) translateY(-120%);
  z-index: 9999;
  min-width: 360px;
  max-width: 600px;
  padding: 1rem 2rem;
  border-radius: 0.375rem;
  font-size: 1.1875rem;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.cs-toast.cs-toast--visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.cs-toast--error {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.cs-toast--success {
  background-color: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* ---------- Field Error State ---------- */
.cs-field-error .form-control,
.cs-field-error input[type="text"],
.cs-field-error input[type="email"],
.cs-field-error input[type="tel"],
.cs-field-error input[type="file"],
.cs-field-error textarea,
.cs-field-error select {
  border-color: #ef4444 !important;
  box-shadow: none;
}

.cart-form .form-container .cs-field-error .form-control {
  border-color: #ef4444 !important;
}

/* JCF replaces native select with a styled wrapper — target it for error state */
.cs-field-error .jcf-select {
  border: 1px solid #ef4444 !important;
}

/* Constrain contact and samples form width */
.cart-form .form-box {
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

/* Let .form-group handle row spacing; zero out the built-in .form-control margin */
[data-cs-form] .form-group .form-control,
[data-cs-form] .form-group textarea.form-control,
[data-cs-form] .form-group select.form-control {
  margin-bottom: 0 !important;
}

[data-cs-form] .form-group {
  margin-bottom: 28px;
}

/* State dropdown should match text input height */
[data-cs-form] select.form-control {
  height: 40px;
  line-height: 22px;
  padding: 9px 12px;
}

.cs-field-error-msg {
  display: block;
  clear: both;
  width: 100%;
  color: #dc2626;
  font-size: 1.125rem;
  line-height: 1.3;
  margin-top: 6px;
  margin-bottom: 8px;
}

/* ---------- Stain Picker Error Highlight ---------- */
.cs-stain-box-error {
  outline: 2px solid #ef4444;
  outline-offset: 8px;
  border-radius: 4px;
}

/* ---------- Required Field Asterisk ---------- */
[data-cs-form] label mark,
[data-cs-form] h4 mark,
.stain-box h4 mark {
  color: #c31230;
  background: none;
  padding: 0;
}

/* ---------- Submit Button Processing ---------- */
.cs-btn-processing {
  position: relative;
  pointer-events: none;
  opacity: 0.75;
}

.cs-btn-processing .cs-btn-text {
  visibility: hidden;
}

.cs-btn-processing::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: -0.625rem;
  margin-left: -0.625rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: cs-spin 0.6s linear infinite;
}

@keyframes cs-spin {
  to { transform: rotate(360deg); }
}

/* ---------- Trade Program — round inputs to match other forms ---------- */
[data-cs-form="trade"] .form-control {
  border-radius: 4px;
}

/* ---------- Drag-and-Drop Upload Zone ---------- */
.cs-dropzone {
  position: relative;
  border: 2px dashed #ccc;
  border-radius: 6px;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.cs-dropzone:hover {
  border-color: #999;
}

.cs-dropzone.cs-dropzone--dragover {
  border-color: #acc577;
  background-color: #f8fdf3;
}

.cs-dropzone-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.cs-dropzone-icon {
  color: #999;
  margin-bottom: 8px;
}

.cs-dropzone-text {
  margin: 0;
  font-size: 1rem;
  color: #666;
}

.cs-dropzone-browse {
  color: #acc577;
  font-weight: 600;
  text-decoration: underline;
}

.cs-dropzone-hint {
  margin: 4px 0 0;
  font-size: 0.8125rem;
  color: #999;
}

.cs-dropzone-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.cs-dropzone-filename {
  font-size: 1rem;
  color: #333;
  font-weight: 500;
}

.cs-dropzone-replace {
  background: none;
  border: none;
  color: #acc577;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.cs-dropzone-replace:hover {
  color: #8ea85f;
}

.cs-dropzone-remove {
  background: none;
  border: 1px solid #ccc;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  line-height: 20px;
  text-align: center;
  font-size: 16px;
  color: #999;
  cursor: pointer;
  padding: 0;
}

.cs-dropzone-remove:hover {
  color: #ef4444;
  border-color: #ef4444;
}

/* Error state for dropzone */
.cs-field-error .cs-dropzone {
  border-color: #ef4444;
}

/* Hide default content when file is selected; disable input overlay so remove button works */
.cs-dropzone.cs-dropzone--has-file .cs-dropzone-content {
  display: none;
}

.cs-dropzone.cs-dropzone--has-file .cs-dropzone-input {
  pointer-events: none;
}

.cs-dropzone.cs-dropzone--has-file .cs-dropzone-preview {
  display: flex !important;
}

/* ---------- Stain Section Headings (match .cart-form .form-container h4) ---------- */
.stain-box h4,
.cs-selected-pills h4 {
  font-size: 24px;
  color: #666666;
  line-height: 35px;
  font-weight: 700;
  text-transform: uppercase;
  margin: 0 0 18px;
}

/* ---------- Selected Samples Pills ---------- */
.cs-selected-pills {
  padding: 20px 0 8px;
}

.cs-selected-pills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.cs-sample-card {
  position: relative;
  display: inline-block;
  vertical-align: top;
  width: 140px;
  text-align: center;
  border: 2px solid #acc577;
  border-radius: 8px;
  padding: 14px 12px 10px;
  background: #fff;
}

.cs-sample-card img {
  display: block;
  width: 84px;
  height: 84px;
  margin: 0 auto 9px;
  max-width: 100%;
}

.cs-sample-card-name {
  display: block;
  font-size: 16px;
  line-height: 19px;
  color: #63773a;
}

.cs-sample-card-wood {
  display: block;
  font-size: 11px;
  line-height: 1.2;
  color: #999;
  margin-top: 2px;
}

.cs-sample-card-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  line-height: 18px;
  text-align: center;
  font-size: 14px;
  color: #999;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s, border-color 0.15s;
}

.cs-sample-card-remove:hover {
  color: #ef4444;
  border-color: #ef4444;
}

/* ---------- Form Success Message ---------- */
.cs-form-success {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.cs-form-success h4 {
  color: #166534;
  margin-bottom: 0.75rem;
}

.cs-form-success p {
  color: #555;
  font-size: 1.0625rem;
}
