/* ============================================================
   form.css — Estilos elegantes para el Generador de CV
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:        #eb8c3d;
  --primary-light:  #ffb366;
  --primary-dark:   #c97028;
  --dark:           #1a1a2e;
  --dark-2:         #16213e;
  --dark-3:         #0f3460;
  --text:           #2d2d2d;
  --text-muted:     #888;
  --bg:             #f0f2f5;
  --white:          #ffffff;
  --border:         #e0e0e0;
  --radius:         12px;
  --radius-sm:      8px;
  --shadow:         0 4px 24px rgba(0,0,0,0.08);
  --shadow-md:      0 8px 32px rgba(0,0,0,0.12);
  --shadow-hover:   0 12px 40px rgba(235,140,61,0.22);
  --transition:     0.22s cubic-bezier(.4,0,.2,1);
}

html { scroll-behavior: smooth; }

/* ===================== BODY MODES ===================== */
body.form-page,
body.user-select-page,
body.preview-page {
  background: var(--bg);
  font-family: 'Montserrat', sans-serif;
  color: var(--text);
  min-height: 100vh;
}

/* ===================== TOPBAR ===================== */
.topbar {
  background: var(--dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 62px;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 16px rgba(0,0,0,0.28);
}

.topbar-logo {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--primary);
  text-decoration: none;
}
.topbar-logo span { color: #fff; font-weight: 300; }

.topbar-center {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ccc;
  font-size: 0.85rem;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-user .t-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.topbar-user .t-name {
  font-size: 0.9rem;
  color: #ccc;
  font-weight: 500;
}

.topbar-link {
  color: #aaa;
  text-decoration: none;
  font-size: 0.82rem;
  padding: 7px 16px;
  border: 1px solid #444;
  border-radius: 6px;
  transition: var(--transition);
  font-weight: 500;
}
.topbar-link:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(235,140,61,0.06);
}

/* ===================== LAYOUT ===================== */
.page-layout {
  display: flex;
  min-height: calc(100vh - 62px);
}

/* ===================== SIDEBAR ===================== */
.sidebar {
  width: 230px;
  background: var(--dark);
  padding: 28px 0 40px;
  position: sticky;
  top: 62px;
  height: calc(100vh - 62px);
  overflow-y: auto;
  flex-shrink: 0;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

.sidebar-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 0 24px 10px;
}

.sidebar-nav { list-style: none; }

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: #8a8a9a;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.sidebar-nav li a .nav-icon {
  font-size: 1rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-nav li a:hover {
  color: #ddd;
  background: rgba(255,255,255,0.04);
  border-left-color: rgba(235,140,61,0.4);
}

.sidebar-nav li a.active {
  color: #fff;
  background: rgba(235,140,61,0.12);
  border-left-color: var(--primary);
}

.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 16px 24px;
}

/* ===================== MAIN CONTENT ===================== */
.main-content {
  flex: 1;
  padding: 36px 40px 60px;
  max-width: 900px;
}

/* ===================== FORM CARD ===================== */
.form-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 36px;
  margin-bottom: 28px;
  transition: box-shadow var(--transition);
}
.form-card:hover { box-shadow: var(--shadow-md); }

.form-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1.5px solid #f2f2f2;
}

.form-card-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(235,140,61,0.3);
}

.form-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--dark);
  letter-spacing: 0.3px;
}
.form-card-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ===================== FORM GRID ===================== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 22px;
}
.form-grid.col-1  { grid-template-columns: 1fr; }
.form-grid.col-3  { grid-template-columns: 1fr 1fr 1fr; }
.span-2           { grid-column: span 2; }

/* ===================== FORM GROUP ===================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.form-group label {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.form-control {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.92rem;
  font-family: 'Montserrat', sans-serif;
  color: var(--text);
  background: #fafafa;
  transition: var(--transition);
  outline: none;
  width: 100%;
}
.form-control::placeholder { color: #bbb; }
.form-control:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(235,140,61,0.12);
}
textarea.form-control {
  resize: vertical;
  min-height: 88px;
  line-height: 1.6;
}

/* ===================== FOTO INPUT ===================== */
.foto-wrapper {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  padding: 20px;
  background: #f9f9fb;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--border);
}

.foto-preview {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: #eee;
  overflow: hidden;
  border: 3px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ccc;
  font-size: 2.4rem;
  flex-shrink: 0;
}
.foto-preview img { width: 100%; height: 100%; object-fit: cover; }

