@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400;1,700&family=Inter:wght@300;400;500;600;700&family=Dancing+Script:wght@400;500;600;700&family=Great+Vibes&family=Alex+Brush&display=swap');

:root {
  --bg-primary: #0f0e17;
  --bg-secondary: #1a1929;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(212, 175, 55, 0.3);
  --text-primary: #fffffe;
  --text-secondary: #a7a9be;
  --text-muted: #6b6d7b;
  --accent-gold: #d4af37;
  --accent-gold-light: #f0d060;
  --accent-rose: #e84393;
  --accent-rose-light: #fd79a8;
  --gradient-gold: linear-gradient(135deg, #d4af37, #f0d060, #d4af37);
  --gradient-rose: linear-gradient(135deg, #e84393, #fd79a8);
  --gradient-bg: linear-gradient(135deg, #0f0e17 0%, #1a1929 50%, #1f1e2e 100%);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(212, 175, 55, 0.15);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--gradient-bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Decorative background */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 20% 50%, rgba(212, 175, 55, 0.03) 0%, transparent 50%),
              radial-gradient(circle at 80% 20%, rgba(232, 67, 147, 0.03) 0%, transparent 50%),
              radial-gradient(circle at 50% 80%, rgba(212, 175, 55, 0.02) 0%, transparent 50%);
  animation: bgFloat 20s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes bgFloat {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(2%, -2%) rotate(1deg); }
  66% { transform: translate(-1%, 1%) rotate(-1deg); }
}

/* ===== HEADER ===== */
.header {
  text-align: center;
  padding: 40px 20px 30px;
  position: relative;
  z-index: 1;
}

.header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2.8rem;
  font-weight: 700;
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 1px;
  margin-bottom: 8px;
  animation: fadeInDown 0.8s ease-out;
}

.header p {
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 300;
  letter-spacing: 0.5px;
  animation: fadeInUp 0.8s ease-out 0.2s both;
}

.header .divider {
  width: 80px;
  height: 2px;
  background: var(--gradient-gold);
  margin: 16px auto 0;
  border-radius: 2px;
  animation: scaleIn 0.6s ease-out 0.4s both;
}

/* ===== MAIN LAYOUT ===== */
.main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 40px;
  position: relative;
  z-index: 1;
}

.layout {
  display: grid;
  grid-template-columns: 340px 1fr 320px;
  gap: 24px;
  align-items: start;
}

/* ===== CARD / PANEL ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  animation: fadeInUp 0.6s ease-out both;
}

.card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent-gold-light);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title .icon {
  font-size: 1.2rem;
}

/* ===== UPLOAD AREA ===== */
.upload-area {
  border: 2px dashed rgba(212, 175, 55, 0.25);
  border-radius: var(--radius-sm);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.upload-area::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.03), rgba(232, 67, 147, 0.03));
  opacity: 0;
  transition: var(--transition);
}

.upload-area:hover {
  border-color: var(--accent-gold);
  transform: translateY(-2px);
}

.upload-area:hover::before {
  opacity: 1;
}

.upload-area.has-image {
  padding: 12px;
  border-style: solid;
  border-color: rgba(212, 175, 55, 0.15);
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  display: block;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.upload-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

.upload-text strong {
  color: var(--accent-gold-light);
  font-weight: 600;
}

.upload-preview {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  object-fit: contain;
}

.btn-change-template {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  background: none;
  border: none;
  text-decoration: underline;
}

.btn-change-template:hover {
  color: var(--accent-gold-light);
}

/* ===== NAME LIST ===== */
.name-input-group {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.name-input-group textarea {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  resize: vertical;
  min-height: 90px;
  transition: var(--transition);
  line-height: 1.6;
}

.name-input-group textarea::placeholder {
  color: var(--text-muted);
}

.name-input-group textarea:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-gold {
  background: var(--gradient-gold);
  color: #1a1929;
}

.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.35);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold-light);
  background: rgba(212, 175, 55, 0.05);
}

