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

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.6;
  color: #111827;
  background: #F9FAFB;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* Header */
.header {
  text-align: center;
  margin-bottom: 32px;
  padding-top: 16px;
}

.header h1 {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #2563EB, #7C3AED);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header p {
  font-size: 16px;
  color: #6B7280;
}

/* Form Styles */
.form-section {
  margin-bottom: 32px;
}

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

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 14px;
  color: #374151;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #E5E7EB;
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  min-height: 48px;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: white;
}

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

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

.char-count {
  display: block;
  text-align: right;
  font-size: 12px;
  color: #9CA3AF;
  margin-top: 4px;
}

/* Star Rating */
.star-rating {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.star-btn {
  padding: 10px 14px;
  border: 2px solid #E5E7EB;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 14px;
  min-height: 48px;
  min-width: 48px;
  transition: all 0.2s;
  color: #FBBF24;
}

.star-btn:first-child {
  color: #6B7280;
}

.star-btn:hover {
  border-color: #2563EB;
}

.star-btn.active {
  border-color: #2563EB;
  background: #EFF6FF;
}

/* 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: 12px;
  padding: 16px;
  border: 2px dashed #D1D5DB;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}

.file-label:hover {
  border-color: #2563EB;
  background: #F9FAFB;
}

.file-icon {
  font-size: 24px;
}

.file-text {
  color: #6B7280;
  font-size: 14px;
}

.photo-preview, .logo-preview {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.photo-preview img, .logo-preview img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid #E5E7EB;
}

.logo-preview img {
  border-radius: 8px;
  width: auto;
  max-width: 120px;
  height: 40px;
}

.btn-remove {
  padding: 6px 12px;
  font-size: 12px;
  background: #FEE2E2;
  color: #DC2626;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-remove:hover {
  background: #FECACA;
}

/* Template Grid */
.template-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.template-card {
  position: relative;
  aspect-ratio: 16/9;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  border: 3px solid transparent;
  transition: all 0.2s;
}

.template-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.template-card.active {
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

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

.template-card.locked::after {
  content: '🔒 PRO';
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

.template-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: white;
  font-size: 11px;
  font-weight: 500;
}

/* Preview Section */
.preview-section {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

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

.preview-label {
  font-weight: 600;
  font-size: 14px;
  color: #374151;
}

.preview-dimensions {
  font-size: 12px;
  color: #6B7280;
  background: #F3F4F6;
  padding: 4px 10px;
  border-radius: 20px;
}

.preview-container {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #F3F4F6;
  margin-bottom: 20px;
}

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

/* Share Actions */
.share-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 48px;
  width: 100%;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: #2563EB;
  color: white;
}

.btn-primary:hover {
  background: #1D4ED8;
}

.btn-share {
  background: #111827;
  color: white;
}

.btn-share:hover {
  background: #1F2937;
  transform: translateY(-1px);
}

.btn-accent {
  background: linear-gradient(135deg, #10B981, #059669);
  color: white;
}

.btn-accent:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-small {
  padding: 10px 16px;
  font-size: 14px;
  min-height: 40px;
  width: auto;
}

.btn-text {
  background: none;
  border: none;
  color: #6B7280;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Upgrade CTA */
.upgrade-cta {
  background: linear-gradient(135deg, #EFF6FF 0%, #F5F3FF 100%);
  border: 2px solid #DBEAFE;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  margin-bottom: 20px;
}

.upgrade-badge {
  display: inline-block;
  background: linear-gradient(135deg, #2563EB, #7C3AED);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}

.upgrade-cta h3 {
  font-size: 18px;
  margin-bottom: 16px;
  color: #111827;
}

.upgrade-features {
  list-style: none;
  text-align: left;
  margin-bottom: 20px;
}

.upgrade-features li {
  padding: 6px 0;
  color: #374151;
  font-size: 14px;
}

.price-note {
  font-size: 12px;
  opacity: 0.8;
  font-weight: 400;
}

.upgrade-note {
  font-size: 12px;
  color: #059669;
  margin-top: 12px;
  font-weight: 500;
}

/* Pro Code Section */
.pro-code-section {
  margin-bottom: 20px;
}

.pro-code-section details {
  background: #F9FAFB;
  border-radius: 8px;
  padding: 12px 16px;
}

.pro-code-section summary {
  cursor: pointer;
  font-size: 14px;
  color: #6B7280;
}

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

.code-input-wrapper input {
  flex: 1;
  padding: 10px 12px;
  border: 2px solid #E5E7EB;
  border-radius: 6px;
  font-family: monospace;
  font-size: 14px;
  text-transform: uppercase;
}

.error-text {
  color: #DC2626;
  font-size: 12px;
  margin-top: 8px;
}

/* Pro Status */
.pro-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
  border: 2px solid #A7F3D0;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
}

.pro-badge {
  font-size: 14px;
  font-weight: 600;
  color: #059669;
}

/* Footer */
.footer {
  text-align: center;
  padding: 32px 16px;
  color: #9CA3AF;
  font-size: 14px;
}

.footer-links {
  margin-top: 8px;
}

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

.footer-links a:hover {
  color: #2563EB;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Tablet Breakpoint */
@media (min-width: 768px) {
  .container {
    padding: 24px;
  }
  
  .header {
    margin-bottom: 40px;
  }
  
  .header h1 {
    font-size: 32px;
  }
  
  .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;
  }
}

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

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