.foto-info h4 { font-size: 0.9rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.foto-info p  { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 10px; }

.btn-file {
  background: none;
  border: 1.5px dashed var(--primary);
  color: var(--primary);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-file:hover { background: rgba(235,140,61,0.08); }

/* ===================== DYNAMIC ITEM ===================== */
.dynamic-item {
  background: #f9f9fb;
  border: 1.5px solid #eaeaea;
  border-radius: 10px;
  padding: 20px 20px 20px 20px;
  margin-bottom: 14px;
  position: relative;
  transition: border-color var(--transition);
}
.dynamic-item:hover { border-color: #d0d0d0; }

.remove-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: #ccc;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  padding: 3px 8px;
  border-radius: 5px;
  line-height: 1;
  font-weight: 700;
}
.remove-btn:hover { background: #fee2e2; color: #e44; }

/* ===================== SKILL RANGE ===================== */
.skill-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
}
.skill-row input[type="range"] {
  flex: 1;
  height: 6px;
  accent-color: var(--primary);
  cursor: pointer;
}
.skill-val {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  min-width: 40px;
  text-align: right;
}

/* ===================== SUBSECTION TITLE ===================== */
.sub-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 24px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sub-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 16px;
  background: var(--primary);
  border-radius: 2px;
}

/* ===================== ADD BUTTON ===================== */
.add-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1.5px dashed var(--primary);
  color: var(--primary);
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 6px;
}
.add-btn:hover { background: rgba(235,140,61,0.08); transform: translateY(-1px); }

/* ===================== BUTTONS ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-family: 'Montserrat', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-decoration: none;
  letter-spacing: 0.3px;
}
.btn-primary {
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(235,140,61,0.30);
}
.btn-primary:hover {
  box-shadow: 0 8px 28px rgba(235,140,61,0.45);
  transform: translateY(-2px);
}
.btn-outline {
  background: none;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover { background: rgba(235,140,61,0.08); transform: translateY(-1px); }
.btn-dark {
  background: var(--dark);
  color: #fff;
}
.btn-dark:hover { background: var(--dark-2); }
.btn-sm { padding: 8px 18px; font-size: 0.82rem; }

/* ===================== ACTION BAR ===================== */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 24px 0 48px;
}

/* ===================== TOAST ===================== */
.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  background: var(--dark);
  color: #fff;
  padding: 14px 24px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  z-index: 9999;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  max-width: 360px;
}
.toast.show    { opacity: 1; transform: translateY(0); }
.toast.success { border-left: 4px solid #4caf50; }
.toast.error   { border-left: 4px solid #ef5350; }

/* ===================== PREVIEW TOOLBAR ===================== */
.preview-toolbar {
  background: var(--dark);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 16px rgba(0,0,0,0.28);
}

/* ===================== SELECT USER PAGE ===================== */
.select-hero {
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark-3) 100%);
  padding: 70px 40px 50px;
  text-align: center;
  color: #fff;
}
.select-hero h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.1;
}
.select-hero h1 span { color: var(--primary); }
.select-hero p  { color: #aaa; font-size: 1rem; margin-top: 8px; }

.users-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  justify-content: center;
  padding: 52px 40px 64px;
  max-width: 1100px;
  margin: auto;
}

.user-card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 32px 24px 28px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
  width: 196px;
  text-decoration: none;
  color: var(--text);
  position: relative;
}
.user-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-hover);
  transform: translateY(-5px);
}
.user-card .u-avatar {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  font-size: 1.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 4px 14px rgba(235,140,61,0.30);
}
.user-card .u-name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 5px;
  color: var(--dark);
}
.user-card .u-date {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.user-card.new-card .u-avatar {
  background: linear-gradient(135deg, #444 0%, #777 100%);
  font-size: 2.4rem;
  font-weight: 300;
  box-shadow: none;
}

/* ===================== MODAL ===================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,10,20,0.65);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: #fff;
  border-radius: 18px;
  padding: 44px 40px 36px;
  max-width: 430px;
  width: 92%;
  box-shadow: 0 16px 56px rgba(0,0,0,0.26);
  transform: translateY(24px) scale(0.97);
  transition: transform 0.28s cubic-bezier(.4,0,.2,1), opacity 0.25s;
  opacity: 0;
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); opacity: 1; }

.modal h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 6px;
}
.modal p.modal-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.modal .form-group { margin-bottom: 16px; }
.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  justify-content: flex-end;
}

.modal-error {
  background: #fee2e2;
  color: #c0392b;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.83rem;
  font-weight: 600;
  margin-bottom: 16px;
}

/* ===================== SPINNER ===================== */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { padding: 20px 16px; }
  .form-card { padding: 20px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid.col-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .topbar { padding: 0 16px; }
}
