/* ═══════════════════════════════════════════
   GENERADOR DE CV — Styles
   ═══════════════════════════════════════════ */

:root {
  --sidebar-w: 260px;
}

/* ─── LAYOUT ─── */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  padding-top: 52px;
}

/* ─── SIDEBAR ─── */
.sidebar {
  border-right: 1px solid var(--rule);
  padding: 28px 20px;
  position: sticky;
  top: 52px;
  height: calc(100vh - 52px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}

.sb-group {
  margin-bottom: 24px;
}

.sb-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 10px;
}

/* Mode Toggle */
.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
}

.mode-btn {
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 0;
  text-align: center;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.mode-btn.active {
  background: var(--blue-grad);
  color: white;
}

/* Palette */
.palette-row {
  display: flex;
  gap: 8px;
}

.pal-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}

.pal-btn:hover { transform: scale(1.1); }
.pal-btn.active { border-color: var(--ink); box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }

.pal-btn[data-p="ink"]    { background: var(--ink); }
.pal-btn[data-p="ocean"]  { background: linear-gradient(135deg, #1e5a8a, #3b82f6); }
.pal-btn[data-p="forest"] { background: linear-gradient(135deg, #166534, #22c55e); }
.pal-btn[data-p="wine"]   { background: linear-gradient(135deg, #7a2840, #e879a0); }

/* Sidebar Buttons */
.sb-btn {
  font-family: var(--mono);
  font-size: 12px;
  padding: 10px 14px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--white);
  color: var(--ink-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  transition: all 0.15s;
  margin-bottom: 8px;
}

.sb-btn:hover {
  color: var(--blue);
  border-color: var(--blue);
}

.sb-btn.primary {
  background: var(--blue-grad);
  color: white;
  border: none;
}

.sb-btn.primary:hover {
  box-shadow: 0 2px 12px rgba(37, 84, 168, 0.25);
}

.sb-actions {
  margin-top: auto;
}

.sb-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  padding-top: 16px;
  justify-content: center;
}

.sb-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

/* ─── EDITOR ─── */
.editor {
  padding: 40px clamp(24px, 4vw, 48px);
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}

.editor.off { display: none; }

.ed-section {
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--rule);
}

.ed-section:last-child { border-bottom: none; }

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

.ed-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.btn-action {
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 14px;
  border: 1px solid var(--blue);
  border-radius: 4px;
  background: var(--blue-pale);
  color: var(--blue);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-action:hover {
  background: var(--blue);
  color: white;
}

/* Fields */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.field-row.full { grid-template-columns: 1fr; }

.f-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 5px;
  display: block;
}

.f-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--white);
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.f-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 84, 168, 0.08);
}

.f-input::placeholder { color: var(--ink-faint); }

.f-input.big {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.5px;
  border: none;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.f-input.sub {
  font-size: 15px;
  color: var(--ink-light);
  border: none;
  background: transparent;
  padding: 4px 0 0;
  box-shadow: none;
}

textarea.f-input {
  min-height: 90px;
  resize: vertical;
  line-height: 1.75;
}

/* Item Cards */
.item-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-card {
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 16px 18px;
  background: var(--white);
  position: relative;
  transition: border-color 0.15s;
}

.item-card:hover { border-color: var(--rule-dark); }

.item-card .it { font-weight: 600; font-size: 15px; }
.item-card .is { font-size: 13px; color: var(--ink-light); }
.item-card .id { font-family: var(--mono); font-size: 11px; color: var(--ink-muted); }
.item-card .ix { font-size: 13px; color: var(--ink-muted); margin-top: 6px; line-height: 1.6; }

.item-rm {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: transparent;
  color: var(--ink-faint);
  font-size: 12px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.15s;
}

.item-rm:hover {
  color: var(--red);
  border-color: var(--red);
  background: var(--red-bg);
}

.empty {
  text-align: center;
  padding: 28px;
  color: var(--ink-faint);
  font-size: 13px;
  font-style: italic;
}

/* Skills */
.skills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--white);
  transition: border-color 0.2s;
}

