/* Grande AI Ecomm Tool — matching grandeaihub.com style */

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

body {
  font-family: "Noto Sans SC", "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: #e8e6df;
  color: #1a1a1a;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Layout ────────────────────────────────────────────────── */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* ── Header ────────────────────────────────────────────────── */
.header {
  text-align: center;
  margin-bottom: 40px;
}

.header-brand {
  font-family: "Noto Serif SC", Georgia, serif;
  font-size: 14px;
  color: #374151;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.header-title {
  font-family: "Noto Serif SC", Georgia, serif;
  font-size: 28px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 8px;
}

.header-desc {
  font-size: 15px;
  color: #374151;
}

/* ── Card ──────────────────────────────────────────────────── */
.card {
  background: #faf9f6;
  border: 1px solid #d8d6cf;
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* ── Form ──────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 24px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #1a1a1a;
  margin-bottom: 8px;
}

.form-hint {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 6px;
}

/* Upload area */
.upload-area {
  border: 2px dashed #d8d6cf;
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
  position: relative;
}

.upload-area:hover {
  border-color: #9ca3af;
  background-color: #f5f4f0;
}

.upload-area.has-file {
  border-style: solid;
  border-color: #9ca3af;
}

.upload-icon {
  font-size: 32px;
  color: #9ca3af;
  margin-bottom: 8px;
}

.upload-text {
  font-size: 14px;
  color: #6b7280;
}

.upload-preview {
  max-width: 100%;
  max-height: 200px;
  border-radius: 4px;
  display: none;
}

.upload-area.has-file .upload-placeholder {
  display: none;
}

.upload-area.has-file .upload-preview {
  display: block;
  margin: 0 auto;
}

input[type="file"] {
  display: none;
}

/* Text input */
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  color: #1a1a1a;
  background: #fff;
  border: 1px solid #d8d6cf;
  border-radius: 6px;
  transition: border-color 0.2s;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: #9ca3af;
}

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

/* Select options (pills) */
.option-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option-pill {
  padding: 8px 16px;
  font-size: 14px;
  border: 1px solid #d8d6cf;
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
  color: #374151;
}

.option-pill:hover {
  border-color: #9ca3af;
  background: #f5f4f0;
}

.option-pill.active {
  background: #1a1a1a;
  color: #faf9f6;
  border-color: #1a1a1a;
}

/* ── Button ────────────────────────────────────────────────── */
.btn-generate {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-family: inherit;
  font-weight: 500;
  color: #faf9f6;
  background: #1a1a1a;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-generate:hover {
  background: #333;
}

.btn-generate:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

/* ── Preview Button ───────────────────────────────────────── */
.btn-preview {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  font-weight: 500;
  color: #374151;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-bottom: 12px;
}

.btn-preview:hover {
  background: #e5e7eb;
}

.btn-preview:disabled {
  color: #9ca3af;
  cursor: not-allowed;
}

.preview-section {
  display: none;
  margin-top: 12px;
}

.preview-section.visible {
  display: block;
}

.preview-image {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

/* ── Progress ──────────────────────────────────────────────── */
.progress-section {
  display: none;
  margin-top: 24px;
  text-align: center;
}

.progress-section.visible {
  display: block;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #d8d6cf;
  border-top-color: #1a1a1a;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

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

.progress-text {
  font-size: 14px;
  color: #6b7280;
}

/* ── Result ────────────────────────────────────────────────── */
.result-section {
  display: none;
  margin-top: 24px;
}

.result-section.visible {
  display: block;
}

.result-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.result-image {
  width: 100%;
  border-radius: 6px;
  border: 1px solid #d8d6cf;
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.result-image:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-download {
  display: inline-block;
  padding: 10px 24px;
  font-size: 14px;
  font-family: inherit;
  color: #1a1a1a;
  background: #fff;
  border: 1px solid #d8d6cf;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  margin-right: 8px;
  margin-bottom: 8px;
}

.btn-download:hover {
  border-color: #1a1a1a;
  background: #f5f4f0;
}

.btn-retry {
  display: inline-block;
  padding: 10px 24px;
  font-size: 14px;
  font-family: inherit;
  color: #faf9f6;
  background: #1a1a1a;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-retry:hover {
  background: #333;
}

/* ── Error ─────────────────────────────────────────────────── */
.error-section {
  display: none;
  margin-top: 24px;
  padding: 16px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  color: #991b1b;
  font-size: 14px;
}

.error-section.visible {
  display: block;
}

/* ── History ───────────────────────────────────────────────── */
.history-title {
  font-family: "Noto Serif SC", Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  color: #1a1a1a;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.history-item {
  padding: 16px;
  border: 1px solid #d8d6cf;
  border-radius: 6px;
  background: #fff;
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.history-time {
  font-size: 13px;
  font-family: "IBM Plex Mono", monospace;
  color: #6b7280;
}

.history-status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
}

.history-status--success {
  background: #ecfdf5;
  color: #065f46;
}

.history-status--failed {
  background: #fef2f2;
  color: #991b1b;
}

.history-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.history-image-wrapper {
  text-align: center;
}

.history-image {
  width: 100%;
  border-radius: 4px;
  border: 1px solid #d8d6cf;
}

.history-download {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  color: #6b7280;
  text-decoration: none;
}

.history-download:hover {
  color: #1a1a1a;
}

.history-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.history-tag {
  font-size: 12px;
  padding: 2px 8px;
  background: #f3f4f6;
  border-radius: 4px;
  color: #374151;
}

.btn-reuse {
  font-size: 13px;
  font-family: inherit;
  padding: 6px 14px;
  color: #374151;
  background: transparent;
  border: 1px solid #d8d6cf;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-reuse:hover {
  border-color: #1a1a1a;
  color: #1a1a1a;
}

/* ── Contact Modal ────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.visible {
  display: flex;
}

.modal-content {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  max-width: 360px;
  width: 90%;
  text-align: center;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px; right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: #9ca3af;
  cursor: pointer;
}

.modal-close:hover {
  color: #374151;
}

.modal-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 20px;
  margin-bottom: 8px;
  color: #1a1a1a;
}

.modal-desc {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 20px;
}

.modal-qr {
  width: 200px;
  height: auto;
  border-radius: 8px;
  margin-bottom: 16px;
}

.modal-email a {
  color: #3b82f6;
  text-decoration: none;
  font-size: 14px;
}

.modal-email a:hover {
  text-decoration: underline;
}

/* ── CTA Banner ───────────────────────────────────────────── */
.cta-banner {
  text-align: center;
  margin-top: 32px;
  padding: 14px 20px;
  background: linear-gradient(135deg, #1a1a1a 0%, #374151 100%);
  border-radius: 10px;
}

.cta-banner a {
  color: #fff;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.cta-banner a:hover {
  text-decoration: underline;
}

/* ── Footer ────────────────────────────────────────────────── */
.footer {
  text-align: center;
  margin-top: 40px;
  font-size: 13px;
  color: #9ca3af;
}

.footer a {
  color: #6b7280;
  text-decoration: none;
}

.footer a:hover {
  color: #1a1a1a;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 640px) {
  .container {
    padding: 24px 16px;
  }

  .card {
    padding: 20px;
  }

  .header-title {
    font-size: 22px;
  }
}
