/* ================================================
   layout.css — Layout girlie ✨
   ================================================ */

/* ── Header ── */
.site-header {
  background: rgba(255, 248, 254, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(232, 130, 154, 0.08);
}

.header-logo {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  animation: float 4s ease-in-out infinite;
}
.logo-npc   {
  color: var(--rose);
  text-shadow: 0 0 20px rgba(232, 130, 154, 0.4);
}
.logo-forge {
  color: var(--lavender);
  text-shadow: 0 0 20px rgba(184, 153, 216, 0.4);
}

.header-tagline {
  font-size: 13px;
  color: var(--text-mute);
  font-style: italic;
  font-family: var(--font-body);
}

.header-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── Wrapper principal ── */
.main-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 20px 64px;
  animation: floatUp 0.5s ease both;
}

/* ── Panel genérico ── */
.panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast);
}
.panel:hover {
  box-shadow: var(--shadow-md);
}

/* Decoración esquinas */
.panel::before,
.panel::after {
  content: '✿';
  position: absolute;
  font-size: 10px;
  color: var(--border-lit);
  line-height: 1;
  opacity: 0.6;
}
.panel::before { top: 8px; left: 10px; }
.panel::after  { bottom: 8px; right: 10px; }

.panel-title {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--rose);
  text-transform: uppercase;
  padding-bottom: 14px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 14px;
  background: linear-gradient(to bottom, var(--rose), var(--lavender));
  border-radius: 99px;
}

/* ── Layout de dos columnas ── */
.two-col {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  align-items: start;
}

/* ── Formulario ── */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-group.span-2 { grid-column: 1 / -1; }

.field-group label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.field-group .hint {
  font-size: 12px;
  color: var(--text-mute);
  font-style: italic;
  margin-top: 2px;
}

/* ── Inputs ── */
input[type="text"],
input[type="password"],
select,
textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  appearance: none;
  border-radius: var(--radius-md);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--rose);
  background: var(--surface-1);
  box-shadow: 0 0 0 3px rgba(232, 130, 154, 0.15);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-mute);
  font-style: italic;
}

select option { background: var(--surface-2); }

textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.65;
}

/* ── Chips de personalidad ── */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 13px;
  border: 1.5px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition);
  background: var(--surface-2);
  border-radius: 99px;
}
.chip:hover {
  border-color: var(--rose-light);
  color: var(--rose);
  background: var(--rose-pale);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.chip.active {
  background: linear-gradient(135deg, var(--rose), var(--lavender));
  border-color: transparent;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(232, 130, 154, 0.35);
}

/* ── Botones ── */
.btn {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 11px 24px;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.2s;
  border-radius: inherit;
}
.btn:hover::after { background: rgba(255,255,255,0.12); }
.btn:active { transform: scale(0.97); }
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--rose), #d46080);
  color: #fff;
  box-shadow: 0 4px 16px rgba(232, 130, 154, 0.4);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 22px rgba(232, 130, 154, 0.55);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  color: var(--text-dim);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--rose-light);
  color: var(--rose);
  background: var(--rose-pale);
  transform: translateY(-1px);
}
.btn-secondary.active {
  background: linear-gradient(135deg, var(--rose-pale), var(--lavender-pale));
  border-color: var(--rose-light);
  color: var(--rose);
}

.btn-save {
  background: linear-gradient(135deg, var(--mint), #5aaa88);
  color: #fff;
  box-shadow: 0 4px 14px rgba(126, 200, 168, 0.35);
}
.btn-save:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(126, 200, 168, 0.5);
  transform: translateY(-1px);
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}

/* ── Panel API key ── */
.api-panel { margin-top: 16px; }

.api-help {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 10px;
}

.api-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.api-steps li {
  font-size: 14px;
  color: var(--text-dim);
  padding-left: 20px;
  position: relative;
}
.api-steps li::before {
  content: '✦';
  position: absolute;
  left: 0;
  color: var(--rose);
  font-size: 10px;
  top: 4px;
}

.key-status {
  font-size: 13px;
  margin-top: 6px;
  min-height: 18px;
  font-style: italic;
}
.key-status.ok    { color: var(--mint); }
.key-status.error { color: var(--rose); }

/* ── Galería ── */
.gallery-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.gallery-title {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--rose);
}
.count-badge {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
  background: var(--rose-pale);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 99px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* ── Empty state ── */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-mute);
  border: 2px dashed var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface-1);
}
.empty-icon  { font-size: 48px; display: block; margin-bottom: 16px; animation: float 3s ease-in-out infinite; }
.empty-title { font-family: var(--font-display); font-size: 16px; color: var(--text-dim); margin-bottom: 6px; }
.empty-sub   { font-size: 15px; }

/* ── Tarjeta ── */
.npc-card {
  background: var(--surface-1);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.npc-card:hover {
  border-color: var(--rose-light);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.card-sprite {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
}

.card-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.card-name {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--text);
  margin-bottom: 3px;
}
.card-archetype {
  font-size: 13px;
  color: var(--lavender);
  font-style: italic;
}
.card-relation {
  font-size: 12px;
  color: var(--text-mute);
  margin-top: 2px;
}

.card-quote {
  padding: 12px 16px;
  font-style: italic;
  font-size: 14px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--rose-pale), var(--lavender-pale));
  line-height: 1.5;
}
.card-quote::before { content: '"'; color: var(--rose); font-size: 20px; line-height: 0; vertical-align: -5px; }
.card-quote::after  { content: '"'; color: var(--rose); font-size: 20px; line-height: 0; vertical-align: -5px; }

.card-actions { display: flex; }
.card-act {
  flex: 1;
  padding: 9px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--text-mute);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-transform: uppercase;
}
.card-act:last-child { border-right: none; }
.card-act:hover      { background: var(--surface-2); color: var(--text); }
.card-act.view:hover { color: var(--rose); background: var(--rose-pale); }
.card-act.del:hover  { color: #e05555; background: #fff0f0; }

/* ── Loading ── */
.loading-msg {
  text-align: center;
  padding: 48px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}
.loading-title {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--rose);
  margin-bottom: 8px;
  animation: pulse-soft 1.5s ease-in-out infinite;
}
.loading-sub {
  font-size: 15px;
  color: var(--text-mute);
  font-style: italic;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .site-header { padding: 0 16px; }
  .header-tagline { display: none; }
}

/* ── Panel de logros ── */
.achiev-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.achiev-title {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--gold);
}
.achiev-counter {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
  background: var(--rose-pale);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 99px;
}

.achiev-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.achiev-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  transition: all 0.2s;
}
.achiev-item.unlocked {
  border-color: var(--gold);
  background: linear-gradient(135deg, var(--rose-pale), var(--lavender-pale));
  box-shadow: var(--shadow-sm);
}
.achiev-item.locked {
  opacity: 0.5;
  filter: grayscale(0.4);
}
.achiev-item.unlocked:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.achiev-icon {
  font-size: 28px;
  flex-shrink: 0;
  line-height: 1;
}

.achiev-info { display: flex; flex-direction: column; gap: 2px; }
.achiev-info b { font-size: 14px; color: var(--text); font-family: var(--font-display); }
.achiev-info small { font-size: 12px; color: var(--text-dim); }