.skills-wrap:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 84, 168, 0.08);
}

.sk-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-light);
  background: var(--paper-warm);
}

.sk-tag .rm {
  cursor: pointer;
  color: var(--ink-faint);
  font-size: 10px;
  transition: color 0.15s;
}

.sk-tag .rm:hover { color: var(--red); }

.sk-input {
  border: none;
  background: none;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  outline: none;
  flex: 1;
  min-width: 100px;
  padding: 4px;
}

.sk-input::placeholder { color: var(--ink-faint); }

/* ─── PREVIEW ─── */
.preview-wrap {
  display: none;
  padding: 40px clamp(24px, 4vw, 48px);
}

.preview-wrap.on { display: block; }

.cv-page {
  background: var(--white);
  max-width: 680px;
  margin: 0 auto;
  padding: 48px;
  box-shadow: 0 1px 12px rgba(0,0,0,0.06), 0 4px 32px rgba(0,0,0,0.04);
  border-radius: 4px;
  min-height: 900px;
  font-family: var(--sans);
}

.cv-page h1 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 2px;
}

.cv-page .cv-role { font-size: 14px; color: #666; margin-bottom: 14px; }
.cv-page .cv-contact { display: flex; gap: 14px; font-size: 11px; color: #999; margin-bottom: 20px; flex-wrap: wrap; font-family: var(--mono); }
.cv-page .cv-sec { font-family: var(--mono); font-size: 10px; letter-spacing: 2px; text-transform: uppercase; padding-bottom: 5px; margin-bottom: 10px; margin-top: 24px; }
.cv-page .cv-text { font-size: 13px; line-height: 1.75; color: #333; }

/* Palette themes */
.cv-page[data-t="ink"]    h1 { color: #111827; }
.cv-page[data-t="ink"]    .cv-sec { border-bottom: 2px solid #111827; color: #111827; }
.cv-page[data-t="ocean"]  h1 { color: #1e5a8a; }
.cv-page[data-t="ocean"]  .cv-sec { border-bottom: 2px solid #2563eb; color: #1e5a8a; }
.cv-page[data-t="forest"] h1 { color: #166534; }
.cv-page[data-t="forest"] .cv-sec { border-bottom: 2px solid #16a34a; color: #166534; }
.cv-page[data-t="wine"]   h1 { color: #7a2840; }
.cv-page[data-t="wine"]   .cv-sec { border-bottom: 2px solid #be185d; color: #7a2840; }

/* ─── MODAL ─── */
.modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.3);
  backdrop-filter: blur(6px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-bg.on { display: flex; }

.modal {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 10px;
  width: 90%;
  max-width: 480px;
  padding: 28px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
}

.modal-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 20px;
  margin-bottom: 20px;
}

.modal-field { margin-bottom: 12px; }

.modal-btns {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.btn-m {
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 20px;
  border-radius: 6px;
  border: 1px solid var(--rule);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-m.cancel {
  background: transparent;
  color: var(--ink-muted);
}

.btn-m.cancel:hover {
  border-color: var(--ink-muted);
}

.btn-m.ok {
  background: var(--blue-grad);
  color: white;
  border: none;
}

.btn-m.ok:hover {
  box-shadow: 0 2px 12px rgba(37, 84, 168, 0.25);
}

/* ─── RESPONSIVE ─── */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    top: 0;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px;
  }
  .sb-group { margin-bottom: 0; }
  .sb-actions { margin-top: 0; display: flex; gap: 8px; }
  .editor { padding: 20px; }
  .field-row { grid-template-columns: 1fr; }
}

@media print {
  .topbar, .sidebar { display: none !important; }
  .layout { grid-template-columns: 1fr !important; }
  .preview-wrap { display: block !important; padding: 0 !important; }
  .cv-page { box-shadow: none !important; border-radius: 0 !important; }
}
