/* =========================
   EDITOR
   ========================= */
#editor-page{display:none;height:100vh;grid-template-columns:380px 1fr}
.sidebar{background:var(--bg-card);padding:1.25rem;overflow-y:auto;border-right:1px solid rgba(255,255,255,.08);display:flex;flex-direction:column;gap:.85rem}
.sidebar-header{display:flex;justify-content:space-between;align-items:center;padding-bottom:.75rem;border-bottom:1px solid rgba(255,255,255,.06);margin-bottom:.25rem}
.btn-close{background:transparent;border:1px solid #475569;color:#fff;padding:.35rem .7rem;border-radius:5px;font-size:.85rem;transition:all var(--t)}
.btn-close:hover{background:#475569}
.form-group{display:flex;flex-direction:column;gap:.35rem;margin-bottom:.15rem}
.form-group label{font-size:.78rem;color:var(--text-gray);font-weight:600;text-transform:uppercase;letter-spacing:.3px}
.form-group input,.form-group textarea,.form-group select{background:var(--bg-dark);border:1px solid #334155;color:#fff;padding:.55rem .65rem;border-radius:6px;font-family:inherit;font-size:.88rem;transition:border-color var(--t);width:100%}
.form-group input:focus,.form-group textarea:focus,.form-group select:focus{outline:none;border-color:var(--accent)}
.form-group textarea{resize:vertical;min-height:60px}
.color-picker{display:flex;gap:.65rem;margin:.35rem 0}
.color-opt{width:30px;height:30px;border-radius:50%;cursor:pointer;border:3px solid transparent;transition:all var(--t)}
.color-opt:hover{transform:scale(1.1)}
.color-opt.active{border-color:#fff;box-shadow:0 0 0 2px var(--bg-dark),0 0 0 4px var(--accent)}
.preview-area{background:#334155;display:flex;justify-content:center;padding:2rem;overflow-y:auto;position:relative}
.preview-toolbar{position:absolute;top:16px;right:16px;z-index:100;display:flex;gap:.5rem}
.preview-toolbar .btn{padding:.55rem 1rem;font-size:.88rem}
.toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:#0f172a;color:#fff;padding:.75rem 1.25rem;border-radius:8px;box-shadow:var(--shadow-lg);z-index:200;border:1px solid var(--accent);animation:slideUp .3s ease}
@keyframes slideUp{from{opacity:0;transform:translate(-50%,10px)}to{opacity:1;transform:translate(-50%,0)}}

/* RESPONSIVE */
@media(max-width:900px){
  #editor-page{grid-template-columns:1fr;height:auto;grid-template-rows:auto 1fr}
  .sidebar{max-height:50vh;border-right:none;border-bottom:1px solid rgba(255,255,255,.1)}
  .preview-area{padding:1rem}
  .cv-paper{transform:scale(.6);transform-origin:top center;margin-bottom:-40%}
}
@media(max-width:500px){
  .cv-paper{transform:scale(.45);margin-bottom:-60%}
}

/* =========================
   CV PAPER (render)
   ========================= */
.cv-paper{background:var(--paper);width:210mm;min-height:297mm;color:#333;box-shadow:var(--shadow);position:relative;overflow:hidden;margin:0 auto}
.watermark{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) rotate(-30deg);font-size:4.5rem;font-weight:800;color:rgba(0,0,0,.1);pointer-events:none;white-space:nowrap;z-index:999;text-transform:uppercase;letter-spacing:4px;user-select:none}

/* EXECUTIVE */
.tpl-executive{position:relative;padding:0;min-height:297mm}
.tpl-executive #cv-layout{display:grid;grid-template-columns:32% 68%;align-items:stretch}
.tpl-executive .exec-sidebar{background:#1e293b;color:#e2e8f0;padding:22mm 18px;display:flex;flex-direction:column;gap:1.5rem;height:100%;min-height:297mm}
.tpl-executive .exec-main{padding:22mm 22mm;background:#fff;min-height:297mm}
.cv-photo{width:110px;height:110px;border-radius:50%;object-fit:cover;border:3px solid #fff;display:block;margin:0 auto 1.25rem;box-shadow:0 4px 12px rgba(0,0,0,.2)}
.tpl-executive .sidebar-section{margin-bottom:.5rem}
.tpl-executive .sidebar-title{font-family:ui-monospace,monospace;font-size:8pt;text-transform:uppercase;color:#94a3b8;border-bottom:1px solid #334155;padding-bottom:4px;margin-bottom:8px;font-weight:700;letter-spacing:1px}
.tpl-executive .sidebar-content{font-size:9pt;line-height:1.6;color:#cbd5e1;white-space:pre-wrap}
.tpl-executive .cv-name{font-family:'Playfair Display',serif;font-size:26pt;font-weight:800;color:#0f172a;line-height:1.1;margin-bottom:4px}
.tpl-executive .cv-role{font-size:11pt;color:#64748b;text-transform:uppercase;letter-spacing:2px;margin-bottom:1.75rem;font-weight:500}
.tpl-executive .cv-section{margin-bottom:1.25rem}
.tpl-executive .cv-section-title{font-family:'Playfair Display',serif;font-size:13pt;color:#0f172a;border-bottom:2px solid var(--accent);margin-bottom:.6rem;font-weight:800;padding-bottom:3px}
.tpl-executive .cv-text{line-height:1.7;font-size:10pt;color:#334155;white-space:pre-wrap}

/* CLASSIC */
.tpl-classic{padding:20mm;border:3px double #333;min-height:297mm;display:flex;flex-direction:column}
.tpl-classic .cv-photo{margin:0 auto 1rem;border:2px solid #333}
.tpl-classic .cv-name{text-align:center;font-family:Georgia,serif;font-size:24pt;margin-bottom:.25rem;letter-spacing:1px}
.tpl-classic .cv-role{text-align:center;font-size:10pt;color:#666;text-transform:uppercase;letter-spacing:2px;margin-bottom:.5rem}
.tpl-classic .cv-contact{text-align:center;font-size:9pt;color:#555;margin-bottom:1.5rem;padding-bottom:1rem;border-bottom:1px solid #999}
.tpl-classic .cv-section{margin-bottom:1.25rem}
.tpl-classive .cv-section-title, .tpl-classic .cv-section-title{font-family:Georgia,serif;font-size:13pt;text-align:center;text-transform:uppercase;letter-spacing:3px;border-bottom:1px solid #999;padding-bottom:.25rem;margin-bottom:.75rem}
.tpl-classic .cv-text{font-size:10pt;line-height:1.6;white-space:pre-wrap;color:#222}

/* MODERN */
.tpl-modern{padding:18mm 18mm 18mm 26mm;min-height:297mm;border-left:14px solid var(--accent);position:relative}
.tpl-modern::before{content:'';position:absolute;top:0;left:0;width:14px;height:100%;background:var(--accent)}
.tpl-modern .cv-photo{position:absolute;top:18mm;right:18mm;width:80px;height:80px;border-radius:50%;border:3px solid var(--accent);margin:0}
.tpl-modern .cv-name{font-family:'Inter',sans-serif;font-size:28pt;font-weight:800;line-height:1.05;margin-bottom:.25rem;color:#0f172a}
.tpl-modern .cv-role{font-size:11pt;color:var(--accent);font-weight:600;margin-bottom:1.5rem;text-transform:uppercase;letter-spacing:1.5px}
.tpl-modern .cv-section{margin-bottom:1.1rem}
.tpl-modern .cv-section-title{font-size:11pt;font-weight:800;text-transform:uppercase;letter-spacing:2px;color:var(--accent);margin-bottom:.4rem;padding-bottom:.25rem;border-bottom:1px solid #e2e8f0}
.tpl-modern .cv-text{font-size:10pt;line-height:1.55;white-space:pre-wrap;color:#475569}

/* MINIMAL */
.tpl-minimal{padding:30mm;min-height:297mm;text-align:center;display:flex;flex-direction:column;align-items:center}
.tpl-minimal .cv-photo{width:100px;height:100px;border-radius:50%;border:none;margin:0 auto 1.25rem;box-shadow:0 4px 20px rgba(0,0,0,.08)}
.tpl-minimal .cv-name{font-size:26pt;font-weight:300;letter-spacing:-1px;margin-bottom:.25rem}
.tpl-minimal .cv-role{font-size:10pt;color:var(--text-dim);text-transform:uppercase;letter-spacing:3px;margin-bottom:2rem}
.tpl-minimal .cv-section{margin-bottom:1.25rem;text-align:left;width:100%;max-width:140mm}
.tpl-minimal .cv-section-title{font-size:9pt;font-weight:700;text-transform:uppercase;letter-spacing:4px;color:var(--text-dim);text-align:center;margin-bottom:.6rem;position:relative}
.tpl-minimal .cv-section-title::after{content:'';display:block;width:30px;height:1px;background:var(--accent);margin:.5rem auto 0}
.tpl-minimal .cv-text{font-size:10pt;line-height:1.7;white-space:pre-wrap;color:#444;text-align:center}

/* STARTUP */
.tpl-startup{min-height:297mm;display:flex;flex-direction:column}
.tpl-startup .startup-header{background:var(--accent);color:#fff;padding:14mm 18mm;text-align:left;display:flex;align-items:center;gap:1.5rem}
.tpl-startup .cv-photo{width:90px;height:90px;border-radius:50%;border:3px solid #fff;margin:0;box-shadow:0 4px 12px rgba(0,0,0,.2)}
.tpl-startup .cv-name{font-size:24pt;font-weight:800;margin:0;line-height:1.1}
.tpl-startup .cv-role{font-size:11pt;opacity:.9;margin-top:.25rem;font-weight:500}
.tpl-startup .startup-body{padding:10mm 18mm;flex:1}
.tpl-startup .startup-contact{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:.5rem;font-size:9pt;color:#475569;margin-bottom:1.5rem;padding-bottom:1rem;border-bottom:1px solid #e2e8f0}
.tpl-startup .cv-section{margin-bottom:1.1rem}
.tpl-startup .cv-section-title{font-size:11pt;font-weight:800;color:var(--accent);text-transform:uppercase;letter-spacing:1.5px;margin-bottom:.5rem}
.tpl-startup .cv-text{font-size:10pt;line-height:1.6;white-space:pre-wrap;color:#334155}

/* ELEGANT */
.tpl-elegant{padding:0;min-height:297mm}
.tpl-elegant .elegant-header{background:linear-gradient(135deg,#0f172a 0%,#1e293b 100%);color:#fff;padding:18mm;text-align:center;position:relative;overflow:hidden}
.tpl-elegant .elegant-header::after{content:'';position:absolute;bottom:0;left:0;right:0;height:3px;background:var(--gold)}
.tpl-elegant .cv-photo{width:110px;height:110px;border-radius:50%;border:3px solid var(--gold);margin:0 auto 1rem;box-shadow:0 0 0 4px rgba(201,168,76,.2)}
.tpl-elegant .cv-name{font-family:'Playfair Display',serif;font-size:30pt;font-weight:800;margin:0;letter-spacing:-.5px}
.tpl-elegant .cv-role{font-size:11pt;color:var(--gold);text-transform:uppercase;letter-spacing:4px;margin-top:.4rem;font-weight:500}
.tpl-elegant .elegant-body{padding:12mm 18mm;background:#fafaf9}
.tpl-elegant .cv-section{margin-bottom:1.25rem}
.tpl-elegant .cv-section-title{font-family:'Playfair Display',serif;font-size:14pt;color:#0f172a;margin-bottom:.5rem;display:flex;align-items:center;gap:.5rem}
.tpl-elegant .cv-section-title::before{content:'';width:18px;height:2px;background:var(--gold)}
.tpl-elegant .cv-text{font-size:10pt;line-height:1.7;white-space:pre-wrap;color:#444}
.tpl-elegant .cv-contact{font-size:9pt;color:#666;margin-bottom:1.5rem;text-align:center;letter-spacing:.5px}

/* =========================
   PLANTILLA THUMBS (sidebar)
   ========================= */
.tpl-thumbs{display:grid;grid-template-columns:repeat(3,1fr);gap:.5rem;margin:.35rem 0}
.tpl-thumb{position:relative;padding:0;border:2px solid transparent;background:var(--bg-dark);border-radius:6px;overflow:hidden;cursor:pointer;transition:all .15s;display:flex;flex-direction:column}
.tpl-thumb img{width:100%;aspect-ratio:210/297;object-fit:cover;object-position:top;display:block;background:#fff}
.tpl-thumb span{font-size:.68rem;color:var(--text-gray);padding:.25rem .1rem;text-align:center;font-weight:600}
.tpl-thumb:hover{border-color:var(--text-gray);transform:translateY(-2px)}
.tpl-thumb.active{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent)}
.tpl-thumb.pro .pro-tag{position:absolute;top:3px;right:3px;background:var(--gold);color:#000;font-size:.55rem;font-weight:800;padding:1px 4px;border-radius:3px;z-index:2;letter-spacing:.3px}
.tpl-thumb.active span{color:var(--white)}

/* =========================
   CURRENT TEMPLATE PREVIEW (toolbar)
   ========================= */
.current-tpl-preview{display:flex;align-items:center;gap:.65rem;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.1);border-radius:8px;padding:.35rem .5rem}
.current-tpl-preview img{width:38px;height:54px;object-fit:cover;object-position:top;border-radius:3px;background:#fff;display:block}
.current-tpl-info{display:flex;flex-direction:column;line-height:1.1}
.current-tpl-name{font-weight:700;color:#fff;font-size:.85rem}
.current-tpl-status{font-size:.7rem;color:var(--text-dim);font-weight:600;text-transform:uppercase;letter-spacing:.4px}
.current-tpl-status.pro{color:var(--gold)}

@media(max-width:700px){.current-tpl-preview{display:none}}
