/* ─────────────────────────────────────────────
   Rayhans_Creative — Greeting Card Maker
   Minimal CSS — Bangla-first typography
   ───────────────────────────────────────────── */

/* ── Reset & Base ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --accent:       #5a3ec6;
  --accent-dark:  #4a30b0;
  --accent-light: #ede9fb;
  --accent-glow:  rgba(90,62,198,.28);
  --text-primary: #1A1A2E;
  --text-muted:   #6B7280;
  --border:       #E5E7EB;
  --bg-page:      #F2F4F7;
  --bg-card:      #FFFFFF;
  --radius:       14px;
  --radius-sm:    9px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-sm:    0 1px 2px rgba(0,0,0,.06);
  --shadow-md:    0 4px 20px rgba(0,0,0,.10), 0 1px 4px rgba(0,0,0,.05);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.13), 0 2px 8px rgba(0,0,0,.07);
  --transition:   .18s ease;
}

html { font-size: 16px; }

body {
  font-family: 'Hind Siliguri', 'Poppins', sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input  { font-family: 'Hind Siliguri', 'Poppins', sans-serif; }

/* ── Layout ───────────────────────────────── */
.container {
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Header ───────────────────────────────── */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.site-header .container {
  display: flex;
  align-items: center;
}

.brand { display: flex; align-items: baseline; gap: 12px; }

.brand-name {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
  letter-spacing: -.02em;
}

.brand-name .accent { color: var(--accent); }

.brand-tag {
  font-size: .75rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-light);
  padding: 2px 10px;
  border-radius: 20px;
}

/* ── Hero ─────────────────────────────────── */
.hero {
  background: linear-gradient(150deg, #0D0D23 0%, #1A1A2E 45%, #16213E 100%);
  color: #fff;
  padding: 48px 0 44px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(90,62,198,.18) 0%, transparent 65%);
  top: -160px;
  right: -80px;
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(90,62,198,.12) 0%, transparent 65%);
  bottom: -100px;
  left: -60px;
  pointer-events: none;
}

.hero .container { position: relative; z-index: 1; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(90,62,198,.20);
  border: 1px solid rgba(90,62,198,.35);
  color: #b9a8f5;
  font-size: .75rem;
  font-weight: 600;
  font-family: 'Poppins', sans-serif;
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 16px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.hero-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #7c5fe6;
  border-radius: 50%;
  animation: pulse-dot 1.6s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .5; transform: scale(.7); }
}

.hero-title {
  font-size: clamp(1.6rem, 4vw, 2.15rem);
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -.01em;
}

.hero-sub {
  font-size: .95rem;
  color: rgba(255,255,255,.65);
  max-width: 420px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ── Existing card banner ─────────────────── */
.existing-banner {
  background: var(--accent-light);
  border: 1px solid #c9bef7;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  margin: 20px auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .9rem;
}

.existing-banner p { flex: 1; }

/* ── Main — two columns ───────────────────── */
.main {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 28px;
  padding-top: 32px;
  padding-bottom: 48px;
  flex: 1;
  align-items: start;
}

/* ── Step number badge ────────────────────── */
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: .7rem;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  margin-right: 5px;
  flex-shrink: 0;
  vertical-align: middle;
}

.step-num--go {
  background: linear-gradient(135deg, #5a3ec6, #4a30b0);
  box-shadow: 0 0 0 3px rgba(90,62,198,.18);
}

/* ── Optional tag ─────────────────────────── */
.optional-tag {
  font-size: .7rem;
  font-weight: 500;
  color: var(--text-muted);
  background: #F3F4F6;
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 4px;
  vertical-align: middle;
  font-family: 'Poppins', sans-serif;
}

/* ── Controls panel ───────────────────────── */
.controls-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Field group ──────────────────────────── */
.field-group { display: flex; flex-direction: column; gap: 8px; }

.field-label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.required { color: var(--accent); }

/* ── Upload zone ──────────────────────────── */
.upload-zone {
  background: linear-gradient(145deg, #3b2aaa 0%, #281d7a 100%);
  border: 2px dashed rgba(255,255,255,.18);
  border-radius: var(--radius-sm);
  padding: 36px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  user-select: none;
  position: relative;
  overflow: hidden;
}

.upload-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 60%, rgba(90,62,198,.12) 0%, transparent 70%);
  pointer-events: none;
}

