/* ============================================================
   style.css
   ============================================================ */

:root {
  --bg:            #0d0d0f;
  --bg-card:       #131316;
  --bg-card-hover: #16161a;
  --bg-note:       #131316;
  --bg-bubble:     #1a1a1f;
  --bg-modal:      #111114;
  --bg-input:      #0d0d0f;

  --accent:        #ffffff;
  --accent-dim:    rgba(255, 255, 255, 0.1);
  --accent-border: rgba(255, 255, 255, 0.28);

  --text-1:        #eaeaec;
  --text-2:        #72728a;
  --text-3:        #3a3a50;

  --border:        rgba(255, 255, 255, 0.065);
  --border-card:   rgba(255, 255, 255, 0.07);

  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     12px;
  --radius-pill:   100px;

  --font:          'Inter', system-ui, sans-serif;
  --nav-h:         44px;
  --ease:          0.16s ease;
}

/* 1. RESET */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button { background: none; border: none; cursor: pointer; font-family: inherit; color: inherit; }
img { display: block; }
input, textarea, select {
  font-family: var(--font);
  font-size: 12.5px;
  color: var(--text-1);
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--ease);
}
input:focus, textarea:focus, select:focus { border-color: var(--accent-border); }
textarea { resize: vertical; }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1e1e26; border-radius: 3px; }

/* 2. NAVBAR */
.navbar {
  height: var(--nav-h);
  background: rgba(13, 13, 15, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.navbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 32px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-nav {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-card);
  background: transparent;
  color: var(--text-2);
  transition: all var(--ease);
}

.btn-nav:hover {
  color: var(--text-1);
  border-color: var(--accent-border);
  background: var(--accent-dim);
}

/* 3. MAIN / CONTAINER */
.main { padding: 36px 32px 80px; }

.container {
  max-width: 1240px;
  margin: 0 auto;
}

/* 4. CHAMPION SELECTOR */
.champion-selector {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 24px;
}

.champ-bubble {
  display: flex;
  align-items: center;
  gap: 0px;
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: var(--bg-bubble);
  transition:
    gap          0.22s cubic-bezier(0.4, 0, 0.2, 1),
    padding      0.22s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.16s ease,
    background   0.16s ease,
    opacity      0.16s ease;
  overflow: hidden;
  white-space: nowrap;
}

.champ-bubble.is-collapsed {
  opacity: 0.45;
  transform: scale(0.92);
  transition:
    gap          0.22s cubic-bezier(0.4, 0, 0.2, 1),
    padding      0.22s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.16s ease,
    background   0.16s ease,
    opacity      0.16s ease,
    transform    0.16s ease;
}

.champ-bubble.is-collapsed:hover { opacity: 0.75; transform: scale(1); }

.champ-bubble.active {
  gap: 9px;
  padding: 4px 12px 4px 4px;
  border-color: var(--border-card);
  background: #1f1f26;
  opacity: 1;
  transform: scale(1);
}

.bubble-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.1);
  background: #111114;
  flex-shrink: 0;
}

.bubble-avatar-ph {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #111114;
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--text-3);
}

.bubble-name {
  font-size: 13px; font-weight: 500; color: var(--text-1);
  max-width: 0; overflow: hidden; opacity: 0;
  transition: max-width 0.22s cubic-bezier(0.4,0,0.2,1), opacity 0.18s ease;
}

.champ-bubble.active .bubble-name { max-width: 140px; opacity: 1; }

/* 5. CHAMPION HERO */
.champion-hero {
  margin-bottom: 24px;
  display: flex; align-items: baseline; gap: 12px;
}

.hero-name {
  font-size: 30px; font-weight: 600;
  letter-spacing: -0.025em; color: var(--text-1);
}

.hero-role { font-size: 13px; color: var(--text-2); }

/* 6. OVERVIEW LABEL */
.overview-label {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-3);
  margin-bottom: 12px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* 7. BUILD GRID */
.build-grid {
  columns: 3;
  column-gap: 20px;
}

.build-grid .card {
  break-inside: avoid;
  margin-bottom: 20px;
  display: inline-block;
  width: 100%;
  vertical-align: top;
}

@media (max-width: 960px) { .build-grid { columns: 2; } }

@media (max-width: 540px) {
  .build-grid { columns: 1; }
  .main { padding: 24px 16px 60px; }
  .navbar-inner { padding: 0 16px; }
}

/* 8. CARD */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--ease);
}

.card.drag-over {
  border-color: var(--accent-border);
  background: var(--bg-card-hover);
}

.card-header {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}

.card-label {
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-3);
  flex: 1; min-width: 0;
  border-radius: 4px;
  padding: 2px 5px; margin: -2px -5px;
  transition: background var(--ease), color var(--ease);
  cursor: text;
}

.card-label:hover { background: var(--accent-dim); }

