/**
 * Champ Star Product Inquiry - Frontend Styles
 * Scoped strictly to .csgi-inquiry-container to prevent theme conflicts.
 */

:root {
  --csgi-primary-bg: #111111;
  --csgi-input-bg: #181818;
  --csgi-border-color: #2e2e2e;
  --csgi-heading-color: #e11d48;
  --csgi-text-color: #ffffff;
  --csgi-whatsapp-bg: #25D366;
  --csgi-focus-ring: rgba(225, 29, 72, 0.4);
}

.csgi-inquiry-container {
  width: 100%;
  margin: 20px 0 25px 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  color: var(--csgi-text-color);
}

.csgi-inquiry-container *,
.csgi-inquiry-container *::before,
.csgi-inquiry-container *::after {
  box-sizing: border-box;
}

.csgi-inquiry-box {
  background-color: var(--csgi-primary-bg);
  border: 1px solid var(--csgi-border-color);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Header section */
.csgi-header {
  border-bottom: 1px solid var(--csgi-border-color);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.csgi-main-title {
  margin: 0 0 4px 0 !important;
  color: var(--csgi-heading-color) !important;
  font-size: 16px !important;
  font-weight: 800 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  line-height: 1.2 !important;
}

.csgi-subtitle {
  display: block;
  font-size: 12px;
  color: #9e9e9e;
  letter-spacing: 0.02em;
}

/* Fields Grid & Layout */
.csgi-fields-wrapper {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.csgi-field-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.csgi-field-header-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  margin-bottom: 2px !important;
}

.csgi-field-label {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #e0e0e0 !important;
  margin-bottom: 0 !important;
  display: inline-block !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.csgi-active-color-name {
  font-size: 13px !important;
  font-weight: 700 !important;
  color: var(--csgi-heading-color) !important;
  letter-spacing: 0.02em !important;
  white-space: nowrap !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.csgi-req {
  color: var(--csgi-heading-color);
  font-weight: bold;
}

.csgi-field-desc {
  font-size: 11px !important;
  color: #888888 !important;
  margin: 0 0 4px 0 !important;
  line-height: 1.3 !important;
}

/* Form Controls (Select, Input, Textarea) */
.csgi-select,
.csgi-input,
.csgi-textarea {
  width: 100% !important;
  background-color: var(--csgi-input-bg) !important;
  color: var(--csgi-text-color) !important;
  border: 1px solid var(--csgi-border-color) !important;
  border-radius: 4px !important;
  padding: 10px 12px !important;
  font-size: 13px !important;
  line-height: 1.4 !important;
  outline: none !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  min-height: 42px;
}

/* Dedicated dropdown selected-value styling */
.csgi-inquiry-container .csgi-select.csgi-has-value {
  color: var(--csgi-text-color) !important;
  -webkit-text-fill-color: var(--csgi-text-color) !important;
  opacity: 1 !important;
}

.csgi-inquiry-container .csgi-select.csgi-no-value {
  color: #888888 !important;
  -webkit-text-fill-color: #888888 !important;
  opacity: 1 !important;
}

.csgi-inquiry-container .csgi-select option.csgi-select-option-value {
  background-color: #18181b !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  font-weight: 500 !important;
}

.csgi-inquiry-container .csgi-select option.csgi-select-option-placeholder {
  background-color: #18181b !important;
  color: #888888 !important;
  -webkit-text-fill-color: #888888 !important;
}

.csgi-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 32px !important;
  cursor: pointer;
  color-scheme: dark !important;
}

.csgi-select option {
  background-color: #18181b !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  padding: 10px 14px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
}

.csgi-select option:hover,
.csgi-select option:focus,
.csgi-select option:checked {
  background-color: #27272a !important;
  color: #ffffff !important;
}

.csgi-select option:disabled {
  color: #71717a !important;
}

.csgi-textarea {
  min-height: 75px;
  resize: vertical;
}

.csgi-select:focus,
.csgi-input:focus,
.csgi-textarea:focus {
  border-color: var(--csgi-heading-color) !important;
  box-shadow: 0 0 0 2px var(--csgi-focus-ring) !important;
}

.csgi-field-error .csgi-select,
.csgi-field-error .csgi-input,
.csgi-field-error .csgi-textarea,
.csgi-field-error .csgi-chips-group {
  border-color: #ef4444 !important;
  background-color: #1f1214 !important;
}

/* Chips / Button choices */
.csgi-chips-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
  padding: 4px 0;
  border-radius: 4px;
}

.csgi-chip-btn {
  background: var(--csgi-input-bg) !important;
  border: 1px solid var(--csgi-border-color) !important;
  color: #cccccc !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 8px 14px !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  text-align: center !important;
  min-height: 38px !important;
  min-width: 44px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  user-select: none;
}

.csgi-chip-btn:hover {
  background: #252525 !important;
  color: #ffffff !important;
  border-color: #555555 !important;
}

.csgi-chip-btn.is-active {
  background: var(--csgi-heading-color) !important;
  border-color: var(--csgi-heading-color) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(225, 29, 72, 0.3) !important;
}

/* Color Swatches (Visual Circles with red active ring) */
.csgi-color-swatches-group {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 6px 0 !important;
}

.csgi-color-swatch-btn {
  width: 36px !important;
  height: 36px !important;
  border-radius: 50% !important;
  border: 2px solid #2e2e2e !important;
  cursor: pointer !important;
  padding: 0 !important;
  margin: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease !important;
  outline: none !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
}

.csgi-color-swatch-btn:hover {
  transform: scale(1.1) !important;
  border-color: #777777 !important;
}

.csgi-color-swatch-btn.is-active,
.csgi-color-swatch-btn.csgi-selected {
  border-color: #ffffff !important;
  box-shadow: 0 0 0 2px #111111, 0 0 0 4px var(--csgi-heading-color) !important;
  transform: scale(1.05) !important;
}

.csgi-swatch-check {
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  color: #ffffff !important;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.95)) drop-shadow(0 0 1px rgba(0,0,0,0.8)) !important;
}

.csgi-color-swatch-btn.csgi-light-color .csgi-swatch-check {
  color: #111111 !important;
  filter: drop-shadow(0 1px 1px rgba(255, 255, 255, 0.8)) !important;
}

.csgi-color-swatch-btn.is-active .csgi-swatch-check,
.csgi-color-swatch-btn.csgi-selected .csgi-swatch-check {
  display: flex !important;
}

.csgi-field-error .csgi-color-swatches-group {
  padding: 8px 10px !important;
  border: 1px dashed #ef4444 !important;
  border-radius: 6px !important;
  background-color: rgba(239, 68, 68, 0.08) !important;
}

/* Multiple Checkbox Chips */
.csgi-checkbox-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.csgi-multi-checkbox {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.csgi-checkbox-text {
  background: var(--csgi-input-bg);
  border: 1px solid var(--csgi-border-color);
  color: #cccccc;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 4px;
  transition: all 0.15s ease;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.csgi-multi-checkbox:checked + .csgi-checkbox-text {
  background: var(--csgi-heading-color);
  border-color: var(--csgi-heading-color);
  color: #ffffff;
}

/* Conditional Custom Details Input Container */
.csgi-conditional-custom-box {
  background: #141414;
  border: 1px dashed var(--csgi-border-color);
  border-radius: 4px;
  padding: 10px 12px;
  margin-top: 6px;
  animation: csgiFadeIn 0.2s ease-in-out;
}

.csgi-sub-label {
  font-size: 11px !important;
  font-weight: 600 !important;
  color: #b0b0b0 !important;
  text-transform: uppercase;
  margin-bottom: 4px !important;
  display: block !important;
}

.csgi-custom-input {
  background: #1e1e1e !important;
  border-color: #383838 !important;
}

/* Validation Alert Notice */
.csgi-validation-alert {
  background-color: #2c0b0e;
  border: 1px solid #7f1d1d;
  color: #fecaca;
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13px;
  margin-top: 14px;
  line-height: 1.4;
}

/* WhatsApp Action Row */
.csgi-action-row {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.csgi-whatsapp-btn {
  background-color: var(--csgi-whatsapp-bg) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 6px !important;
  padding: 14px 20px !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  cursor: pointer !important;
  width: 100% !important;
  min-height: 48px !important;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.25) !important;
  transition: transform 0.15s ease, background-color 0.2s ease, box-shadow 0.2s ease !important;
  text-decoration: none !important;
}

.csgi-whatsapp-btn:hover {
  background-color: #20ba59 !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.35) !important;
}

.csgi-whatsapp-btn:active {
  transform: translateY(0);
}

.csgi-wa-icon {
  flex-shrink: 0;
}

.csgi-hint {
  font-size: 11px;
  color: #777777;
  text-align: center;
}

/* Responsive Grid for Desktop */
@media (min-width: 640px) {
  .csgi-fields-wrapper {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px 16px;
  }

  .csgi-field-item.csgi-type-single_choice,
  .csgi-field-item.csgi-type-multi_choice,
  .csgi-field-item.csgi-type-textarea {
    grid-column: span 2;
  }
}

@keyframes csgiFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================================================
   Strict Single Placement & Tab Suppression (Anti-Duplicate Protection)
   ========================================================================= */
/* Suppress any form instance placed inside tabs, long description, or related products */
.woocommerce-Tabs-panel--description .csgi-inquiry-container,
#tab-description .csgi-inquiry-container,
.woocommerce-tabs .csgi-inquiry-container,
.wc-tab .csgi-inquiry-container,
.wc-tabs-wrapper .csgi-inquiry-container,
.product-description .csgi-inquiry-container,
.woocommerce-Tabs-panel .csgi-inquiry-container,
.related.products .csgi-inquiry-container,
.upsells.products .csgi-inquiry-container {
  display: none !important;
}

/* If multiple containers are in the DOM, keep the first one and hide any following sibling */
.csgi-inquiry-container ~ .csgi-inquiry-container {
  display: none !important;
}

