/* Customization Page Specific Styles - Pastel Redesign */

.customize-section {
  padding: var(--spacing-xl) 0;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--color-bg) 0%, rgba(255, 183, 178, 0.1) 100%);
}

.customize-header {
  text-align: center;
  margin-bottom: var(--spacing-xl);
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.customize-title {
  font-size: var(--font-size-h1);
  margin-bottom: var(--spacing-sm);
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.customize-subtitle {
  color: #666;
  font-size: 1.25rem;
}

/* Sample Configuration Banner */
.sample-config-banner {
  max-width: 800px;
  margin: var(--spacing-lg) auto var(--spacing-xl);
  animation: slideDown 0.5s ease-out;
}

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

.sample-config-content {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-lg);
  background: linear-gradient(135deg, rgba(255, 183, 178, 0.15) 0%, rgba(199, 206, 234, 0.15) 100%);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  position: relative;
}

.sample-config-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
  animation: sparkle 2s ease-in-out infinite;
}

.sample-config-image-wrapper {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 50%;
  background: white;
  padding: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.sample-config-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

@keyframes sparkle {
  0%, 100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
  50% {
    transform: scale(1.1) rotate(10deg);
    opacity: 0.8;
  }
}

.sample-config-text {
  flex: 1;
}

.sample-config-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 8px;
}

.sample-config-description {
  font-size: 1rem;
  color: #555;
  margin-bottom: 4px;
  line-height: 1.5;
}

.sample-config-description strong {
  color: var(--color-text);
  font-weight: 700;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sample-config-note {
  font-size: 0.9rem;
  color: #777;
  font-style: italic;
  margin: 0;
}

.sample-config-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.8);
  color: #666;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.sample-config-close:hover {
  background: rgba(255, 255, 255, 1);
  color: var(--color-text);
  transform: rotate(90deg);
}

.customize-content {
  max-width: 600px;
  margin: 0 auto;
}

/* Form Styles */
.customize-form {
  background: white;
  padding: var(--spacing-xl);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(181, 234, 215, 0.2);
  border: 1px solid rgba(0,0,0,0.03);
}

.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-group label {
  display: block;
  font-weight: 700;
  margin-bottom: var(--spacing-sm);
  color: var(--color-text);
  font-size: 1.1rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group textarea {
  width: 100%;
  padding: 16px 20px;
  border: 2px solid #f0f0f0;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  transition: all 0.3s ease;
  font-family: inherit;
  background: #fafafa;
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-secondary);
  background: white;
  box-shadow: 0 0 0 4px rgba(181, 234, 215, 0.3);
}

.char-count {
  font-size: 0.875rem;
  color: #999;
  display: block;
  text-align: right;
  margin-top: 8px;
}

/* Color Grid */
.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 16px;
  padding: 8px 0;
}

.color-circle {
  position: relative;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 4px solid white;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  padding: 0;
  background: none;
  overflow: visible;
  appearance: none;
  -webkit-appearance: none;
}

.color-circle-img,
.color-circle-fill {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.color-circle:hover {
  transform: scale(1.1);
  z-index: 10;
}

.color-circle.selected {
  transform: scale(1.2);
  box-shadow: 0 12px 24px rgba(0,0,0,0.15);
  z-index: 10;
  border-color: white;
}

.color-circle.selected::after {
  content: '';
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border: 2px solid var(--color-text);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.5; }
  50% { transform: scale(1.05); opacity: 0.2; }
  100% { transform: scale(0.95); opacity: 0.5; }
}

.color-circle .color-name {
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  background: white;
  padding: 4px 10px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 20;
}

.color-circle.selected .color-name,
.color-circle:hover .color-name {
  opacity: 1;
}

.color-circle .color-price {
  display: none;
}

/* Options Grid - Large Cards */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-md);
}

.option-wrapper {
  display: flex;
  flex-direction: column;
}

.option-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--spacing-md);
  border: 2px solid #f0f0f0;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.3s ease;
  background: white;
  position: relative;
  overflow: hidden;
  margin-bottom: 0;
}

.option-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.06);
  border-color: var(--color-secondary);
}

.option-item.selected {
  border-color: var(--color-primary);
  background: rgba(255, 183, 178, 0.05);
  box-shadow: 0 12px 24px rgba(255, 183, 178, 0.15);
}

