* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: hsl(0 0% 100%);
  min-height: 100vh;
  color: hsl(222.2 84% 4.9%);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  margin-bottom: 40px;
}

header h1 {
  font-size: 2.25rem;
  font-weight: 600;
  color: #505ab4;
  margin-bottom: 0.5rem;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

header p {
  font-size: 1rem;
  color: hsl(215.4 16.3% 46.9%);
  font-weight: 400;
}

.configurator {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 40px;
  align-items: start;
}

.preview-section {
  background: hsl(0 0% 100%);
  border: 1px solid hsl(214.3 31.8% 91.4%);
  border-top: 3px solid #505ab4;
  border-radius: 0.5rem;
  padding: 2rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  position: sticky;
  top: 20px;
}

.doormat-preview {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
  background: hsl(210 40% 98%);
  border-radius: 0.375rem;
  padding: 2.5rem;
}

.doormat-surface {
  width: 300px;
  height: 200px;
  background-color: #333333;
  border-radius: 0.375rem;
  position: relative;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  overflow: hidden;
  transition: all 150ms ease-out;
}

.doormat-surface::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    45deg,
    transparent 48%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 52%
  );
  pointer-events: none;
}

.logo-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.3s ease;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.controls-section {
  background: hsl(0 0% 100%);
  border: 1px solid hsl(214.3 31.8% 91.4%);
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.upload-area {
  border: 2px dashed hsl(214.3 31.8% 91.4%);
  border-radius: 0.5rem;
  padding: 2rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: all 150ms ease-out;
  background: hsl(0 0% 100%);
  margin-bottom: 1.5rem;
}

.upload-area:hover {
  border-color: #505ab4;
  background: rgba(80, 90, 180, 0.05);
}

.upload-area.dragover {
  border-color: #505ab4;
  background: rgba(80, 90, 180, 0.1);
}

.upload-content {
  pointer-events: none;
}

.upload-icon {
  width: 3rem;
  height: 3rem;
  color: #505ab4;
  margin-bottom: 1rem;
}

.upload-area p {
  font-size: 0.875rem;
  color: hsl(222.2 84% 4.9%);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.file-types {
  font-size: 0.75rem;
  color: hsl(215.4 16.3% 46.9%);
}

.template-options {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border: 1px solid hsl(214.3 31.8% 91.4%);
  border-radius: 0.5rem;
  background: hsl(210 40% 98%);
}

.template-label {
  font-size: 0.875rem;
  color: hsl(222.2 84% 4.9%);
  font-weight: 500;
  margin-bottom: 0.75rem;
  text-align: center;
}

.template-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem;
  background: hsl(0 0% 100%);
  border: 1px solid hsl(214.3 31.8% 91.4%);
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 150ms ease-out;
  font-size: 0.875rem;
  color: hsl(222.2 84% 4.9%);
}

.template-btn:hover {
  border-color: #505ab4;
  background: rgba(80, 90, 180, 0.05);
}

.template-logo-preview {
  width: 2rem;
  height: 2rem;
  object-fit: contain;
  border-radius: 0.25rem;
}

/* Pickup Frequency Styling */
.control-group:has(#pickupFrequency) {
  position: relative;
}

.control-group:has(#pickupFrequency)::after {
  position: absolute;
  right: 2.5rem;
  top: 2rem;
  font-size: 1rem;
  opacity: 0.6;
  pointer-events: none;
}

#pickupFrequency:not([value="one-time"]) {
  border-left: 3px solid #505ab4;
  background: rgba(80, 90, 180, 0.02);
}

.controls-panel {
  margin-bottom: 1.5rem;
}

.control-group {
  margin-bottom: 1.5rem;
}

