/* ===== PLAYFUL GEOMETRIC DESIGN SYSTEM ===== */
/* Reset & Base */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Colors */
  --background: #FFFDF5;
  --foreground: #1E293B;
  --muted: #F1F5F9;
  --muted-foreground: #64748B;
  --accent: #8B5CF6;
  --accent-foreground: #FFFFFF;
  --secondary: #F472B6;
  --tertiary: #FBBF24;
  --quaternary: #34D399;
  --border: #E2E8F0;
  --input: #FFFFFF;
  --card: #FFFFFF;
  --ring: #8B5CF6;
  --shadow-color: #1E293B;
  
  /* Typography */
  --font-heading: "Outfit", system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", system-ui, sans-serif;
  
  /* Spacing & Radius */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-pop: 4px 4px 0px 0px var(--shadow-color);
  --shadow-pop-hover: 6px 6px 0px 0px var(--shadow-color);
  --shadow-pop-active: 2px 2px 0px 0px var(--shadow-color);
  --shadow-soft: 4px 4px 0px 0px var(--border);
  
  /* Transitions */
  --transition-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  line-height: 1.6;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
}

/* Background decoration */
body::before {
  content: '';
  position: fixed;
  top: 80px;
  right: -60px;
  width: 200px;
  height: 200px;
  background: var(--tertiary);
  border-radius: 50%;
  opacity: 0.15;
  z-index: -1;
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  bottom: 100px;
  left: -40px;
  width: 120px;
  height: 120px;
  background: var(--secondary);
  opacity: 0.12;
  z-index: -1;
  pointer-events: none;
  transform: rotate(15deg);
}

/* Container */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ===== HEADER ===== */
.header {
  text-align: center;
  margin-bottom: 40px;
  padding-top: 24px;
  position: relative;
}

.header h1 {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 12px;
  color: var(--foreground);
  position: relative;
  display: inline-block;
}

/* Decorative underline squiggle */
.header h1::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 8px;
  background: url("data:image/svg+xml,%3Csvg width='120' height='8' viewBox='0 0 120 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 6C12 2 22 2 32 6C42 10 52 10 62 6C72 2 82 2 92 6C102 10 112 10 118 6' stroke='%238B5CF6' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center;
}

.header p {
  font-size: 16px;
  color: var(--muted-foreground);
  margin-top: 16px;
}

/* ===== FORM STYLES ===== */
.form-section {
  margin-bottom: 32px;
}

.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  font-family: var(--font-heading);
  font-weight: 600;
  margin-bottom: 10px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--foreground);
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 16px;
  font-family: var(--font-body);
  min-height: 52px;
  background: var(--input);
  color: var(--foreground);
  transition: all 0.3s var(--transition-bounce);
  box-shadow: 4px 4px 0px transparent;
}

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

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 4px 4px 0px var(--accent);
}

.form-row {
  display: grid;
  gap: 16px;
}

.char-count {
  display: block;
  text-align: right;
  font-size: 12px;
  color: var(--muted-foreground);
  margin-top: 6px;
  font-weight: 500;
}

/* ===== STAR RATING ===== */
.star-rating {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.star-btn {
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--card);
  cursor: pointer;
  font-size: 14px;
  min-height: 52px;
  min-width: 52px;
  transition: all 0.3s var(--transition-bounce);
  color: var(--tertiary);
  box-shadow: var(--shadow-soft);
}

.star-btn:first-child {
  color: var(--muted-foreground);
  font-weight: 600;
}

.star-btn:hover {
  border-color: var(--accent);
  transform: translateY(-2px) translateX(-2px);
  box-shadow: var(--shadow-pop-hover);
}

.star-btn.active {
  border-color: var(--foreground);
  background: var(--tertiary);
  color: var(--foreground);
  box-shadow: var(--shadow-pop);
}

