@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@300;400;500&display=swap');

/* ===== VARIABLES ===== */
:root {
  --bg:        #0f0f0f;
  --bg2:       #181818;
  --bg3:       #212121;
  --bg4:       #2a2a2a;
  --gold:      #c9a84c;
  --gold2:     #e8c86a;
  --gold3:     #f5dfa0;
  --goldfaint: rgba(201,168,76,0.10);
  --goldborder:rgba(201,168,76,0.22);
  --text:      #f0ece2;
  --text2:     #a09880;
  --text3:     #6b6356;
  --danger:    #c0392b;
  --dangerL:   rgba(192,57,43,0.15);
  --success:   #27ae60;
  --r:         12px;
  --rS:        8px;
  --font:      'DM Sans', sans-serif;
  --fontD:     'DM Serif Display', serif;
  --ease:      cubic-bezier(.4,0,.2,1);
}
.light {
  --bg:        #faf7f0;
  --bg2:       #f0ebe0;
  --bg3:       #e8e1d4;
  --bg4:       #ddd5c6;
  --text:      #1a1612;
  --text2:     #5a5245;
  --text3:     #9a8e7e;
  --goldborder:rgba(120,90,30,0.22);
  --goldfaint: rgba(150,110,30,0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  min-height: 100vh;
  transition: background .3s var(--ease), color .3s var(--ease);
}

/* ===== LAYOUT ===== */
.app {
  max-width: 620px;
  margin: 0 auto;
  padding: 2rem 1.25rem 5rem;
}

/* ===== HEADER ===== */
.app-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1.75rem;
  border-bottom: 0.5px solid var(--goldborder);
  position: relative;
}

.theme-btn {
  position: absolute;
  top: 0; right: 0;
  background: none;
  border: 0.5px solid var(--goldborder);
  border-radius: var(--rS);
  width: 36px; height: 36px;
  cursor: pointer;
  color: var(--text3);
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s var(--ease);
}
.theme-btn:hover { color: var(--gold); border-color: var(--gold); background: var(--goldfaint); }

.app-title {
  font-family: var(--fontD);
  font-size: 2.6rem;
  color: var(--gold2);
  letter-spacing: -0.5px;
  line-height: 1.1;
  margin-bottom: 6px;
}

.app-subtitle {
  font-size: 13px;
  color: var(--text3);
  font-weight: 300;
  letter-spacing: 0.2px;
}

/* ===== CARD FORMULARIO ===== */
.card {
  background: var(--bg2);
  border: 0.5px solid var(--goldborder);
  border-radius: var(--r);
  padding: 1.5rem;
  margin-bottom: 1rem;
  transition: border-color .2s var(--ease);
}
.card:focus-within { border-color: rgba(201,168,76,0.45); }

.field-block {
  margin-bottom: 10px;
}

.field-input {
  width: 100%;
  background: var(--bg3);
  border: 0.5px solid var(--goldborder);
  border-radius: var(--rS);
  padding: 10px 14px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: all .2s var(--ease);
  resize: none;
}
.field-input:focus {
  border-color: var(--gold);
  background: var(--bg4);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.08);
}
.field-input::placeholder { color: var(--text3); }

.field-textarea {
  height: 120px;
  resize: vertical;
  line-height: 1.7;
}

/* ===== CORRECTOR ===== */
.spell-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text3);
  min-height: 24px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  row-gap: 5px;
}
.spell-bar i { font-size: 13px; }

.error-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(192,57,43,0.12);
  border: 0.5px solid rgba(192,57,43,0.35);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s var(--ease);
  font-family: var(--font);
}
.error-pill:hover {
  background: rgba(192,57,43,0.22);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(192,57,43,0.2);
}
.err-wrong {
  color: #e74c3c;
  text-decoration: underline wavy #e74c3c;
  text-underline-offset: 2px;
}
.err-right {
  color: var(--success);
  font-weight: 500;
}

/* ===== ACCIONES ===== */
.actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.shortcut-hint {
  font-size: 11px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 4px;
}
.shortcut-hint i { font-size: 12px; }

.actions-btns {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  padding: 8px 16px;
  border-radius: var(--rS);
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all .18s var(--ease);
  white-space: nowrap;
}
.btn-gold {
  background: var(--gold);
  color: #1a1410;
}
.btn-gold:hover { background: var(--gold2); transform: translateY(-1px); }
.btn-gold:active { transform: translateY(0); }

.btn-ghost {
  background: none;
  border: 0.5px solid var(--goldborder);
  color: var(--text2);
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); background: var(--goldfaint); }