.upload-zone:hover,
.upload-zone:focus {
  border-color: var(--accent);
  outline: none;
}

.upload-zone:hover::before,
.upload-zone:focus::before {
  background: radial-gradient(ellipse at 50% 60%, rgba(90,62,198,.22) 0%, transparent 70%);
}

.upload-zone.drag-over {
  border-color: var(--accent);
}

.upload-zone.drag-over::before {
  background: radial-gradient(ellipse at 50% 60%, rgba(90,62,198,.28) 0%, transparent 70%);
}

.upload-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.upload-icon {
  width: 52px;
  height: 52px;
  color: var(--accent);
  opacity: .90;
}

.upload-hint {
  font-size: 1rem;
  color: #fff;
  font-weight: 600;
}

.upload-hint-sub {
  font-size: .8rem;
  color: rgba(255,255,255,.55);
  font-weight: 400;
}

.upload-formats {
  font-size: .72rem;
  color: rgba(255,255,255,.35);
  font-family: 'Poppins', sans-serif;
}

.upload-ready {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 1;
}

.check-icon {
  width: 28px;
  height: 28px;
  color: #22C55E;
}

#uploadFileName {
  font-size: .85rem;
  color: #fff;
  font-weight: 500;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Text input ───────────────────────────── */
.text-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.text-input::placeholder { color: #9CA3AF; }

.text-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(90,62,198,.12);
}

/* ── Buttons ──────────────────────────────── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, #6b52d4 0%, #4a30b0 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(90,62,198,.25);
  transition: background var(--transition), transform var(--transition),
              opacity var(--transition), box-shadow var(--transition);
}

.btn-primary svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #7c5fe6 0%, #5a3ec6 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(90,62,198,.40);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(90,62,198,.25);
}

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

.btn-ghost {
  padding: 10px 20px;
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  transition: border-color var(--transition), color var(--transition);
}

.btn-ghost:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.btn-text {
  background: none;
  border: none;
  color: var(--accent);
  font-size: .85rem;
  font-weight: 600;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-text:hover { color: var(--accent-dark); }

.btn-reupload {
  font-size: .8rem;
  color: #e2d9fc;
  text-decoration-color: rgba(226,217,252,.5);
}
.btn-reupload:hover { color: #fff; }

/* ── Preview panel ────────────────────────── */
.preview-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.preview-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  position: relative;
  transition: box-shadow .3s ease, border-color .3s ease;
}

.preview-box.has-card {
  border-color: rgba(90,62,198,.25);
  box-shadow: var(--shadow-lg), 0 0 0 3px rgba(90,62,198,.10);
}

.preview-mask-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  z-index: 2;
}

.preview-empty {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #D1D5DB;
}

.preview-empty svg {
  width: 60px;
  height: 60px;
}

.preview-empty p {
  font-size: .9rem;
  color: #9CA3AF;
}

.preview-img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Card actions ─────────────────────────── */
.card-actions {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.btn-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  background: linear-gradient(135deg, #6b52d4 0%, #4a30b0 100%);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(90,62,198,.25);
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn-download svg {
  width: 18px;
  height: 18px;
}

.btn-download:hover {
  background: linear-gradient(135deg, #7c5fe6 0%, #5a3ec6 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(90,62,198,.40);
}

/* ── Share row ────────────────────────────── */
.share-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.share-label {
  font-size: .85rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.share-icons {
  display: flex;
  gap: 10px;
}

.share-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition), opacity var(--transition);
}

.share-btn svg { width: 20px; height: 20px; }

.share-btn:hover { transform: scale(1.12); opacity: .9; }

.share-fb     { background: #1877F2; color: #fff; }
.share-wa     { background: #25D366; color: #fff; }
.share-tg     { background: #229ED9; color: #fff; }
.share-native { background: var(--accent); color: #fff; }

/* ── Footer ───────────────────────────────── */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 18px 0;
  text-align: center;
  font-size: .82rem;
  color: var(--text-muted);
  margin-top: auto;
}

/* ── Crop Modal ───────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-backdrop[hidden] { display: none; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 840px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  overflow: hidden;
  animation: slideUp .2s ease;
}

@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-head {
  padding: 20px 24px 0;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.modal-body {
  padding: 16px 24px;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  align-items: start;
}

/* ── Crop left pane ───────────────────────── */
.crop-left-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cropper-wrap {
  max-height: 380px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: #000;
}

.cropper-wrap img { display: block; max-width: 100%; }

.crop-hint {
  font-size: .8rem;
  color: var(--text-muted);
  text-align: center;
}

/* ── Zoom slider row ──────────────────────── */
.zoom-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}

.zoom-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-muted);
}

#zoomSlider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, var(--accent) 0%, var(--border) 0%);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

#zoomSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  cursor: pointer;
}

#zoomSlider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  cursor: pointer;
}

