/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: #0f1117;
  color: #e8e6e0;
  height: 100vh;
  overflow: hidden;
}
a { color: #6b9ccd; text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: 'IBM Plex Mono', monospace; font-size: 0.85em; background: rgba(255,255,255,0.07); padding: 1px 6px; border-radius: 3px; }

/* ── 3-column editor layout ── */
.layout {
  display: grid;
  grid-template-columns: 215px 1fr 400px;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  background: #0a0c12;
  border-right: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.brand-icon {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, #2a5298, #1a3668);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px; font-weight: 500; color: #93b8e8;
  flex-shrink: 0;
}
.brand-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 15px; font-weight: 600; color: #e8e6e0;
  margin-left: 10px; letter-spacing: -0.01em;
}
.sidebar-nav {
  flex: 1;
  padding: 0.6rem 0;
  display: flex; flex-direction: column; gap: 1px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 0.58rem 1.25rem;
  font-size: 13.5px; color: #7a8090;
  background: none; border: none;
  cursor: pointer; text-align: left; width: 100%;
  border-left: 2px solid transparent;
  transition: color 0.15s, background 0.15s;
  font-family: 'DM Sans', sans-serif;
}
.nav-item:hover { color: #c8c4bc; background: rgba(255,255,255,0.04); }
.nav-item.active { color: #93b8e8; background: rgba(42,82,152,0.15); border-left-color: #2a5298; }
.nav-item svg { flex-shrink: 0; opacity: 0.8; }
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.btn-export {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0.6rem 1rem;
  background: linear-gradient(135deg, #2a5298, #1a3668);
  color: #c8dcf4; border: none; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer; transition: opacity 0.15s, transform 0.1s;
}
.btn-export:hover { opacity: 0.88; transform: translateY(-1px); }

/* ── Main Content ── */
.main-content { overflow-y: auto; padding: 2rem 2.5rem; background: #0f1117; }
.page { display: none; }
.page.active { display: block; }
.page-header { margin-bottom: 1.75rem; }
.page-header h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 21px; font-weight: 600; color: #e8e6e0;
  margin-bottom: 4px; letter-spacing: -0.02em;
}
.page-header p { font-size: 13px; color: #5a6070; }

/* ── Forms ── */
.form-grid { display: grid; gap: 14px; }
.form-grid.two-col { grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 11.5px; font-weight: 500; color: #5a6070; text-transform: uppercase; letter-spacing: 0.06em; }
input[type=text], input[type=email], input[type=url], textarea, select {
  background: #181c26; border: 1px solid rgba(255,255,255,0.08); border-radius: 8px;
  padding: 0.55rem 0.85rem; font-size: 13.5px; color: #e8e6e0;
  font-family: 'DM Sans', sans-serif; width: 100%; outline: none;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus {
  border-color: rgba(42,82,152,0.6); box-shadow: 0 0 0 3px rgba(42,82,152,0.12);
}
input::placeholder, textarea::placeholder { color: #3a4050; }
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
select { cursor: pointer; }

/* ── Entry Cards ── */
.entries-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.entry-card { background: #181c26; border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; overflow: hidden; }
.entry-card-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 1rem; background: #1e2330;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: pointer; user-select: none;
}
.entry-card-title { font-size: 13.5px; font-weight: 500; color: #c8c4bc; }
.entry-card-actions { display: flex; gap: 2px; }
.btn-icon {
  background: none; border: none; cursor: pointer;
  color: #5a6070; padding: 4px 5px; border-radius: 5px;
  display: flex; align-items: center; transition: all 0.15s;
}
.btn-icon:hover { color: #e8e6e0; background: rgba(255,255,255,0.07); }
.btn-icon.danger:hover { color: #f08080; }
.entry-card-body { padding: 1rem; display: flex; flex-direction: column; gap: 12px; }
.entry-card-body.collapsed { display: none; }
.entry-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.entry-form-row.full { grid-template-columns: 1fr; }
.bullets-hint { font-size: 11px; color: #3a4050; margin-top: 3px; }
.btn-add-entry {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0.6rem 1rem; border: 1px dashed rgba(255,255,255,0.11);
  border-radius: 8px; background: none; color: #5a6070;
  font-size: 13px; cursor: pointer; font-family: 'DM Sans', sans-serif;
  transition: all 0.15s; width: 100%;
}
.btn-add-entry:hover { color: #93b8e8; border-color: rgba(42,82,152,0.4); background: rgba(42,82,152,0.07); }

/* ── Preview Pane ── */
.preview-pane {
  background: #0a0c12; border-left: 1px solid rgba(255,255,255,0.07);
  display: flex; flex-direction: column; overflow: hidden;
}
.preview-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 1rem; border-bottom: 1px solid rgba(255,255,255,0.07);
}
.preview-label { font-size: 11px; color: #3a4050; font-weight: 500; text-transform: uppercase; letter-spacing: 0.07em; }
.preview-actions { display: flex; gap: 5px; }
.preview-action-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 0.35rem 0.65rem;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.07);
  border-radius: 6px; color: #7a8090;
  font-size: 12px; cursor: pointer; font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
}
.preview-action-btn:hover { color: #e8e6e0; background: rgba(255,255,255,0.08); }
.preview-tabs { display: flex; border-bottom: 1px solid rgba(255,255,255,0.07); padding: 0 1rem; }
.ptab {
  padding: 0.5rem 0.9rem;
  background: none; border: none; font-size: 12.5px; color: #5a6070;
  cursor: pointer; font-family: 'DM Sans', sans-serif;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: all 0.15s;
}
.ptab:hover { color: #c8c4bc; }
.ptab.active { color: #93b8e8; border-bottom-color: #2a5298; }
.preview-body { flex: 1; overflow-y: auto; padding: 1rem; }
.ptab-content { display: none; }
.ptab-content.active { display: block; }

/* ── Resume Sheet (visual preview) ── */
.resume-sheet {
  background: white; color: #000;
  font-family: 'Times New Roman', Times, serif;
  font-size: 9.5pt; padding: 28pt 30pt; line-height: 1.3;
  min-height: 500px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5); border-radius: 2px;
}
.rs-doc { font-family: 'Times New Roman', Times, serif; }
.rs-name { font-size: 20pt; font-weight: bold; margin-bottom: 2pt; }
.rs-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 7pt; }
.rs-section-title {
  font-size: 10pt; font-variant: small-caps; letter-spacing: 0.03em;
  border-bottom: 0.7pt solid #000; padding-bottom: 1pt;
  margin: 9pt 0 5pt; font-weight: bold;
}
.rs-entry { margin-bottom: 5pt; }
.rs-entry-header { display: flex; justify-content: space-between; align-items: baseline; }
.rs-entry-org { font-weight: bold; font-size: 9.5pt; }
.rs-entry-loc { font-size: 8pt; color: #333; }
.rs-entry-role { display: flex; justify-content: space-between; font-style: italic; font-size: 8.5pt; color: #222; }
.rs-bullets { margin: 2pt 0 0 10pt; }
.rs-bullet { position: relative; padding-left: 8pt; font-size: 8.5pt; line-height: 1.38; margin-bottom: 1.5pt; }
.rs-bullet::before { content: '•'; position: absolute; left: 0; }
.rs-skills-row { font-size: 8.5pt; margin-bottom: 2.5pt; }
.rs-skills-cat { font-weight: bold; }
/* Modern template overrides */
.tpl-modern .rs-name { color: #1e468c; }
.tpl-modern .rs-section-title { color: #1e468c; border-bottom-color: #1e468c; }
.rs-header-modern { border-bottom: 1.5pt solid #1e468c; padding-bottom: 6pt; margin-bottom: 8pt; }
.rs-contact-bar { font-size: 8.5pt; color: #444; margin-top: 3pt; }
/* Executive template */
.tpl-executive .rs-section-title { font-variant: normal; text-transform: uppercase; letter-spacing: 0.06em; }

/* ── LaTeX Code ── */
.latex-code {
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; line-height: 1.65;
  color: #a8c4e0; white-space: pre; overflow-x: auto;
}

/* ── Export Modal ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.78); z-index: 1000;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #181c26; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px; width: min(780px, 93vw); max-height: 88vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.2rem 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.07);
}
.modal-header h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 17px; font-weight: 600; color: #e8e6e0;
}
.modal-close { background: none; border: none; cursor: pointer; color: #5a6070; padding: 4px; border-radius: 5px; }
.modal-close:hover { color: #e8e6e0; }
.modal-desc { padding: 0.8rem 1.5rem; font-size: 13px; color: #7a8090; }
.modal-actions { display: flex; gap: 8px; padding: 0 1.5rem 0.8rem; }
.btn-copy-modal {
  padding: 0.5rem 1.1rem;
  background: linear-gradient(135deg, #2a5298, #1a3668);
  color: #c8dcf4; border: none; border-radius: 7px;
  font-size: 13px; font-weight: 500; font-family: 'DM Sans', sans-serif; cursor: pointer;
}
.btn-copy-modal:hover { opacity: 0.88; }

.latex-modal-code {
  flex: 1; overflow-y: auto;
  font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; line-height: 1.65;
  color: #a8c4e0; padding: 1rem 1.5rem;
  background: #0f1117; border-top: 1px solid rgba(255,255,255,0.07);
  white-space: pre; overflow-x: auto;
}

/* ── Toast ── */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #2a5298; color: #c8dcf4;
  padding: 0.55rem 1.2rem; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s; z-index: 2000;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Scrollbars ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }
