/* =====================================================
   China Name Generator — Public / Frontend Styles
   ===================================================== */

/* ---- WRAP ---- */
.cng-wrap {
  max-width: 900px;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1e293b;
}

/* ---- HEADER ---- */
.cng-header {
  text-align: center;
  padding: 32px 16px 24px;
  background: linear-gradient(135deg, #fdf4ff 0%, #eff6ff 100%);
  border-radius: 20px;
  margin-bottom: 24px;
  border: 1px solid #e9d5ff;
}
.cng-header-icon   { font-size: 48px; margin-bottom: 8px; line-height: 1; }
.cng-header-title  { font-size: 28px; font-weight: 800; color: #581c87; margin: 0 0 8px; }
.cng-header-sub    { color: #7c3aed; font-size: 15px; margin: 0; }

/* ---- TABS ---- */
.cng-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: #f8fafc;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
}
.cng-tab {
  flex: 1;
  padding: 12px 20px;
  border: none;
  background: transparent;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  color: #64748b;
  transition: all .2s;
}
.cng-tab-active {
  background: white;
  color: #7c3aed;
  box-shadow: 0 2px 8px rgba(124,58,237,.15);
}

/* ---- TAB CONTENT ---- */
.cng-tab-content { }
.cng-hidden { display: none !important; }

/* ---- FORM CARD ---- */
.cng-form-card {
  background: white;
  border-radius: 16px;
  padding: 28px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 16px rgba(0,0,0,.06);
}

/* ---- FORM GRID ---- */
.cng-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.cng-field-full { grid-column: 1 / -1; }
@media (max-width: 600px) {
  .cng-form-grid { grid-template-columns: 1fr; }
  .cng-field-full { grid-column: 1; }
}

/* ---- FIELDS ---- */
.cng-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}
.cng-optional { color: #9ca3af; font-weight: 400; }
.cng-required { color: #ef4444; }
.cng-hint { font-size: 12px; color: #9ca3af; margin: 6px 0 0; }

.cng-input, .cng-select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 15px;
  color: #1e293b;
  background: white;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}
.cng-input:focus, .cng-select:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124,58,237,.1);
}
.cng-input-lg { font-size: 16px; padding: 13px 16px; }

/* ---- RADIO GROUP ---- */
.cng-radio-group { display: flex; gap: 8px; flex-wrap: wrap; }
.cng-radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 9999px;
  cursor: pointer;
  font-size: 14px;
  transition: all .15s;
}
.cng-radio-label:has(input:checked) {
  border-color: #7c3aed;
  background: #f5f3ff;
  color: #6d28d9;
}
.cng-radio-label input { display: none; }

/* ---- BUTTONS ---- */
.cng-form-actions { text-align: center; }
.cng-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  line-height: 1;
}
.cng-btn-primary {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: white;
  box-shadow: 0 4px 14px rgba(124,58,237,.35);
}
.cng-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(124,58,237,.4); }
.cng-btn-secondary {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: white;
  box-shadow: 0 4px 14px rgba(37,99,235,.35);
}
.cng-btn-secondary:hover { transform: translateY(-1px); }
.cng-btn:disabled { opacity: .6; cursor: not-allowed; transform: none !important; }

/* SPINNER */
.cng-spinner {
  width: 18px; height: 18px;
  animation: cng-spin 0.8s linear infinite;
}
@keyframes cng-spin { to { transform: rotate(360deg); } }