.option-item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* Custom Checkmark */
.option-item::after {
  content: '✓';
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  background: var(--color-primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 12px rgba(255, 183, 178, 0.4);
  z-index: 5;
}

.option-item.selected::after {
  opacity: 1;
  transform: scale(1);
}

.option-image {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
  background: #f9f9f9;
  transition: transform 0.3s ease;
}

.option-item:hover .option-image {
  transform: scale(1.05);
}

.option-info {
  width: 100%;
}

.option-name {
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
  font-size: 1.1rem;
}

.option-description {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 8px;
  display: block;
  line-height: 1.4;
}

.option-price {
  font-weight: 700;
  color: var(--color-primary);
  font-size: 1.1rem;
  display: block;
  margin-top: auto;
}

/* Price Summary */
.price-summary {
  background: #f9f9f9;
  padding: var(--spacing-lg);
  border-radius: var(--radius-lg);
  margin: var(--spacing-xl) 0;
}

.price-line {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  color: #666;
  font-size: 1.1rem;
}

.price-total {
  display: flex;
  justify-content: space-between;
  padding: 16px 0 0;
  margin-top: 16px;
  border-top: 2px solid rgba(0,0,0,0.05);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-text);
}

/* Button */
.btn-large {
  width: 100%;
  padding: 20px 32px;
  font-size: 1.25rem;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(255, 183, 178, 0.4);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-large:hover:not(:disabled) {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 15px 40px rgba(255, 183, 178, 0.6);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* Mobile Responsive */
@media (max-width: 600px) {
  .customize-section {
    padding: var(--spacing-lg) 0;
  }

  .customize-form {
    padding: var(--spacing-md);
    box-shadow: none;
    background: transparent;
    border: none;
  }

  .options-grid {
    grid-template-columns: 1fr; /* Stack cards on mobile */
  }

  .option-image {
    height: 180px; /* Even larger images on mobile */
  }

  .customize-title {
    font-size: 2rem;
  }

  .sample-config-content {
    flex-direction: column;
    text-align: center;
    padding: var(--spacing-md);
  }

  .sample-config-icon {
    font-size: 2rem;
  }

  .sample-config-title {
    font-size: 1.1rem;
  }

  .sample-config-description {
    font-size: 0.95rem;
  }
}

/* Sub-options Styles */
.sub-options {
  margin-top: 0; /* Connect seamlessly without gap */
  padding: 0 16px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s ease,
              padding 0.3s ease,
              visibility 0.4s,
              transform 0.3s ease,
              box-shadow 0.3s ease;
  background: #fff;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  border: 2px solid var(--color-primary);
  border-top: none;
  width: 100%;
  box-sizing: border-box;
  z-index: 1;
  position: relative;
}

/* Override global hidden class to allow transition */
.sub-options.hidden {
  display: block !important;
  max-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  opacity: 0 !important;
  visibility: hidden !important;
  border-width: 0 2px 0 2px; /* Keep side borders to prevent layout jump? No, hide border */
  border: none;
}

/* Adjust card when selected to merge with sub-options */
.option-wrapper {
  transition: transform 0.3s ease;
}

.option-item {
  z-index: 2;
  position: relative;
  transition: border-radius 0.3s ease, border-color 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Only remove radius if followed by a visible sub-options panel */
.option-wrapper:has(.sub-options:not(.hidden)) .option-item.selected {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent; /* Make border invisible for seamless merge */
}

/* Ensure sub-options panel connects seamlessly */
.sub-options:not(.hidden) {
  max-height: 500px;
  opacity: 1;
  visibility: visible;
  padding: 16px;
  border: 2px solid var(--color-primary);
  border-top: none;
  margin-top: -12px; /* Stronger overlap to eliminate gap caused by borders */
  box-shadow: 0 12px 24px rgba(255, 183, 178, 0.15); /* Match card shadow */
}

/* Add hover effect to sub-options to make it feel like one button */
.option-wrapper:hover .sub-options:not(.hidden) {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px rgba(255, 183, 178, 0.2);
}

.sub-option-group {
  margin-bottom: 12px;
}

.sub-option-group:last-child {
  margin-bottom: 0;
}

.sub-option-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--color-text);
}

.sub-option-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background-color: #f9f9f9;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' 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 12px center;
}

.sub-option-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(255, 183, 178, 0.2);
  background-color: white;
}

/* Utility */
.hidden {
  display: none !important;
}

/* Selected Color Label */
.selected-color-label {
  font-weight: bold;
  color: #666;
}

/* Sub-option Color Swatches */
.sub-option-colors {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.sub-color-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  padding: 0;
}

.sub-color-circle:hover {
  transform: scale(1.1);
}

.sub-color-circle.selected {
  transform: scale(1.2);
  box-shadow: 0 0 0 2px var(--color-primary);
  border-color: #fff;
}

.selected-sub-val {
  font-weight: normal;
  color: var(--color-primary);
  margin-left: 4px;
}
