/* Base styles */
.petgen-wrap {
  max-width: 100%;
  margin: 32px auto;
  padding: 0 16px;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: #1f2937;
}

.petgen-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 22px 20px;
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
}

.petgen-title {
  margin: 4px 0 16px;
  font-size: 34px;
  line-height: 1.2;
  text-align: center;
  font-weight: 800;
  color: #111827;
}

/* Form layout */
.petgen-form {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
  -webkit-overflow-scrolling: touch;
}

.petgen-field {
  grid-column: span 12;
}

/* Inputs */
.petgen-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #374151;
}

.petgen-input {
  width: 100%;
  padding: 12px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f9fafb;
  color: #1f2937;
  outline: none;
  font-size: 15px;
}

.petgen-input:focus {
  border-color: #4e8ef7;
  box-shadow: 0 0 0 3px rgba(78, 142, 247, 0.15);
}

/* Gender Pills */
.petgen-toggle {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.petgen-pill {
  flex: 1;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  font-weight: 500;
  font-size: 15px;
}

.petgen-pill:hover {
  transform: translateY(-1px);
  background: #f3f4f6;
}

.petgen-pill.is-active {
  background: #4e8ef7;
  border-color: #4e8ef7;
  color: #fff;
  box-shadow: 0 6px 18px rgba(78, 142, 247, 0.25);
}

/* Buttons */
.petgen-actions {
  grid-column: span 12;
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.petgen-btn {
  appearance: none;
  border: 1px solid #e5e7eb;
  background: #e7f0ff;
  color: #0b1d41;
  padding: 14px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 700;
  width: 100%;
  max-width: 200px;
  font-size: 15px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.petgen-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.petgen-primary {
  background: #4e8ef7;
  border-color: #4e8ef7;
  color: #fff;
}

.petgen-primary:hover {
  background: #3b7df8;
}

.petgen-ghost {
  background: #f0f4ff;
  color: #1f3b7b;
}

.petgen-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Output */
.petgen-meta {
  margin: 16px 0 8px;
  color: #6b7280;
  font-size: 14px;
  text-align: center;
}

.petgen-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.petgen-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: #f8fbff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 16px;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
}

.petgen-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
  border-color: #cbd5e1;
}

.petgen-name {
  font-weight: 600;
  color: #0b1d41;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.petgen-copy {
  border: none;
  background: #e7f0ff;
  color: #1f3b7b;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.petgen-copy:hover {
  background: #d9e8ff;
  transform: translateY(-1px);
}

.petgen-copy:active {
  transform: translateY(0);
}

.petgen-error {
  margin-top: 16px;
  padding: 12px 16px;
  background: #fef2f2;
  color: #b91c1c;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  border-left: 4px solid #dc2626;
  display: none;
}

/* Loading state */
.petgen-form.is-submitting {
  position: relative;
  pointer-events: none;
}

.petgen-form.is-submitting:after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.7);
  z-index: 10;
  border-radius: 12px;
}

.petgen-btn.loading {
  color: transparent !important;
  position: relative;
}

.petgen-btn.loading:after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin: -10px 0 0 -10px;
  border: 2px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 767px) {
  .petgen-card {
    padding: 18px 16px;
    border-radius: 12px;
  }
  
  .petgen-title {
    font-size: 28px;
    margin-bottom: 20px;
  }
  
  .petgen-form {
    gap: 12px;
  }
  
  .petgen-pill {
    padding: 10px 12px;
    font-size: 14px;
  }
  
  .petgen-actions {
    flex-direction: column;
    gap: 8px;
  }
  
  .petgen-btn {
    width: 100%;
    max-width: none;
    padding: 12px 16px;
  }
  
  .petgen-list {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .petgen-item {
    padding: 10px 14px;
  }
  
  .petgen-copy {
    padding: 6px 10px;
    font-size: 12px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .petgen-card {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  }
  
  .petgen-title {
    color: #f8fafc;
  }
  
  .petgen-input {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
  }
  
  .petgen-pill {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
  }
  
  .petgen-pill.is-active {
    background: #4e8ef7;
    border-color: #4e8ef7;
    color: #fff;
  }
  
  .petgen-item {
    background: #1e293b;
    border-color: #334155;
  }
  
  .petgen-name {
    color: #e2e8f0;
  }
  
  .petgen-copy {
    background: #334155;
    color: #e2e8f0;
  }
  
  .petgen-copy:hover {
    background: #3b82f6;
    color: white;
  }
  
  .petgen-ghost {
    background: #334155;
    color: #e2e8f0;
  }
  
  .petgen-meta {
    color: #94a3b8;
  }
  
  .petgen-form.is-submitting:after {
    background: rgba(30, 41, 59, 0.7);
  }
}