.btn-rose {
  background: var(--gradient-rose);
  color: white;
}

.btn-rose:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(232, 67, 147, 0.35);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
}

.btn-block {
  width: 100%;
}

.name-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.name-count span {
  color: var(--accent-gold-light);
  font-weight: 600;
}

.name-list {
  max-height: 300px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 175, 55, 0.2) transparent;
}

.name-list::-webkit-scrollbar {
  width: 5px;
}

.name-list::-webkit-scrollbar-track {
  background: transparent;
}

.name-list::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.2);
  border-radius: 10px;
}

.name-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  gap: 8px;
  animation: fadeIn 0.3s ease-out;
}

.name-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.name-item.active {
  background: rgba(212, 175, 55, 0.1);
  border-left: 3px solid var(--accent-gold);
}

.name-item-index {
  font-size: 0.72rem;
  color: var(--text-muted);
  min-width: 22px;
}

.name-item-text {
  flex: 1;
  font-size: 0.88rem;
  color: var(--text-primary);
}

.name-item-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: var(--transition);
}

.name-item:hover .name-item-actions {
  opacity: 1;
}

.name-item-actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
}

.name-item-actions button:hover {
  color: var(--accent-rose);
  background: rgba(232, 67, 147, 0.1);
}

/* ===== CANVAS PREVIEW ===== */
.canvas-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.canvas-wrapper {
  position: relative;
  display: inline-block;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
  max-width: 100%;
}

#previewCanvas {
  display: block;
  max-width: 100%;
  height: auto;
  cursor: move;
}

.canvas-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  color: var(--text-muted);
  gap: 16px;
  padding: 40px;
}

.canvas-placeholder .icon {
  font-size: 4rem;
  opacity: 0.3;
}

.canvas-placeholder p {
  font-size: 0.95rem;
  text-align: center;
}

.canvas-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.canvas-nav .current-name {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  color: var(--accent-gold-light);
  min-width: 120px;
  text-align: center;
}

/* ===== STYLE PANEL ===== */
.style-group {
  margin-bottom: 18px;
}

.style-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  display: block;
}

.style-group select,
.style-group input[type="number"],
.style-group input[type="text"] {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  transition: var(--transition);
  appearance: none;
}

.style-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a7a9be' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.style-group select:focus,
.style-group input:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-picker-wrapper input[type="color"] {
  width: 40px;
  height: 40px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  padding: 2px;
  background: transparent;
}

.color-picker-wrapper input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.color-picker-wrapper input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.color-hex-input {
  flex: 1;
}

.style-row {
  display: flex;
  gap: 10px;
}

.style-row .style-group {
  flex: 1;
}

.toggle-group {
  display: flex;
  gap: 6px;
}

.toggle-btn {
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.88rem;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
}

.toggle-btn.active {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--accent-gold);
  color: var(--accent-gold-light);
}

.toggle-btn:hover {
  border-color: var(--accent-gold);
}

/* Position inputs */
.position-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ===== EXPORT SECTION ===== */
.export-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.export-progress {
  margin-top: 12px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--gradient-gold);
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: center;
}

/* ===== TOAST NOTIFICATION ===== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  color: var(--text-primary);
  font-size: 0.88rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scaleX(0); }
  to { opacity: 1; transform: scaleX(1); }
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .card {
    animation-delay: 0s !important;
  }
}

/* Utility classes */
.hidden { display: none !important; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-2 { margin-bottom: 8px; }
.text-center { text-align: center; }
.text-gold { color: var(--accent-gold-light); }

/* Second text line support */
.text-line-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
}

.text-line-tab {
  flex: 1;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.78rem;
  font-family: 'Inter', sans-serif;
  transition: var(--transition);
  text-align: center;
}

.text-line-tab.active {
  background: rgba(212, 175, 55, 0.12);
  border-color: var(--accent-gold);
  color: var(--accent-gold-light);
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.checkbox-group input[type="checkbox"] {
  accent-color: var(--accent-gold);
  width: 16px;
  height: 16px;
}

.checkbox-group label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
}