/* ---- BUTTON SM ---- */
.cng-btn-sm {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all .15s;
}
.cng-btn-outline { background: white; border-color: #e2e8f0; color: #374151; }
.cng-btn-outline:hover { border-color: #7c3aed; color: #7c3aed; }
.cng-btn-green { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.cng-btn-green:hover { background: #bbf7d0; }

/* ---- ERROR BOX ---- */
.cng-error-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 12px;
  color: #dc2626;
  font-size: 14px;
  margin: 16px 0;
}

/* ---- RESULTS ---- */
.cng-results-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.cng-results-title { font-size: 20px; font-weight: 700; margin: 0 0 4px; color: #1e293b; }
.cng-results-info  { display: flex; gap: 12px; font-size: 13px; color: #64748b; }
.cng-results-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* TYPE FILTER */
.cng-type-filter { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.cng-filter-btn {
  padding: 6px 16px;
  border: 1.5px solid #e2e8f0;
  border-radius: 9999px;
  background: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #64748b;
  transition: all .15s;
}
.cng-filter-active { border-color: #7c3aed; background: #f5f3ff; color: #6d28d9; }

/* NAMES GRID — 2 kolom desktop, 1 kolom mobile */
.cng-names-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
@media (max-width: 600px) {
  .cng-names-grid { grid-template-columns: 1fr; gap: 14px; }
}

/* NAME CARD */
.cng-name-card {
  background: white;
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  padding: 24px 20px 16px;
  text-align: center;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.cng-name-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #7c3aed, #ec4899);
}
.cng-name-card:hover { border-color: #c4b5fd; box-shadow: 0 4px 16px rgba(124,58,237,.12); transform: translateY(-2px); }
.cng-card-hanzi  { font-size: 52px; line-height: 1.2; margin-bottom: 8px; font-weight: 400; color: #1e293b; }
.cng-card-pinyin { font-size: 15px; color: #7c3aed; font-weight: 600; margin-bottom: 6px; }
.cng-card-arti   { font-size: 13px; color: #64748b; line-height: 1.5; margin-bottom: 12px; }
.cng-card-type-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.cng-badge-phonetic { background: #dbeafe; color: #1d4ed8; }
.cng-badge-meaning  { background: #dcfce7; color: #166534; }
.cng-badge-hybrid   { background: #fce7f3; color: #9d174d; }

/* CARD DETAIL */
.cng-card-detail { margin-top: 12px; text-align: left; border-top: 1px solid #f1f5f9; padding-top: 12px; }
.cng-card-section { margin-bottom: 10px; }
.cng-card-section:last-child { margin-bottom: 0; }
.cng-card-section-label {
  font-size: 11px; font-weight: 700; color: #7c3aed;
  margin-bottom: 4px; text-transform: uppercase; letter-spacing: .05em;
}
.cng-card-section-body { font-size: 13px; color: #475569; line-height: 1.6; }
/* legacy compat */
.cng-card-filosofi-label, .cng-card-penjelasan-label, .cng-card-username-label {
  font-size: 11px; font-weight: 700; color: #7c3aed; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em;
}
.cng-card-filosofi, .cng-card-penjelasan { font-size: 13px; color: #475569; line-height: 1.6; margin-bottom: 10px; }
.cng-card-usernames { display: flex; flex-wrap: wrap; gap: 6px; }
.cng-username-chip {
  display: inline-block;
  padding: 3px 10px;
  background: #f5f3ff;
  color: #6d28d9;
  border-radius: 9999px;
  font-size: 12px;
  font-family: monospace;
  cursor: pointer;
  transition: background .15s;
}
.cng-username-chip:hover { background: #ede9fe; }

/* CARD ACTIONS */
.cng-card-actions { display: flex; gap: 6px; margin-top: 10px; }
.cng-card-btn {
  flex: 1;
  padding: 6px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: #374151;
  transition: all .15s;
}
.cng-card-btn:hover { border-color: #7c3aed; color: #7c3aed; background: #f5f3ff; }
.cng-btn-copy { flex: 0 0 auto; padding: 6px 10px; }

/* ARTICLE STATUS */
.cng-article-status {
  margin-top: 20px;
  padding: 16px 20px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
}
.cng-article-status.success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.cng-article-status.error   { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }
.cng-article-status.loading { background: #f0f9ff; border: 1px solid #bae6fd; color: #0369a1; }
.cng-article-link { margin-left: auto; font-weight: 700; color: #7c3aed; text-decoration: none; }

/* ---- TANGGAL LAHIR ---- */
.cng-birthdate-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cng-input-date {
  flex: 1;
  max-width: 200px;
  cursor: pointer;
}
.cng-btn-clear-date {
  padding: 8px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  color: #64748b;
  transition: all .15s;
  line-height: 1;
}
.cng-btn-clear-date:hover { border-color: #ef4444; color: #ef4444; background: #fef2f2; }

/* ---- SHIO INFO BOX ---- */
.cng-shio-info {
  margin-top: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #fdf4ff, #f0fdf4);
  border: 1.5px solid #d8b4fe;
  border-radius: 12px;
  animation: cng-fadein .3s ease;
}
@keyframes cng-fadein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

.cng-shio-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.cng-shio-emoji {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}
.cng-shio-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cng-shio-text strong {
  font-size: 14px;
  font-weight: 700;
  color: #581c87;
}
.cng-shio-text span {
  font-size: 13px;
  color: #166534;
  font-weight: 600;
}
.cng-shio-desc {
  font-size: 12px;
  color: #475569;
  margin: 0;
  line-height: 1.5;
}