/* ===== BUSCADOR ===== */
.search-wrap {
  position: relative;
  margin-bottom: 1rem;
}
.search-wrap > i {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 15px;
  pointer-events: none;
}
#search {
  width: 100%;
  background: var(--bg2);
  border: 0.5px solid var(--goldborder);
  border-radius: var(--rS);
  padding: 10px 14px 10px 40px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: all .2s var(--ease);
}
#search:focus { border-color: var(--gold); background: var(--bg3); }
#search::placeholder { color: var(--text3); }

/* ===== TOOLBAR ===== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  gap: 6px;
}

.toolbar-sep {
  width: 1px;
  height: 20px;
  background: var(--goldborder);
  margin: 0 4px;
}

.toolbar-actions {
  display: flex;
  gap: 6px;
}

.filter-btn {
  background: none;
  border: 0.5px solid var(--goldborder);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12px;
  color: var(--text2);
  cursor: pointer;
  transition: all .18s var(--ease);
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.filter-btn:hover { border-color: var(--gold); color: var(--text); }
.filter-btn.on { background: var(--goldfaint); border-color: var(--gold); color: var(--gold); }

.tool-btn {
  background: none;
  border: 0.5px solid var(--goldborder);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12px;
  color: var(--text2);
  cursor: pointer;
  transition: all .18s var(--ease);
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tool-btn:hover { border-color: var(--gold2); color: var(--gold2); background: var(--goldfaint); }

/* ===== TÍTULO SECCIÓN ===== */
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1rem;
  justify-content: center;
}
.section-line {
  flex: 1;
  max-width: 80px;
  height: 0.5px;
  background: var(--goldborder);
}
.section-text {
  font-family: var(--fontD);
  font-size: 1rem;
  color: var(--gold);
  opacity: 0.75;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
#cnt {
  font-size: 11px;
  color: var(--text3);
  font-family: var(--font);
}

/* ===== NOTAS ===== */
.notes-list { display: flex; flex-direction: column; gap: 8px; }

.note-card {
  background: var(--bg2);
  border: 0.5px solid var(--goldborder);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color .18s var(--ease), transform .18s var(--ease);
}
.note-card:hover { border-color: rgba(201,168,76,0.4); }
.note-card.fav { border-left: 2.5px solid var(--gold); }

.note-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  cursor: pointer;
  user-select: none;
}

.note-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--goldfaint);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.note-meta { flex: 1; min-width: 0; }
.note-title-text {
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-time {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.note-btns { display: flex; gap: 2px; flex-shrink: 0; }
.nb {
  background: none; border: none; cursor: pointer;
  color: var(--text3); padding: 6px; border-radius: 6px;
  font-size: 15px; transition: all .15s var(--ease);
  display: flex; align-items: center;
}
.nb:hover { color: var(--gold); background: var(--goldfaint); }
.nb.fav-on { color: var(--gold); }
.nb.del:hover { color: var(--danger); background: var(--dangerL); }

.chevron { font-size: 14px; color: var(--text3); transition: transform .2s var(--ease); }
.chevron.open { transform: rotate(180deg); }

.note-body {
  padding: 0 14px 14px;
  border-top: 0.5px solid var(--goldborder);
}
.note-content-text {
  padding-top: 12px;
  font-size: 14px;
  color: var(--text2);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
}

.note-edit-area { padding-top: 12px; }
.note-edit-area .field-input { width: 100%; margin-bottom: 8px; }
.note-edit-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ===== VACÍO ===== */
.empty {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--text3);
}
.empty-icon { font-size: 40px; margin-bottom: 10px; }
.empty p { font-size: 14px; line-height: 1.8; }
.empty small { font-size: 12px; color: var(--gold); opacity: 0.6; }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--bg3);
  border: 0.5px solid rgba(201,168,76,0.35);
  border-radius: var(--rS);
  padding: 10px 20px;
  font-size: 13px; color: var(--text);
  opacity: 0;
  transition: opacity .28s var(--ease), transform .28s var(--ease);
  pointer-events: none; z-index: 999;
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.4);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== FOOTER ===== */
.footer-link {
  display: block;
  text-align: center;
  color: var(--text3);
  text-decoration: none;
  font-size: 12px;
  margin-top: 3rem;
  letter-spacing: 0.3px;
  transition: color .2s;
}
.footer-link:hover { color: var(--gold); }

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .app { padding: 1.25rem 0.9rem 4rem; }
  .app-title { font-size: 2rem; }
  .actions-row { flex-direction: column; align-items: stretch; }
  .actions-btns { justify-content: flex-end; }
  .toolbar { justify-content: flex-start; }
  .toolbar-actions { margin-left: 0; }
  .theme-btn { top: 0; right: 0; }
}
