/* assets/css/styles.css — TOON Card Designer ( Tailwind + คัสตอมสไตล์ ) */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@400;600;700&family=Noto+Sans+Thai:wght@400;500;600;700&family=Prompt:wght@400;500;600;700&display=swap');

:root {
  --tc-ink: #0f172a;
  --tc-sand: #f8fafc;
  --tc-card-w: 460px;
  --tc-card-h: 260px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Prompt', 'Noto Sans Thai', sans-serif;
  color: var(--tc-ink);
  background: linear-gradient(135deg, #f0f4f8 0%, #eef2f6 100%);
  min-height: 100vh;
}

.tc-stage {
  position: relative;
  width: 100%;
  max-width: 520px;
  aspect-ratio: 460 / 260;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 48px -12px rgba(15, 23, 42, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: #fff;
  transform-origin: top left;
  will-change: transform;
}

.tc-card {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  overflow: hidden;
  transition: box-shadow .2s ease;
  font-family: 'Prompt', 'Kanit', 'Noto Sans Thai', sans-serif;
}
.tc-card:hover { box-shadow: 0 30px 60px -14px rgba(15, 23, 42, 0.35); }

.tc-card-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 32px 36px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  z-index: 2;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.tc-card-face::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.06) 0%, rgba(0, 0, 0, 0.16) 100%);
}

.tc-card--classic { background: #0b1120; color: #fff; }
.tc-card--modern { background: #ffffff; color: #111827; }
.tc-card--tech { background: #030712; color: #e5e7eb; }
.tc-card--premium { background: linear-gradient(135deg, #1e1b4b 0%, #312e81 60%, #0f172a 100%); color: #fff; }

.tc-mark {
  position: absolute;
  top: 24px;
  left: 28px;
  z-index: 3;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.tc-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }

.tc-accent-bar {
  position: absolute;
  left: 0;
  top: 0;
  width: 6px;
  height: 100%;
  z-index: 3;
}

.tc-content { position: relative; z-index: 3; max-width: 72%; }

.tc-tagline {
  font-family: 'Kanit', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  line-height: 1.25;
  margin: 0 0 6px 0;
}

.tc-name {
  font-family: 'Kanit', sans-serif;
  font-weight: 700;
  font-size: 1.75rem;
  margin: 0 0 2px 0;
  letter-spacing: 0.02em;
}

.tc-title {
  font-size: 0.92rem;
  font-weight: 500;
  opacity: 0.85;
  margin: 0 0 10px 0;
}

.tc-company {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--tc-accent, #d4af37);
  margin-bottom: 14px;
}

.tc-divider {
  width: 40%;
  height: 2px;
  background: var(--tc-accent, #d4af37);
  border-radius: 2px;
  margin: 14px 0;
  opacity: 0.9;
}

.tc-contacts { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; }
.tc-contact { display: flex; align-items: center; gap: 8px; opacity: 0.9; }
.tc-contact svg { width: 16px; height: 16px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.6; }

.tc-skills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tc-skill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--tc-text, inherit);
  font-size: 0.78rem;
  font-weight: 600;
  backdrop-filter: blur(4px);
}

.tc-card--modern .tc-skill { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }

.tc-note {
  font-size: 0.8rem;
  font-style: italic;
  opacity: 0.7;
  margin-top: 8px;
}

/* Controls panel */
.tc-panel {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.08);
}
.tc-section {
  border-bottom: 1px solid #f1f5f9;
  padding: 18px;
}
.tc-section:last-child { border-bottom: none; }
.tc-section h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  margin: 0 0 12px 0;
  font-weight: 700;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}
.asset-item {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  overflow: hidden;
  background: #f1f5f9;
  position: relative;
}
.asset-item img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0.7; transition: opacity 0.15s, transform 0.15s; }
.asset-item:hover img { opacity: 0.95; transform: scale(1.04); }
.asset-item.selected { border-color: var(--tc-accent, #d4af37); box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.15); }
.asset-item.selected img { opacity: 1; }

.btn-primary {
  background: #0b1120;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  transition: transform 0.1s, background 0.2s;
}
.btn-primary:hover { background: #161e30; transform: translateY(-1px); }
.btn-primary:active { transform: scale(0.98); }
.btn-outline {
  background: transparent;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
}
.btn-outline:hover { background: #f1f5f9; }
.btn-ghost {
  background: transparent;
  color: #64748b;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
}
.btn-ghost:hover { background: #f1f5f9; color: #0f172a; }

.input-row { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 640px) { .input-row { grid-template-columns: 1fr 1fr; } }

.tc-field { margin-bottom: 10px; }
.tc-field label {
  display: block;
  font-size: 0.82rem;
  color: #475569;
  margin-bottom: 4px;
  font-weight: 600;
}
.tc-field input,
.tc-field textarea,
.tc-field select {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.95rem;
  background: #fff;
  outline: none;
}
.tc-field input:focus,
.tc-field textarea:focus,
.tc-field select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.tc-field input[type="color"] {
  padding: 2px;
  height: 40px;
  border: none;
  cursor: pointer;
  background: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%) translateY(12px);
  z-index: 1000;
  background: #0b1120;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  box-shadow: 0 10px 24px -6px rgba(15, 23, 42, 0.35);
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.hidden { display: none !important; }

.preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 24px;
  min-height: 100vh;
}
.actions-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 10px;
}
.gallery-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  background: #fff;
  cursor: pointer;
  aspect-ratio: 16 / 10;
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; opacity: 0.85; transition: opacity 0.2s; }
.gallery-item:hover img { opacity: 1; }

@media print {
  body { background: #fff !important; }
  .tc-print-hide { display: none !important; }
  .preview-wrap { padding: 0; gap: 0; }
}
