/* FitIQ Try It On Widget Styles - Theme App Extension Version - With Enhanced Theme Compatibility */

/* Reset styles to prevent theme conflicts */
.fitiq-widget-container * {
  box-sizing: border-box !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
  line-height: normal !important;
}

/* Try It On Button with improved specificity */
.fitiq-try-it-on-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #3b82f6;
  color: white;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  margin-top: 10px;
  transition: background-color 0.2s;
}

.fitiq-try-it-on-button:hover {
  background-color: #2563eb;
}

.fitiq-modal {
  display: none;
  align-items: center !important;
  justify-content: center !important;
  position: fixed !important;
  z-index: 2147483647 !important; /* Maximum z-index value to ensure it's above everything */
  left: 0 !important;
  top: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background-color: rgba(0, 0, 0, 0.5) !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: auto !important;
  box-sizing: border-box !important;
  pointer-events: auto !important; /* Ensure clicks are registered */
  min-height: 100vh !important; /* Ensure full height on all themes */
  max-height: 100vh !important;
  animation: none !important; /* Prevent theme animations from affecting modal */
  transform: none !important; /* Prevent theme transforms */
  opacity: 1 !important; /* Ensure visibility */
  visibility: visible !important;
}

.fitiq-modal[style*="display: block"],
.fitiq-modal[style*="display: flex"],
.fitiq-modal.fitiq-active {
  display: flex !important;
  pointer-events: auto !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.fitiq-modal-content {
  background-color: #18181b !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45) !important;
  padding: 0 !important;
  width: 100% !important;
  max-width: 400px !important;
  margin: 0 auto !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  position: relative !important;
  z-index: 2147483647 !important; /* Ensure it's above other elements */
  pointer-events: auto !important; /* Ensure clicks are registered */
  transform: none !important; /* Prevent theme transforms */
  animation: none !important; /* Prevent theme animations */
  opacity: 1 !important;
  visibility: visible !important;
  border: none !important; /* Prevent theme borders */
  min-height: auto !important; /* Prevent theme-specific heights */
  max-height: 90vh !important; /* Allow scrolling on small screens */
}

.fitiq-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #27272a;
  padding: 12px 16px;
  border-bottom: 1px solid #3f3f46;
}

.fitiq-modal-header h2 {
  font-size: 16px;
  font-weight: 500;
  color: white;
  margin: 0;
}

.fitiq-close-button {
  background: none !important;
  border: none !important;
  color: #a1a1aa !important;
  font-size: 24px !important;
  cursor: pointer !important;
  transition: color 0.2s !important;
  padding: 8px !important;
  margin: 0 !important;
  line-height: 1 !important;
  position: relative !important;
  z-index: 2147483648 !important; /* One higher than the modal to be sure */
  pointer-events: auto !important; /* Ensure clicks are registered */
  touch-action: manipulation !important; /* Optimize for touch */
  -webkit-tap-highlight-color: transparent !important; /* Remove tap highlight on mobile */
  display: block !important; /* Ensure button is visible */
  width: auto !important; /* Prevent theme width constraints */
  height: auto !important; /* Prevent theme height constraints */
  min-width: unset !important; /* Reset theme constraints */
  min-height: unset !important; /* Reset theme constraints */
  max-width: unset !important; /* Reset theme constraints */
  max-height: unset !important; /* Reset theme constraints */
  appearance: none !important; /* Remove native styling */
  -webkit-appearance: none !important; /* Remove native styling for Safari */
}

.fitiq-close-button:hover {
  color: white;
}

.fitiq-modal-body {
  padding: 16px;
  width: 100%;
  box-sizing: border-box;
}

.fitiq-unit-toggle {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  background-color: #27272a;
  border: 1px solid #3f3f46;
  margin-bottom: 16px;
}

.fitiq-unit-button {
  flex: 1;
  padding: 10px;
  text-align: center;
  background: none;
  border: none;
  color: #a1a1aa;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.fitiq-unit-button.active {
  background-color: #3f3f46;
  color: white;
}

.fitiq-input-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.fitiq-input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.fitiq-label {
  display: block;
  font-size: 14px;
  color: #a1a1aa;
  margin-bottom: 6px;
}

.fitiq-input {
  width: 100%;
  background-color: #27272a;
  border: 1px solid #3f3f46;
  border-radius: 6px;
  padding: 8px 12px;
  color: white;
  font-size: 16px;
  box-sizing: border-box;
}

.fitiq-weight-gender-container {
  display: flex;
  width: 100%;
  gap: 8px;
  align-items: flex-end;
}

.fitiq-weight-gender-container .fitiq-input {
  width: 70%;
  height: 36px; /* Match the height of the gender toggle */
  padding: 11px 10px 5px;
  box-sizing: border-box;
  line-height: 20px;
}

