:root {
  --primary-color: #0071e3;
  --secondary-color: #f5f5f7;
  --border-color: #e0e0e0;
  --text-color: #1d1d1f;
  --success-color: #34c759;
  --price-color: #0071e3;
  --button-green: #8dc63f;
  --button-blue: #5d5fef;
  --error-color: #ff3b30;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans",
    "Helvetica Neue", sans-serif;
}

body {
  background-color: #fff;
  color: var(--text-color);
  line-height: 1.5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  margin-bottom: 30px;
}

h1 {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 10px;
}

h2 {
  font-size: 24px;
  font-weight: 500;
  margin-bottom: 20px;
  text-align: center;
}

.step-indicator {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
}

.step {
  display: flex;
  align-items: center;
  margin: 0 15px;
  opacity: 0.5;
  transition: opacity 0.3s;
  cursor: default;
}

.step.clickable {
  cursor: pointer;
}

.step.active {
  opacity: 1;
}

.step-number {
  width: 30px;
  height: 30px;
  background-color: var(--primary-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  font-weight: bold;
}

.step-title {
  font-weight: 500;
}

.step-content {
  display: none;
  animation: fadeIn 0.5s;
}

.step-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Device Selection */
.device-selection {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin: 30px 0;
}

.device-card {
  width: 220px;
  background-color: var(--secondary-color);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.device-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.device-card.selected {
  border: 2px solid var(--primary-color);
}

.device-card img {
  width: 100px;
  height: auto;
  margin-bottom: 15px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.device-card h3 {
  font-size: 20px;
  margin-bottom: 5px;
}

.device-card p {
  font-size: 14px;
  color: #666;
}

.radio-input {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 20px;
  height: 20px;
  opacity: 0;
  pointer-events: none;
}

/* Model Selection */
.model-selection {
  max-width: 600px;
  margin: 0 auto;
}

.select-wrapper {
  position: relative;
  margin-bottom: 20px;
}

select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  appearance: none;
  background-color: white;
  cursor: pointer;
}

/* Selectize Customization */
.selectize-control {
  width: 100%;
}

.selectize-input {
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: none;
  font-family: "Inter", sans-serif;
  font-size: 16px;
  height: auto;
  min-height: 46px;
  background: white;
}

.selectize-input.focus {
  border-color: var(--primary-color);
  box-shadow: none;
}

.selectize-dropdown {
  border: 1px solid var(--border-color);
  border-radius: 0 0 8px 8px;
  font-family: "Inter", sans-serif;
  font-size: 16px;
}

.selectize-dropdown-content {
  max-height: 300px;
}

.selectize-dropdown-content .option {
  padding: 10px;
}

/* Color Options */
.color-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.color-card {
  background-color: var(--secondary-color);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.color-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.color-card.selected {
  border: 2px solid var(--primary-color);
}

.color-card img {
  width: 100px;
  height: 100px;
  margin-bottom: 15px;
  object-fit: contain;
  display: block;
  margin-left: auto;
  margin-right: auto;
  background-color: transparent;
  mix-blend-mode: multiply; /* This helps remove white backgrounds */
}

.color-name {
  font-size: 16px;
  font-weight: 500;
  margin-top: 10px;
}

/* Grade Selection */
.grade-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.grade-card {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.grade-card:hover {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.grade-card.selected {
  border-color: var(--primary-color);
  box-shadow: 0 5px 15px rgba(0, 113, 227, 0.2);
}

.grade-title {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 10px;
}

.grade-price {
  font-size: 20px;
  color: var(--price-color);
  font-weight: bold;
  margin-bottom: 15px;
}

.grade-description {
  font-size: 14px;
  color: #666;
}

/* Detail Form */
.detail-container {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  margin: 30px 0;
}

.detail-form {
  flex: 1;
  min-width: 300px;
}

.detail-preview {
  flex: 1;
  min-width: 300px;
  background-color: var(--secondary-color);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.detail-item {
  margin-bottom: 12px;
  padding-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.detail-label {
  display: flex;
  align-items: flex-start;
  font-weight: 500;
  position: relative; /* Ensure relative positioning for child elements */
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: #ccc;
  color: white;
  text-align: center;
  font-size: 12px;
  margin-left: 8px;
  cursor: help;
  flex-shrink: 0;
  position: relative;
}

.info-icon.tooltip .tooltip-text {
  bottom: 130%;
  left: 0;
  transform: translateX(-25%); /* Adjust horizontal position */
}

.info-icon.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

.detail-options {
  display: flex;
  gap: 15px;
}

/* Modern Radio Buttons */
.radio-container {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.radio-container input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-container label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 20px;
  background-color: white;
  border: 1px solid #ddd;
  transition: all 0.2s;
  min-width: 70px;  /* Ensure minimum width */
  text-align: center;
}

.radio-container input[type="radio"]:checked + label {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Custom Select */
.custom-select {
  position: relative;
  width: 200px;
}

.custom-select select {
  height: 36px;
  padding: 0 10px;
}

.device-image {
  width: 300px;
  height: auto;
  margin-bottom: 20px;
  object-fit: contain;
  background-color: transparent;
  mix-blend-mode: multiply; /* This helps remove white backgrounds */
}

.detail-summary {
  width: 100%;
}

.model-name {
  text-align: center;
  font-weight: 500;
  font-size: 18px;
  margin-bottom: 15px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  margin-bottom: 2px;
}

.detail-value {
  font-weight: 500;
}

.price-value {
  color: var(--price-color);
  font-weight: bold;
  font-size: 20px;
}

.grade-value {
  color: var(--price-color);
  font-weight: bold;
  font-size: 18px;
}

.chevron-down {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5d5fef;
  font-size: 24px;
  margin: 10px 0;
}

/* Customer Form */
.form-section {
  margin-bottom: 30px;
  background-color: var(--secondary-color);
  border-radius: 12px;
  padding: 20px;
}

.form-section h3 {
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 20px;
}

.form-group {
  flex: 1;
  min-width: 250px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  font-family: "Inter", sans-serif;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary-color);
  outline: none;
}

.form-group input.error,
.form-group select.error {
  border-color: var(--error-color);
}

.required::after {
  content: "*";
  color: red;
  margin-left: 4px;
}

/* Buttons */
.button-container {
  display: flex;
  justify-content: center;
  margin-top: 30px;
}

.button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 12px 30px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  font-family: "Inter", sans-serif;
}

.button:hover {
  background-color: #0062c3;
}

.button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.back-button {
  background-color: #f5f5f7;
  color: var(--text-color);
  margin-right: 15px;
  border: 1px solid var(--border-color);
}

.back-button:hover {
  background-color: #e5e5e7;
  color: var(--text-color);
}

.green-button {
  background-color: var(--button-green);
  width: 100%;
  padding: 15px;
  font-size: 18px;
  border-radius: 8px;
}

.green-button:hover {
  background-color: #7ab52f;
}

/* Success Message */
.success-message {
  text-align: center;
  padding: 40px 20px;
}

.success-icon {
  font-size: 60px;
  color: var(--success-color);
  margin-bottom: 20px;
}

/* Tooltip */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltip-text {
  visibility: hidden;
  width: 250px;
  max-width: calc(100vw - 30px); /* Prevent overflow on smaller screens */
  background-color: #333;
  color: #fff;
  text-align: left;
  border-radius: 6px;
  padding: 10px;
  position: absolute;
  z-index: 100; /* Higher z-index to ensure visibility */
  bottom: 130%; /* Position above by default */
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Add loading spinner styles */
.loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s ease-in-out infinite;
  margin: 20px auto;
}

.loading-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100px;
  width: 100%;
  text-align: center;
}

/* Fix for color options loading container alignment */
.color-options .loading-container {
  grid-column: 1 / -1; /* Make it span all grid columns */
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Add styles for selectize loading state */
.selectize-control.loading::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s ease-in-out infinite;
  z-index: 2;
}

/* Add styles for price correction */
.price-correction {
  font-size: 14px;
  margin-top: 5px;
  color: #ff3b30;
}

.price-correction.positive {
  color: #34c759;
}

/* Add highlight animation for price and grade changes */
@keyframes highlight {
  0% {
    background-color: rgba(0, 113, 227, 0.2);
  }
  100% {
    background-color: transparent;
  }
}

.highlight {
  animation: highlight 1s ease-out;
  border-radius: 4px;
  padding: 2px 4px;
  margin: -2px -4px;
}

/* Responsive */
@media (max-width: 768px) {
  .device-selection {
    flex-direction: column;
    align-items: center;
  }

  .grade-options {
    grid-template-columns: 1fr;
  }

  .detail-container {
    flex-direction: column;
  }

  .form-row {
    flex-direction: column;
    gap: 15px;
  }

  .form-group {
    min-width: 100%;
  }
}

/* Add highlight animation for price and grade changes */
@keyframes highlight {
  0% {
    background-color: rgba(0, 113, 227, 0.2);
  }
  100% {
    background-color: transparent;
  }
}

.highlight {
  animation: highlight 1s ease-out;
  border-radius: 4px;
  padding: 2px 4px;
  margin: -2px -4px;
}

/* Enhanced Responsive Styles */
@media (max-width: 768px) {
  /* General adjustments */
  .container {
    padding: 15px;
  }
  
  h1 {
    font-size: 28px;
  }
  
  h2 {
    font-size: 22px;
    margin-bottom: 15px;
  }
  
  /* Step indicator adjustments */
  .step-indicator {
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
  }
  
  .step {
    margin: 5px;
  }
  
  /* Device selection */
  .device-selection {
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }
  
  .device-card {
    width: 100%;
    max-width: 280px;
  }
  
  /* Color options */
  .color-options {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
  }
  
  .color-card {
    padding: 15px;
  }
  
  .color-card img {
    width: 80px;
    height: 80px;
  }
  
  /* Grade selection */
  .grade-options {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  /* Detail form and preview */
  .detail-container {
    flex-direction: column;
    gap: 20px;
  }
  
  .detail-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .detail-options {
    width: 100%;
    justify-content: flex-start;
  }
  
  .custom-select {
    width: 100%;
  }
  
  /* Form elements */
  .form-row {
    flex-direction: column;
    gap: 15px;
  }
  
  .form-group {
    min-width: 100%;
  }
  
  /* Buttons */
  .button-container {
    flex-wrap: wrap;
    gap: 10px;
  }
  
  .button {
    padding: 10px 20px;
    font-size: 15px;
    width: 100%;
  }
  
  .back-button {
    margin-right: 0;
  }
  
  /* Tooltip adjustments */
  .tooltip .tooltip-text {
    width: 200px;
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  /* Header and text */
  h1 {
    font-size: 24px;
  }
  
  h2 {
    font-size: 20px;
  }
  
  /* Step indicator for tiny screens */
  .step-indicator {
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 10px;
  }
  
  .step {
    flex-shrink: 0;
  }
  
  .step-title {
    font-size: 14px;
  }
  
  .step-number {
    width: 25px;
    height: 25px;
    font-size: 14px;
  }
  
  /* Card and option styling */
  .color-options {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .color-card {
    padding: 10px;
  }
  
  .color-name {
    font-size: 14px;
  }
  
  .grade-card {
    padding: 15px;
  }
  
  .grade-title {
    font-size: 20px;
  }
  
  .grade-price {
    font-size: 18px;
  }
  
  /* Form adjustments */
  .form-section {
    padding: 15px;
  }
  
  /* Fix radio button options */
  .radio-container label {
    padding: 8px;
    font-size: 14px;
    min-width: 60px;
  }
  
  /* Ensure selectize is mobile friendly */
  .selectize-input {
    padding: 10px;
    font-size: 15px;
    min-height: 42px;
  }
  
  /* Preview adjustments */
  .detail-preview {
    padding: 15px;
  }
  
  .device-image {
    width: 150px;
  }
  
  /* Full-width tooltip on tiny screens */
  .tooltip .tooltip-text {
    width: 180px;
    max-width: calc(100vw - 40px);
    left: auto;
    right: 0;
    transform: none;
  }

  .info-icon.tooltip .tooltip-text {
    width: 180px;
    max-width: calc(100vw - 40px);
    left: 50%;
    transform: translateX(-50%);
  }
}

/* Mobile adjustments for tooltips */
@media (max-width: 768px) {
  .tooltip .tooltip-text {
    width: 200px;
    left: auto;
    right: 0;
    transform: none;
  }
  
  .info-icon.tooltip .tooltip-text {
    width: 200px;
    right: -10px; /* Align to stay in view */
    transform: none;
  }
  
  /* For items on the left side of screen */
  .detail-item:first-child .info-icon.tooltip .tooltip-text {
    left: -10px;
    right: auto;
  }
}

@media (max-width: 480px) {
  .tooltip .tooltip-text {
    width: 180px;
    max-width: calc(100vw - 40px);
  }
  
  .info-icon.tooltip .tooltip-text {
    width: 180px;
    max-width: calc(100vw - 40px);
  }
}