.card-label:focus {
  background: var(--accent-dim);
  color: var(--text-2);
  outline: 1px solid var(--border-card);
  text-transform: none;
  letter-spacing: 0;
}

.card-header-actions {
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}

/* Botón + añadir ítem */
.card-add-btn {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1;
  color: var(--text-3); flex-shrink: 0;
  transition: all var(--ease);
}

.card-add-btn:hover {
  border-color: var(--accent-border);
  color: var(--text-1);
  background: var(--accent-dim);
}

/* Botón borrar tarjeta (visible en hover del header) */
.card-del-btn {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1px solid transparent;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; line-height: 1;
  color: var(--text-3); flex-shrink: 0;
  opacity: 0;
  transition: all var(--ease);
}

.card-header:hover .card-del-btn { opacity: 1; }

.card-del-btn:hover {
  border-color: rgba(220,60,60,0.4);
  color: #dc3c3c;
  background: rgba(220,60,60,0.08);
}

.card-body { display: flex; flex-direction: column; }

/* 9. ITEM ROW */
.item-row { display: flex; flex-direction: column; }
.item-row + .item-row { border-top: 1px solid var(--border); }

.item-row.is-open > .item-trigger { background: var(--accent-dim); }
.item-row.is-open > .item-trigger .item-name { color: var(--accent); }
.item-row.is-open > .item-trigger .item-icon,
.item-row.is-open > .item-trigger .item-icon-ph { border-color: var(--accent-border); }
.item-row.is-open > .item-trigger .chevron { transform: rotate(180deg); color: var(--accent); }

/* Estado de drag del ítem */
.item-row.dragging {
  opacity: 0.4;
}

/* Zona de drop: línea visual entre ítems */
.item-row.drag-target-above {
  border-top: 2px solid var(--accent-border);
}

.item-trigger {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  cursor: pointer; width: 100%; text-align: left;
  transition: background var(--ease);
}

.item-trigger:hover { background: var(--bg-card-hover); }

/* Botones editar/borrar que aparecen en hover */
.item-trigger:hover .item-actions { opacity: 1; }
.item-trigger:hover .drag-handle { opacity: 1; }

/* 9a. DRAG HANDLE */
.drag-handle {
  cursor: grab;
  color: var(--text-3);
  font-size: 11px;
  opacity: 0;
  flex-shrink: 0;
  padding: 2px 3px;
  border-radius: 3px;
  transition: opacity var(--ease), color var(--ease), background var(--ease);
  /* Los 6 puntos del handle */
  display: flex; align-items: center; justify-content: center;
  width: 14px;
}

.drag-handle:hover {
  color: var(--text-2);
  background: var(--accent-dim);
}

.drag-handle:active { cursor: grabbing; }

.item-actions {
  display: flex; gap: 3px;
  opacity: 0;
  transition: opacity var(--ease);
  flex-shrink: 0;
  margin-left: auto;
}

.item-action-btn {
  width: 22px; height: 22px;
  border-radius: 4px;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text-2);
  transition: all var(--ease);
  flex-shrink: 0;
}

.item-action-btn:hover {
  border-color: var(--accent-border);
  color: var(--text-1);
  background: var(--accent-dim);
}

.item-action-btn.del:hover {
  border-color: rgba(220,60,60,0.4);
  color: #dc3c3c;
  background: rgba(220,60,60,0.08);
}

.item-icon {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: #1a1a1f;
  border: 1px solid var(--border);
  flex-shrink: 0;
  transition: border-color var(--ease);
}

.item-icon-ph {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  background: #1a1a1f;
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--text-3);
  transition: border-color var(--ease);
}

.item-name {
  flex: 1;
  font-size: 12.5px; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color var(--ease);
}

.chevron {
  font-size: 8px; color: var(--text-3); flex-shrink: 0;
  transition: transform 0.2s ease, color var(--ease);
}

/* 10. NOTE PANEL */
.item-note {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.24s cubic-bezier(0.4, 0, 0.2, 1);
}

.item-note.is-open { grid-template-rows: 1fr; }
.item-note-inner { overflow: hidden; }

.item-panel {
  border-top: 1px solid rgba(200, 170, 90, 0.2);
  background: #0f0f12;
}

.item-panel-label {
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: #eaeaec;
  padding: 9px 14px 4px 54px; opacity: 0.85;
}

.item-panel-stats { padding-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,0.05); }

.item-stats-list {
  list-style: none;
  padding: 2px 14px 8px 54px;
  display: flex; flex-direction: column; gap: 3px;
}

.item-stat { font-size: 12px; line-height: 1.5; color: var(--text-2); }

