/* === Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* === Header === */
header {
  text-align: center;
  margin-bottom: 32px;
}

header h1 {
  font-size: 1.8rem;
  color: #E60023;
}

.subtitle {
  color: #666;
  margin-top: 4px;
}

/* === Areas === */
.areas {
  display: grid;
  gap: 24px;
}

.area {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.area h2 {
  font-size: 1.1rem;
  margin-bottom: 4px;
  color: #222;
}

.guide {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 14px;
  line-height: 1.5;
}

#area-action {
  margin-top: 0;
}

/* === Input group === */
.input-group {
  display: flex;
  gap: 8px;
}

.input-group input {
  flex: 1;
}

input[type="url"],
input[type="text"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #E60023;
}

input[readonly] {
  background: #f9f9f9;
  color: #666;
}

label {
  display: block;
  font-size: 0.85rem;
  color: #666;
  margin: 12px 0 4px;
}

/* === Buttons === */
button {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  white-space: nowrap;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#btn-generate {
  background: #E60023;
  color: #fff;
}

#btn-generate:hover:not(:disabled) {
  background: #c4001d;
}

.btn-pinterest {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #E60023;
  color: #fff;
  padding: 12px 24px;
  font-size: 1rem;
  width: 100%;
  justify-content: center;
}

.btn-pinterest:hover {
  background: #c4001d;
}

#btn-create-pin {
  background: #E60023;
  color: #fff;
  width: 100%;
  padding: 14px;
  font-size: 1.05rem;
  font-weight: 600;
}

#btn-create-pin:hover:not(:disabled) {
  background: #c4001d;
}

.btn-secondary {
  background: #eee;
  color: #333;
  margin-top: 12px;
}

.btn-secondary:hover {
  background: #ddd;
}

/* === Product card === */
.product-card {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #eee;
  border-radius: 8px;
  background: #fafafa;
}

.image-area {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.product-card img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}

.image-actions {
  display: flex;
  gap: 6px;
}

.btn-image {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: 6px;
  background: #eee;
  color: #555;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s;
}

.btn-image:hover {
  background: #ddd;
}

.product-details {
  flex: 1;
  min-width: 0;
}

.product-meta {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.85rem;
  color: #888;
}

/* === Badge === */
.badge-connected {
  display: inline-block;
  background: #e8f5e9;
  color: #2e7d32;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  margin-bottom: 12px;
}

/* === Status messages === */
.error {
  color: #d32f2f;
  background: #fde8e8;
  padding: 10px 14px;
  border-radius: 8px;
  margin-top: 12px;
  font-size: 0.9rem;
}

.success {
  background: #e8f5e9;
  padding: 16px;
  border-radius: 8px;
  margin-top: 16px;
  text-align: center;
}

.success p {
  color: #2e7d32;
  font-weight: 600;
  font-size: 1.1rem;
}

.success a {
  display: inline-block;
  margin-top: 8px;
  color: #E60023;
  font-weight: 600;
  text-decoration: none;
}

.success a:hover {
  text-decoration: underline;
}

.loading {
  color: #666;
  padding: 10px 0;
  font-size: 0.9rem;
}

/* === Spinner === */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #ddd;
  border-top-color: #E60023;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === Select === */
select {
  appearance: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 12px center;
  padding-right: 36px;
}

select:disabled {
  background-color: #f0f0f0;
  color: #999;
  cursor: not-allowed;
}

/* === Footer === */
footer {
  text-align: center;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

footer a {
  color: #888;
  text-decoration: none;
  font-size: 0.85rem;
}

footer a:hover {
  color: #E60023;
}

/* === Responsive === */
@media (max-width: 599px) {
  .product-card {
    flex-direction: column;
    align-items: center;
  }

  .product-card img {
    width: 100%;
    max-width: 200px;
    height: auto;
  }

  .image-actions {
    flex-direction: column;
  }
}
