/* ==========================================================================
   notes.css — Bookmarks y notas personales del lector (AM3).
   Pareja JS: notes.js
   ========================================================================== */

/* --------- Botón flotante (esquina inferior derecha) --------- */
.notes-fab{
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--rule, #d8d2c0);
  border-radius: 999px;
  background: var(--bg-elev, #fffaf0);
  color: var(--ink, #1a1a1a);
  font-family: var(--sans, -apple-system, sans-serif);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow, 0 1px 3px rgba(0,0,0,.06), 0 6px 18px rgba(0,0,0,.05));
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.notes-fab:hover,
.notes-fab:focus{
  transform: translateY(-1px);
  background: var(--accent-soft, #e6eef9);
}
.notes-fab:focus-visible{
  outline: 3px solid var(--accent, #2a5d9f);
  outline-offset: 2px;
}

.notes-fab .notes-fab-icon{
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.notes-fab .notes-fab-count{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent, #2a5d9f);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}

.notes-fab .notes-fab-count[hidden]{ display: none; }

/* --------- Backdrop --------- */
.notes-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.32);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 9100;
}
.notes-panel-open .notes-backdrop{
  opacity: 1;
  pointer-events: auto;
}

/* --------- Panel lateral --------- */
.notes-panel{
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(420px, 100vw);
  background: var(--bg-elev, #fffaf0);
  color: var(--ink, #1a1a1a);
  border-left: 1px solid var(--rule, #d8d2c0);
  box-shadow: -10px 0 30px rgba(0,0,0,.18);
  transform: translateX(100%);
  transition: transform .25s ease;
  display: flex;
  flex-direction: column;
  z-index: 9200;
  font-family: var(--sans, -apple-system, sans-serif);
}
.notes-panel-open .notes-panel{
  transform: translateX(0);
}

.notes-panel-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--rule, #d8d2c0);
}
.notes-panel-header h2{
  margin: 0;
  font-family: var(--serif, Georgia, serif);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .01em;
}
.notes-panel-close{
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 22px;
  line-height: 1;
  width: 30px;
  height: 30px;
  cursor: pointer;
  color: var(--ink-soft, #4a4a4a);
}
.notes-panel-close:hover{
  background: var(--rule, #d8d2c0);
}

.notes-tabs{
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--rule, #d8d2c0);
}
.notes-tab{
  flex: 1;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--ink-mute, #7a7a7a);
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
}
.notes-tab.is-active{
  color: var(--accent, #2a5d9f);
  border-bottom-color: var(--accent, #2a5d9f);
  background: var(--accent-soft, #e6eef9);
}

.notes-panel-body{
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
}

.notes-actions{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--rule, #d8d2c0);
  background: var(--bg, #f7f4ec);
}

.notes-btn{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid var(--rule, #d8d2c0);
  border-radius: 6px;
  background: var(--bg-elev, #fffaf0);
  color: var(--ink, #1a1a1a);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.notes-btn:hover{ background: var(--accent-soft, #e6eef9); }
.notes-btn.is-primary{
  background: var(--accent, #2a5d9f);
  color: #fff;
  border-color: var(--accent, #2a5d9f);
}
.notes-btn.is-primary:hover{ filter: brightness(1.08); }

/* --------- Lista de bookmarks --------- */
.notes-empty{
  margin: 1em 0;
  color: var(--ink-mute, #7a7a7a);
  font-style: italic;
  font-size: 14px;
}

.notes-list{
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.notes-item{
  padding: 10px 12px;
  border: 1px solid var(--rule, #d8d2c0);
  border-radius: 8px;
  background: var(--bg, #f7f4ec);
}
.notes-item-header{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.notes-item-title{
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--serif, Georgia, serif);
  line-height: 1.3;
}
.notes-item-title a{
  color: var(--ink, #1a1a1a);
  text-decoration: none;
}
.notes-item-title a:hover{ color: var(--accent, #2a5d9f); text-decoration: underline; }
.notes-item-meta{
  font-size: 11px;
  color: var(--ink-mute, #7a7a7a);
  margin: 0 0 6px;
}
.notes-item-actions{
  display: flex;
  gap: 4px;
}
.notes-item-icon-btn{
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 2px 6px;
  font-size: 12px;
  color: var(--ink-mute, #7a7a7a);
  border-radius: 4px;
}
.notes-item-icon-btn:hover{ background: var(--rule, #d8d2c0); color: var(--ink, #1a1a1a); }

.notes-item textarea{
  width: 100%;
  min-height: 70px;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid var(--rule, #d8d2c0);
  border-radius: 6px;
  background: var(--bg-elev, #fffaf0);
  color: var(--ink, #1a1a1a);
  font-family: var(--mono, monospace);
  font-size: 13px;
  line-height: 1.4;
  resize: vertical;
  box-sizing: border-box;
}
.notes-item textarea:focus{
  outline: 2px solid var(--accent, #2a5d9f);
  outline-offset: -2px;
}

.notes-item-preview{
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--bg-elev, #fffaf0);
  border: 1px dashed var(--rule, #d8d2c0);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.45;
}
.notes-item-preview p{ margin: .35em 0; }
.notes-item-preview code{
  background: var(--code-bg, #efe9d6);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: var(--mono, monospace);
  font-size: .92em;
}
.notes-item-preview strong{ font-weight: 700; }
.notes-item-preview em{ font-style: italic; }
.notes-item-preview a{ color: var(--accent, #2a5d9f); }

.notes-toast{
  position: fixed;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink, #1a1a1a);
  color: var(--bg-elev, #fffaf0);
  padding: 8px 14px;
  border-radius: 6px;
  font-family: var(--sans, sans-serif);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 9500;
}
.notes-toast.is-open{
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --------- Adaptación a layout --------- */
@media (max-width: 900px){
  .notes-fab{
    bottom: 12px;
    right: 12px;
    padding: 9px 12px;
    font-size: 13px;
  }
}