/* ===== FILE UPLOAD ===== */
.file-upload-wrapper {
  position: relative;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.file-label {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s var(--transition-bounce);
  background: var(--card);
}

.file-label:hover {
  border-color: var(--accent);
  border-style: solid;
  background: #FEFBFF;
  transform: translateY(-2px);
}

.file-icon {
  font-size: 28px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--muted);
  border-radius: var(--radius-full);
}

.file-text {
  color: var(--muted-foreground);
  font-size: 14px;
  font-weight: 500;
}

.photo-preview, .logo-preview {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: var(--muted);
  border-radius: var(--radius-md);
}

.photo-preview img, .logo-preview img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--radius-full);
  border: 3px solid var(--card);
  box-shadow: var(--shadow-soft);
}

.logo-preview img {
  border-radius: var(--radius-sm);
  width: auto;
  max-width: 100px;
  height: 40px;
}

.btn-remove {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  background: #FEE2E2;
  color: #DC2626;
  border: 2px solid #DC2626;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-remove:hover {
  background: #DC2626;
  color: white;
}

/* ===== TEMPLATE GRID ===== */
.template-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.template-card {
  position: relative;
  aspect-ratio: 16/9;
  border-radius: var(--radius-md);
  cursor: pointer;
  overflow: hidden;
  border: 3px solid var(--border);
  transition: all 0.3s var(--transition-bounce);
  box-shadow: var(--shadow-soft);
}

.template-card:hover {
  transform: translateY(-4px) translateX(-2px) rotate(-1deg);
  box-shadow: var(--shadow-pop-hover);
  border-color: var(--foreground);
}

.template-card.active {
  border-color: var(--accent);
  box-shadow: 6px 6px 0px var(--accent);
  transform: scale(1.02);
}

.template-card.locked {
  opacity: 0.7;
}

.template-card.locked::after {
  content: '✨ PRO';
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--foreground);
  color: var(--tertiary);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.template-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  color: white;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-heading);
}

/* ===== PREVIEW SECTION ===== */
.preview-section {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 2px solid var(--border);
  box-shadow: 8px 8px 0px var(--muted);
  position: relative;
}

/* Decorative floating circle */
.preview-section::before {
  content: '';
  position: absolute;
  top: -15px;
  right: 30px;
  width: 40px;
  height: 40px;
  background: var(--quaternary);
  border-radius: 50%;
  border: 2px solid var(--foreground);
  z-index: 1;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.preview-label {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 15px;
  color: var(--foreground);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.preview-dimensions {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: #F3E8FF;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 2px solid var(--accent);
}

.preview-container {
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--muted);
  margin-bottom: 24px;
  border: 2px solid var(--border);
}

#previewCanvas {
  width: 100%;
  height: auto;
  display: block;
}

/* ===== SHARE ACTIONS ===== */
.share-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 28px;
  border: 2px solid var(--foreground);
  border-radius: var(--radius-full);
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-heading);
  cursor: pointer;
  transition: all 0.3s var(--transition-bounce);
  min-height: 54px;
  width: 100%;
  text-decoration: none;
  box-shadow: var(--shadow-pop);
}

.btn:hover {
  transform: translateY(-2px) translateX(-2px);
  box-shadow: var(--shadow-pop-hover);
}

.btn:active {
  transform: translateY(2px) translateX(2px);
  box-shadow: var(--shadow-pop-active);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-foreground);
}

.btn-share {
  background: var(--foreground);
  color: var(--accent-foreground);
}

.btn-share:hover {
  background: #334155;
}

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

.btn-accent {
  background: var(--quaternary);
  color: var(--foreground);
  border-color: var(--foreground);
  position: relative;
  overflow: hidden;
}

.btn-accent::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s;
}

.btn-accent:hover::before {
  left: 100%;
}

.btn-small {
  padding: 12px 20px;
  font-size: 14px;
  min-height: 46px;
  width: auto;
}

.btn-text {
  background: none;
  border: none;
  color: var(--muted-foreground);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  font-weight: 500;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ===== UPGRADE CTA ===== */
.upgrade-cta {
  background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 50%, #FCD34D 100%);
  border: 3px solid var(--foreground);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  margin-bottom: 24px;
  position: relative;
  box-shadow: 6px 6px 0px var(--foreground);
}

/* Decorative star */
.upgrade-cta::before {
  content: '⭐';
  position: absolute;
  top: -18px;
  left: 24px;
  font-size: 32px;
  transform: rotate(-15deg);
}

.upgrade-badge {
  display: inline-block;
  background: var(--accent);
  color: white;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-heading);
  letter-spacing: 0.1em;
  margin-bottom: 14px;
  border: 2px solid var(--foreground);
  box-shadow: 2px 2px 0px var(--foreground);
}

.upgrade-cta h3 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 18px;
  color: var(--foreground);
}

.upgrade-features {
  list-style: none;
  text-align: left;
  margin-bottom: 24px;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}

.upgrade-features li {
  padding: 8px 0;
  color: var(--foreground);
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}

.upgrade-features li::before {
  content: '✓';
  width: 24px;
  height: 24px;
  background: var(--quaternary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--foreground);
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
}

.price-note {
  font-size: 13px;
  opacity: 0.7;
  font-weight: 500;
}

.upgrade-note {
  font-size: 13px;
  color: var(--foreground);
  margin-top: 14px;
  font-weight: 600;
  opacity: 0.8;
}

/* ===== PRO CODE SECTION ===== */
.pro-code-section {
  margin-bottom: 24px;
}

.pro-code-section details {
  background: var(--muted);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  border: 2px solid var(--border);
}

.pro-code-section summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted-foreground);
}

.pro-code-section details[open] summary {
  margin-bottom: 14px;
}

.code-input-wrapper {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.code-input-wrapper input {
  flex: 1;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-family: "SF Mono", Monaco, monospace;
  font-size: 14px;
  text-transform: uppercase;
  background: var(--card);
}

.code-input-wrapper input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 3px 3px 0px var(--accent);
}

.error-text {
  color: #DC2626;
  font-size: 13px;
  margin-top: 10px;
  font-weight: 500;
}

/* ===== PRO STATUS ===== */
.pro-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #D1FAE5, #A7F3D0);
  border: 3px solid var(--foreground);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-pop);
}

.pro-badge {
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-heading);
  color: #065F46;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== FOOTER ===== */
.footer {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted-foreground);
  font-size: 14px;
}

.footer p:first-child {
  font-weight: 600;
  margin-bottom: 8px;
}

.footer-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.footer-links a:hover {
  text-decoration: underline;
}

/* ===== UTILITY CLASSES ===== */
.hidden {
  display: none !important;
}

/* ===== RESPONSIVE - TABLET ===== */
@media (min-width: 768px) {
  .container {
    padding: 32px;
  }
  
  .header {
    margin-bottom: 48px;
  }
  
  .header h1 {
    font-size: 40px;
  }
  
  .header p {
    font-size: 18px;
  }
  
  .form-row {
    grid-template-columns: 1fr 1fr;
  }
  
  .template-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .share-actions {
    flex-direction: row;
  }
  
  .share-actions .btn {
    flex: 1;
  }
}

/* ===== RESPONSIVE - DESKTOP ===== */
@media (min-width: 1024px) {
  .container {
    padding: 48px 40px;
  }
  
  .header h1 {
    font-size: 48px;
  }
  
  .main-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 56px;
    align-items: start;
  }
  
  .preview-section {
    position: sticky;
    top: 40px;
  }
  
  .template-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .upgrade-cta {
    padding: 32px;
  }
  
  .upgrade-cta h3 {
    font-size: 24px;
  }
}

@media (min-width: 1200px) {
  .template-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  
  .btn:hover,
  .template-card:hover {
    transform: none;
  }
}