.control-group label {
  display: block;
  font-weight: 500;
  color: hsl(222.2 84% 4.9%);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.slider {
  width: 100%;
  height: 4px;
  border-radius: 9999px;
  background: hsl(214.3 31.8% 91.4%);
  outline: none;
  -webkit-appearance: none;
  margin-bottom: 0.5rem;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: #505ab4;
  cursor: pointer;
  border: 2px solid hsl(0 0% 100%);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  transition: all 150ms ease-out;
}

.slider::-webkit-slider-thumb:hover {
  background: #3f4999;
  box-shadow: 0 4px 6px -1px rgba(80, 90, 180, 0.2),
    0 2px 4px -2px rgba(80, 90, 180, 0.1);
}

.slider::-moz-range-thumb {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: #505ab4;
  cursor: pointer;
  border: 2px solid hsl(0 0% 100%);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.value-display {
  float: right;
  font-weight: 500;
  color: #505ab4;
  font-size: 0.75rem;
}

.color-options {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.color-option {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.375rem;
  border: 2px solid hsl(214.3 31.8% 91.4%);
  cursor: pointer;
  transition: all 150ms ease-out;
}

.color-option:hover {
  border-color: hsl(215.4 16.3% 46.9%);
}

.color-option.active {
  border-color: #505ab4;
  box-shadow: 0 0 0 2px rgba(80, 90, 180, 0.3);
}

.select-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid hsl(214.3 31.8% 91.4%);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  background: hsl(0 0% 100%);
  cursor: pointer;
  transition: all 150ms ease-out;
  color: hsl(222.2 84% 4.9%);
}

.select-input:focus {
  outline: none;
  border-color: #505ab4;
  box-shadow: 0 0 0 2px rgba(80, 90, 180, 0.2);
}

.reset-btn {
  width: 100%;
  padding: 0.5rem 1rem;
  background: hsl(0 0% 100%);
  border: 1px solid hsl(214.3 31.8% 91.4%);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 150ms ease-out;
  color: hsl(222.2 84% 4.9%);
  font-weight: 500;
}

.reset-btn:hover {
  background: hsl(210 40% 98%);
  border-color: hsl(214.3 31.8% 87%);
}

.action-buttons {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn {
  flex: 1;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms ease-out;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: #505ab4;
  color: hsl(210 40% 98%);
  box-shadow: 0 1px 2px 0 rgba(80, 90, 180, 0.2);
}

.btn-primary:hover {
  background: #3f4999;
  box-shadow: 0 1px 3px 0 rgba(80, 90, 180, 0.3),
    0 1px 2px -1px rgba(80, 90, 180, 0.2);
}

.btn-primary:active {
  background: #363f85;
}

.btn-secondary {
  background: hsl(0 0% 100%);
  color: #505ab4;
  border: 1px solid #505ab4;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.btn-secondary:hover {
  background: rgba(80, 90, 180, 0.05);
  border-color: #3f4999;
  color: #3f4999;
}

/* Responsive Design */
@media (max-width: 768px) {
  .configurator {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .preview-section {
    position: static;
    order: 2;
  }

  .controls-section {
    order: 1;
  }

  .doormat-surface {
    width: 250px;
    height: 167px;
  }

  .action-buttons {
    flex-direction: column;
  }

  header h1 {
    font-size: 2rem;
  }

  .container {
    padding: 15px;
  }
}

/* Animation for logo upload */
@keyframes logoAppear {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.logo-container img.appear {
  animation: logoAppear 0.5s ease-out;
}

/* Material Textures */
.rubber-texture::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(
      circle at 2px 2px,
      rgba(255, 255, 255, 0.1) 1px,
      transparent 0
    ),
    radial-gradient(circle at 8px 8px, rgba(0, 0, 0, 0.05) 1px, transparent 0);
  background-size: 10px 10px, 16px 16px;
  pointer-events: none;
}

.coir-texture::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: linear-gradient(
      90deg,
      rgba(139, 69, 19, 0.1) 1px,
      transparent 1px
    ),
    linear-gradient(rgba(160, 82, 45, 0.1) 1px, transparent 1px);
  background-size: 4px 4px, 2px 6px;
  opacity: 0.8;
  pointer-events: none;
}

.synthetic-texture::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.05) 25%,
      transparent 25%
    ),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.05) 25%, transparent 25%);
  background-size: 8px 8px;
  pointer-events: none;
}

.jute-texture::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: linear-gradient(
      0deg,
      rgba(139, 69, 19, 0.08) 1px,
      transparent 1px
    ),
    linear-gradient(90deg, rgba(160, 82, 45, 0.06) 1px, transparent 1px);
  background-size: 3px 3px, 5px 5px;
  opacity: 0.9;
  pointer-events: none;
}