/* ── Crop right pane ──────────────────────── */
.crop-right-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.crop-preview-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .05em;
}

#cropPreviewCanvas {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  display: block;
  background: #000;
  box-shadow: var(--shadow-sm);
}

.modal-foot {
  padding: 16px 24px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border);
}

/* ── Loading overlay ──────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.82);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 2000;
  backdrop-filter: blur(2px);
}

.loading-overlay[hidden] { display: none; }

.loading-overlay p {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* ── Responsive ───────────────────────────── */

/* Narrow desktop / large tablet */
@media (max-width: 1024px) {
  .main {
    grid-template-columns: 300px 1fr;
    gap: 20px;
  }
}

/* Tablet / phablet */
@media (max-width: 768px) {
  html { font-size: 15px; }

  .container { padding: 0 16px; }

  .hero { padding: 32px 0 28px; }
  .hero-title { font-size: clamp(1.35rem, 5vw, 1.7rem); }
  .hero-sub { font-size: .88rem; }

  .existing-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    font-size: .85rem;
  }

  .main {
    grid-template-columns: 1fr;
    padding-top: 20px;
    padding-bottom: 32px;
    gap: 16px;
  }

  .controls-panel { padding: 22px 18px; gap: 16px; }

  .preview-box { aspect-ratio: 1 / 1; max-width: 520px; margin: 0 auto; width: 100%; }

  .card-actions { padding: 16px 18px; }

  .share-row { flex-wrap: wrap; gap: 10px; }

  /* Modal */
  .modal { max-width: 100%; border-radius: var(--radius) var(--radius) 0 0; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal-body {
    grid-template-columns: 1fr;
    max-height: 70vh;
    overflow-y: auto;
    padding: 12px 16px;
  }
  .crop-right-pane { order: -1; }
  #cropPreviewCanvas { max-width: 200px; margin: 0 auto; display: block; }
  .cropper-wrap { max-height: 240px; }
  .modal-head { padding: 16px 16px 0; }
  .modal-foot { padding: 12px 16px 16px; }
}

/* Phone */
@media (max-width: 480px) {
  html { font-size: 14px; }

  .container { padding: 0 12px; }

  .hero { padding: 24px 0 20px; }
  .hero-badge { font-size: .68rem; padding: 3px 10px; }

  .controls-panel { padding: 18px 14px; gap: 14px; }

  .field-label { font-size: .82rem; }

  .text-input { padding: 10px 12px; font-size: .95rem; }

  .btn-primary { padding: 12px 16px; font-size: .95rem; }

  .preview-box { max-width: 100%; }

  .card-actions { padding: 14px; gap: 12px; }

  .btn-download { padding: 12px 16px; font-size: .88rem; }

  .share-btn { width: 34px; height: 34px; }
  .share-btn svg { width: 18px; height: 18px; }

  /* Modal full-screen on small phones */
  .modal-body { max-height: 65vh; }
  #cropPreviewCanvas { max-width: 160px; }
  .cropper-wrap { max-height: 200px; }
  .zoom-row { gap: 6px; }

  .step-num { width: 20px; height: 20px; font-size: .65rem; }
}

/* Very small phones */
@media (max-width: 360px) {
  .container { padding: 0 10px; }
  .controls-panel { padding: 14px 12px; }
  .hero-title { font-size: 1.2rem; }
  .btn-primary, .btn-download { font-size: .85rem; }
  .share-row { gap: 8px; }
}