.fitiq-gender-column {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.fitiq-gender-column .fitiq-label {
  font-size: 12px;
  margin-bottom: 5px;
  color: #c1c1c1;
  text-align: left;
  display: block;
}

/* Weight label specific spacing */
.fitiq-input-group .fitiq-label {
  margin-bottom: 8px;
}

/* Special margin for weight label */
.fitiq-input-group .fitiq-label + .fitiq-weight-gender-container {
  margin-top: -3px;
}

.fitiq-gender-toggle {
  display: flex;
  width: 100%;
  background-color: #393939;
  border-radius: 4px;
  overflow: hidden;
}

.fitiq-gender-button {
  flex: 1;
  background-color: transparent;
  border: none;
  color: #fff;
  padding: 8px 5px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.3s ease;
}

.fitiq-gender-button.active {
  background-color: #3b82f6 !important;
  color: #ffffff !important;
}

.fitiq-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.fitiq-find-button {
  width: 100%;
  background-color: #3b82f6;
  color: white;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  margin-bottom: 12px;
  transition: background-color 0.2s;
}

.fitiq-find-button:hover {
  background-color: #2563eb;
}

.fitiq-powered-by {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #71717a;
  margin-top: 16px;
  margin-bottom: 12px;
  padding-top: 10px;
  border-top: 1px solid #3f3f46;
}

.fitiq-powered-left {
  display: flex;
  align-items: center;
}

.fitiq-logo {
  height: 20px;
  margin-right: 8px;
}

.fitiq-brand {
  font-weight: 600;
  color: #60a5fa;
}

.fitiq-lang-switcher {
  display: flex;
  align-items: center;
  background-color: #27272a;
  border-radius: 4px;
  overflow: hidden;
}

.fitiq-lang-button {
  padding: 4px 8px;
  background: none;
  border: none;
  color: #a1a1aa;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  font-size: 11px;
}

.fitiq-lang-button.active {
  background-color: #3f3f46;
  color: white;
}

.fitiq-visualization {
  background-color: black;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.fitiq-visualization-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
}

.fitiq-scale {
  width: 20px;
  height: 100%;
  display: flex;
  justify-content: center;
}

.fitiq-scale-bar {
  height: 100%;
  width: 2px;
  background: linear-gradient(to bottom, #3f3f46, #52525b, #3f3f46);
  position: relative;
}

.fitiq-scale-mark {
  position: absolute;
  width: 6px;
  height: 2px;
  background-color: #71717a;
  left: 0;
  transform: translateX(-50%);
}

.fitiq-body-container {
  position: relative;
  width: 180px;
  height: 256px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fitiq-body-image {
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  z-index: 1;
}

.fitiq-clothing-overlay {
  position: absolute;
  z-index: 2;
  opacity: 0.8;
  left: 50%;
  top: 17%;
  width: 82%;
  height: 66%;
  transform: translateX(-50%);
  pointer-events: none;
}

.fitiq-size-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  justify-content: center;
  margin-right: 10px;
}

.fitiq-size-button {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #27272a;
  color: #d4d4d8;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s;
}

.fitiq-size-button.active {
  background-color: #3b82f6;
  color: white;
}

.fitiq-size-button:hover:not(.active) {
  background-color: #3f3f46;
}

.fitiq-recommendation {
  text-align: center;
  padding: 0 16px 16px;
}

.fitiq-recommendation-text {
  color: #d4d4d8;
  margin-bottom: 16px;
}

.fitiq-size-text {
  font-weight: 700;
  color: white;
}

.fitiq-edit-button {
  width: 100%;
  background: none;
  border: 1px solid #3f3f46;
  color: #d4d4d8;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.fitiq-edit-button:hover {
  background-color: #27272a;
}

.fitiq-warning-message {
  margin: 12px 0 0 0;
  padding: 10px 16px;
  text-align: center;
  color: #fff;
  background-color: #3b82f6;
  border-radius: 6px;
  font-weight: 600;
  font-size: 15px;
  box-shadow: 0 2px 8px rgba(59,130,246,0.10);
  transition: background 0.2s, color 0.2s;
}

/* Reset any conflicting styles for buttons */
button.fitiq-unit-button,
button.fitiq-gender-button,
button.fitiq-size-button,
button.fitiq-find-button,
button.fitiq-edit-button {
  appearance: none !important;
  -webkit-appearance: none !important;
  border: none !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  word-spacing: normal !important;
  line-height: normal !important;
  text-shadow: none !important;
}

/* Fix for any theme that might hide input fields */
.fitiq-input-container input[type="text"],
.fitiq-input-container input[type="number"] {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Responsive adjustments for mobile devices */
@media (max-width: 480px) {
  .fitiq-modal-content {
    width: 90%;
    max-width: 360px;
    margin: 0 auto;
  }
  
  .fitiq-modal-body {
    padding: 15px;
  }
  
  .fitiq-input-grid {
    gap: 10px;
  }
}

/* Even smaller screens */
@media (max-width: 360px) {
  .fitiq-modal-content {
    width: 85%;
  }
}

/* Button shapes */
.fitiq-shape-rounded {
  border-radius: 6px;
}

.fitiq-shape-pill {
  border-radius: 50px;
}

.fitiq-shape-square {
  border-radius: 0;
}

/* Button sizes */
.fitiq-size-small {
  padding: 8px 12px;
  font-size: 14px;
}

.fitiq-size-medium {
  padding: 10px 16px;
  font-size: 16px;
}

.fitiq-size-large {
  padding: 12px 20px;
  font-size: 18px;
}

/* Height scale styles */
.fitiq-height-scale-container {
  position: absolute;
  left: 5px;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  z-index: 1;
}

.fitiq-scale-image {
  height: 100%;
  max-height: 256px;
  width: auto;
  opacity: 0.8;
}

.fitiq-scale-line {
  width: 2px;
  height: 92%;
  background-color: #3f3f46;
  position: relative;
  margin-top: 8%;
}

.fitiq-scale-marker {
  position: absolute;
  width: 100%;
  left: 0;
}

.fitiq-scale-marker:nth-child(1) {
  top: 6%;
}

.fitiq-scale-marker:nth-child(2) {
  top: 28%;
}

.fitiq-scale-marker:nth-child(3) {
  top: 50%;
}

.fitiq-scale-marker:nth-child(4) {
  top: 72%;
}

.fitiq-scale-marker:nth-child(5) {
  top: 94%;
}

.fitiq-scale-tick {
  position: absolute;
  width: 8px;
  height: 1px;
  background-color: #3f3f46;
  right: -3px;
}