.stat-value {
  color: #eaeaec;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.item-panel-analysis { padding-bottom: 12px; }

.item-analysis-body {
  padding: 4px 14px 4px 54px;
  font-size: 12.5px; font-weight: 300; color: var(--text-2);
  line-height: 1.78; font-style: italic;
}

.item-analysis-body.is-empty {
  font-style: normal; font-size: 11.5px; color: var(--text-3);
}

/* 11. CARD EMPTY */
.card-empty { padding: 16px 14px; font-size: 12px; color: var(--text-3); font-style: italic; }

/* Zona de drop vacía dentro de la tarjeta: se activa cuando se arrastra encima */
.card-drop-zone {
  min-height: 36px;
  border: 1px dashed transparent;
  border-radius: var(--radius-sm);
  margin: 6px;
  transition: border-color var(--ease), background var(--ease);
}

.card.drag-over .card-drop-zone {
  border-color: rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.03);
}

/* 12. INLINE ITEM EDITOR */
.item-editor {
  background: #0d0d10;
  border-top: 1px solid rgba(200,170,90,0.15);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
}

.item-editor-row { display: flex; gap: 8px; }

.item-editor-field { display: flex; flex-direction: column; gap: 3px; flex: 1; }

.item-editor-field label {
  font-size: 9px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3);
}

.item-editor-field input,
.item-editor-field textarea,
.item-editor-field select {
  padding: 6px 8px; font-size: 12px; width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-1);
  border-radius: var(--radius-sm);
}

.item-editor-field input:focus,
.item-editor-field textarea:focus,
.item-editor-field select:focus {
  border-color: var(--accent-border); outline: none;
}

.item-editor-actions {
  display: flex; justify-content: flex-end; gap: 6px;
}

.btn-editor {
  padding: 5px 11px;
  font-size: 11.5px; font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-card);
  color: var(--text-2);
  transition: all var(--ease);
}

.btn-editor:hover {
  color: var(--text-1); border-color: var(--accent-border); background: var(--accent-dim);
}

.btn-editor.save {
  border-color: var(--accent-border); color: var(--text-1); background: var(--accent-dim);
}

.btn-editor.save:hover { background: rgba(255,255,255,0.15); }

/* 13. ADD ITEM INLINE FORM */
.add-item-form {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  display: none; flex-direction: column; gap: 8px;
  background: #0d0d10;
}

.add-item-form.is-open { display: flex; }

/* 14. MODAL (solo campeones) */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.is-open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 520px; max-height: 85vh;
  display: flex; flex-direction: column;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.22s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
}

.modal-overlay.is-open .modal { transform: translateY(0) scale(1); }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title { font-size: 14px; font-weight: 600; color: var(--text-1); }

.modal-close {
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-card);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text-2);
  transition: all var(--ease);
}

.modal-close:hover { color: var(--text-1); border-color: var(--accent-border); }

.modal-body {
  overflow-y: auto; padding: 18px 20px;
  flex: 1; display: flex; flex-direction: column; gap: 18px;
}

.form-section { display: flex; flex-direction: column; gap: 8px; }

.form-section-title {
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-3);
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}

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

.form-field { display: flex; flex-direction: column; gap: 4px; }

.form-field label {
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2);
}

.form-field input { padding: 7px 10px; width: 100%; }

.form-actions { display: flex; justify-content: flex-end; gap: 6px; padding-top: 2px; }

.btn-form {
  padding: 7px 14px; font-size: 12px; font-weight: 500;
  border-radius: var(--radius-sm); border: 1px solid var(--border-card);
  color: var(--text-2); transition: all var(--ease);
}

.btn-form:hover {
  color: var(--text-1); border-color: var(--accent-border); background: var(--accent-dim);
}

.btn-form.primary {
  border-color: var(--accent-border); color: var(--text-1); background: var(--accent-dim);
}

.btn-form.primary:hover { background: rgba(255,255,255,0.14); }

.btn-form.danger {
  border-color: rgba(220,60,60,0.3); color: #dc3c3c; background: transparent;
  padding: 4px 8px; font-size: 11px;
}

.btn-form.danger:hover { background: rgba(220,60,60,0.08); }

.champ-list {
  display: flex; flex-direction: column; gap: 5px;
  max-height: 280px; overflow-y: auto;
}

.list-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
}

.list-row-icon {
  width: 26px; height: 26px; border-radius: 50%;
  object-fit: cover; border: 1px solid var(--border);
  background: #111; flex-shrink: 0;
}

.list-row-icon-ph {
  width: 26px; height: 26px; border-radius: 50%;
  background: #111; border: 1px solid var(--border);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; color: var(--text-3);
}

.list-row-info { flex: 1; min-width: 0; }

.list-row-name {
  font-size: 12.5px; font-weight: 500; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.list-row-sub { font-size: 11px; color: var(--text-2); }

.list-row-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* 15. TOAST */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-1);
  padding: 9px 16px; border-radius: var(--radius-pill);
  font-size: 12.5px; font-weight: 500;
  pointer-events: none; opacity: 0; z-index: 300;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap; box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }