/* css/auth.css */

/* ══════════════════════════════════════
   AUTH BUTTON (Header)
   ══════════════════════════════════════ */
.auth-btn {
  background: transparent;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.2s ease;
  padding: 0;
  position: relative !important;
  top: auto !important;
  right: auto !important;
  left: auto !important;
  bottom: auto !important;
  overflow: hidden;
  flex-shrink: 0 !important;
  color: var(--text-main);
}

.auth-btn>img,
.auth-btn-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 0;
  filter: invert(1) brightness(2);
  transition: transform 0.2s ease, filter 0.2s ease;
  display: block;
}

.auth-btn.logged-in .auth-btn-icon {
  filter: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
}

.auth-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

.auth-btn:active {
  transform: translateY(0);
}

.auth-btn.logged-in {
  border: 2px solid var(--accent, #667eea);
}

/* ══════════════════════════════════════
   UTILITY: hidden
   ══════════════════════════════════════ */
.hidden {
  display: none !important;
}

/* ══════════════════════════════════════
   USER PANEL (Popover)
   ══════════════════════════════════════ */
.user-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  background: var(--bg-container, #ffffff);
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 0;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  filter: blur(10px);
  transform: translateY(-12px) scale(0.95);
  transition: opacity 0.65s cubic-bezier(0.2, 0.8, 0.25, 1),
              transform 0.65s cubic-bezier(0.2, 0.8, 0.25, 1),
              filter 0.65s cubic-bezier(0.2, 0.8, 0.25, 1),
              visibility 0.65s cubic-bezier(0.2, 0.8, 0.25, 1);
  pointer-events: none;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  overflow: hidden;
}

.user-panel.show {
  opacity: 1;
  visibility: visible;
  filter: blur(0px);
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ══════════════════════════════════════
   VISTA: PERFIL (usuario logueado)
   ══════════════════════════════════════ */
.user-panel-profile {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.user-avatar-large {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border: 2.5px solid var(--accent, #667eea);
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  width: 100%;
}

.user-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main, #2d3748);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.user-email {
  font-size: 0.78rem;
  color: var(--text-muted, #718096);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  text-align: center;
}

/* Botón logout */
.btn-logout {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--bg-filters, rgba(0, 0, 0, 0.02));
  color: var(--text-main, #4a5568);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  font-family: inherit;
  margin-top: 4px;
}

.btn-logout:hover {
  background: rgba(220, 53, 69, 0.06);
  color: #dc3545;
  border-color: rgba(220, 53, 69, 0.2);
}

.btn-logout svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════
   VISTA: INVITADO (formulario login)
   ══════════════════════════════════════ */
#authGuestView {
  padding: 20px;
}

.auth-panel-title {
  margin: 0 0 16px 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main, #2d3748);
  text-align: center;
}

/* Campos de input */
.auth-field {
  margin-bottom: 10px;
}

.auth-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border, #e2e8f0);
  border-radius: 10px;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--text-main, #2d3748);
  background: var(--bg-container, #fff);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
  box-sizing: border-box;
}

.auth-input:focus {
  border-color: var(--accent, #667eea);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.auth-input::placeholder {
  color: var(--text-muted, #a0aec0);
  font-size: 0.84rem;
}

/* Error message */
.auth-error {
  color: #e53e3e;
  font-size: 0.8rem;
  margin: 6px 0 10px;
  padding: 8px 10px;
  background: rgba(229, 62, 62, 0.06);
  border-radius: 8px;
  border-left: 3px solid #e53e3e;
}

/* Submit button */
.btn-email-submit {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  background: var(--accent, #667eea);
  color: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-email-submit:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-email-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Links row */
.auth-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.auth-link {
  font-size: 0.78rem;
  color: var(--accent, #667eea);
  text-decoration: none;
  transition: opacity 0.2s;
}

.auth-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.auth-link-sep {
  color: var(--text-muted, #cbd5e0);
  font-size: 0.78rem;
}

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border, #e2e8f0);
}

.auth-divider span {
  font-size: 0.75rem;
  color: var(--text-muted, #a0aec0);
  white-space: nowrap;
}

/* Google button */
.btn-google {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border, #e2e8f0);
  background: var(--bg-container, #fff);
  color: var(--text-main, #4a5568);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-google:hover:not(:disabled) {
  background: var(--bg-filters, rgba(0, 0, 0, 0.02));
  border-color: var(--text-muted, #a0aec0);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.btn-google:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-google svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════
   FORGOT PASSWORD SECTION
   ══════════════════════════════════════ */
#authForgotSection {
  /* Inherits padding from #authGuestView */
}

.auth-forgot-hint {
  font-size: 0.82rem;
  color: var(--text-muted, #718096);
  margin: 0 0 12px;
  line-height: 1.45;
  text-align: center;
}

.auth-forgot-msg {
  font-size: 0.8rem;
  margin: 8px 0;
  padding: 8px 10px;
  border-radius: 8px;
}

.auth-forgot-msg.auth-error {
  color: #e53e3e;
  background: rgba(229, 62, 62, 0.06);
  border-left: 3px solid #e53e3e;
}

.auth-forgot-msg.auth-success {
  color: #38a169;
  background: rgba(56, 161, 105, 0.06);
  border-left: 3px solid #38a169;
}

/* ══════════════════════════════════════
   DARK THEME
   ══════════════════════════════════════ */
[data-theme="dark"] .user-panel {
  background: var(--bg-container, #1a202c);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  border-color: var(--border, #2d3748);
}

[data-theme="dark"] .auth-input {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border, #4a5568);
  color: var(--text-main, #e2e8f0);
}

[data-theme="dark"] .auth-input:focus {
  border-color: var(--accent, #667eea);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

[data-theme="dark"] .btn-google {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border, #4a5568);
  color: var(--text-main, #e2e8f0);
}

[data-theme="dark"] .btn-google:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .auth-btn>img,
[data-theme="dark"] .auth-btn-icon {
  filter: invert(1) brightness(2);
}

[data-theme="dark"] .auth-btn.logged-in .auth-btn-icon {
  filter: none;
}

[data-theme="dark"] .btn-logout:hover {
  background: rgba(255, 100, 100, 0.1);
  color: #ff7070;
  border-color: rgba(255, 100, 100, 0.2);
}

/* ══════════════════════════════════════
   SKIN ADAPTATION — user panel
   ══════════════════════════════════════ */
.user-panel {
  background: var(--bg-container) !important;
  color: var(--text-main) !important;
  border-color: var(--border) !important;
}

.user-panel .auth-input {
  background: var(--bg-filters) !important;
  color: var(--text-main) !important;
  border-color: var(--border) !important;
}

.user-panel .auth-input::placeholder {
  color: var(--text-muted) !important;
}

.user-panel .auth-input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent) !important;
}

.user-panel .auth-panel-title {
  color: var(--text-main) !important;
}

.user-panel .auth-link {
  color: var(--accent) !important;
}

.user-panel .auth-link-sep {
  color: var(--text-muted) !important;
}

.user-panel .auth-divider span {
  color: var(--text-muted) !important;
}

.user-panel .auth-divider::before,
.user-panel .auth-divider::after {
  background: var(--border) !important;
}

.user-panel .btn-email-submit {
  background: var(--accent) !important;
  color: #fff !important;
}

.user-panel .btn-google {
  background: var(--bg-container) !important;
  border-color: var(--border) !important;
  color: var(--text-main) !important;
}

.user-panel .btn-google:hover:not(:disabled) {
  background: var(--bg-filters) !important;
}

.user-panel .btn-logout {
  background: var(--bg-filters) !important;
  border-color: var(--border) !important;
  color: var(--text-main) !important;
}

.user-panel .btn-logout:hover {
  background: color-mix(in srgb, #dc3545 8%, var(--bg-filters)) !important;
  color: #dc3545 !important;
  border-color: color-mix(in srgb, #dc3545 25%, var(--border)) !important;
}

.user-panel .user-name {
  color: var(--text-main) !important;
}

.user-panel .user-email {
  color: var(--text-muted) !important;
}

.user-panel .auth-error {
  color: #e53e3e !important;
  background: color-mix(in srgb, #e53e3e 8%, var(--bg-container)) !important;
}

.user-panel .auth-forgot-hint {
  color: var(--text-muted) !important;
}

.user-panel .user-avatar-large {
  border-color: var(--accent) !important;
}

[data-skin="fire"] .user-panel,
[data-skin="sunset"] .user-panel,
[data-skin="forest"] .user-panel {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25) !important;
}

[data-theme="dark"] .user-panel .btn-google {
  background: color-mix(in srgb, white 5%, var(--bg-container)) !important;
}

[data-theme="dark"] .user-panel .btn-google:hover:not(:disabled) {
  background: color-mix(in srgb, white 10%, var(--bg-container)) !important;
}

[data-theme="dark"] .user-panel .btn-logout:hover {
  background: color-mix(in srgb, #ff6464 10%, var(--bg-container)) !important;
  color: #ff7070 !important;
}

/* ══════════════════════════════════════
   NUEVO SISTEMA DE MENÚ MODULAR
   ══════════════════════════════════════ */

.user-panel-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 10px 0;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.btn-panel-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  text-align: left;
}

.btn-panel-link:hover {
  background: var(--bg-filters);
  transform: translateX(4px);
  color: var(--accent);
}

.panel-link-icon {
  font-size: 1.1rem;
}

/* SUBVIEW SYSTEM (Slide-in) */

.user-panel-subview {
  padding: 15px;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  /* Auto-ajuste */
  min-width: 280px;
}

.subview-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.subview-header h4 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-back-icon {
  background: var(--bg-filters);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  transition: all 0.2s;
}

.btn-back-icon:hover {
  background: var(--accent);
  color: #fff;
}

.subview-content {
  overflow-y: auto;
  max-height: 400px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

/* Reúsamos los items de la lista anterior evolucionados */

.user-highlight-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--bg-filters);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  flex-shrink: 0;
}

.user-highlight-item:hover {
  background: var(--card-hover);
  border-color: var(--accent);
  transform: scale(1.02);
}

.user-highlight-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px var(--bg-container), 0 0 0 4px var(--border);
}

.user-highlight-color-dot.yellow {
  background-color: #ffeb3b;
}

.user-highlight-color-dot.blue {
  background-color: #03a9f4;
}

.user-highlight-color-dot.pink {
  background-color: #e91e63;
}

.user-highlight-color-dot.orange {
  background-color: #ff9800;
}

.user-highlight-color-dot.green {
  background-color: #4caf50;
}

.user-highlight-color-dot.red {
  background-color: #f44336;
}

.user-highlight-info {
  display: flex;
  flex-direction: column;
  line-height: 1.4;
}

.user-highlight-ref {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.user-highlight-tag {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  font-style: italic;
  opacity: 0.9;
}

.no-highlights-msg {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  padding: 30px 10px;
  font-style: italic;
}

/* 🏷️ TAGS INDEX STYLES */

.tag-search-box {
  margin-bottom: 15px;
  padding: 0 4px;
}

.tag-list-index {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tag-index-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-filters);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.tag-index-item:hover {
  background: var(--card-hover);
  border-color: var(--accent);
  transform: translateX(4px);
}

.tag-index-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
}

.tag-index-count {
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.subview-header-mini {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 15px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.btn-back-tiny {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-back-tiny:hover {
  text-decoration: underline;
}

.tag-view-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.tag-results-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── SEGUIMIENTO DE LECTURA ────────────────────────────────────────── */

.menu-progress-badge {
  background: var(--color-gold-dark, #8c6d3d);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  margin-left: auto;
  font-weight: bold;
}

.progress-books-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 10px 0;
}

.progress-book-item {
  background: var(--bg-container);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.progress-book-item:hover {
  background: var(--card-hover);
  transform: translateY(-2px);
}

.progress-book-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.progress-book-name {
  font-weight: 600;
  color: var(--text-main);
}

.progress-book-count {
  font-size: 0.8rem;
  color: var(--accent);
}

.progress-book-bar-bg {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-book-bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.5s ease-out;
}

/* Grilla de Capítulos */
.reading-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
  gap: 8px;
  padding: 15px 5px;
}

.reading-cell {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-container);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.reading-cell:active {
  transform: scale(0.95);
}

.reading-cell.completed {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.reading-cell:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.user-highlight-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}

.user-highlight-item:hover {
  background: var(--card-hover);
}

.btn-delete-highlight {
  position: absolute;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s;
  font-size: 16px;
  line-height: 1;
}

.user-highlight-item:hover .btn-delete-highlight {
  opacity: 1;
}

.btn-delete-highlight:hover {
  background: #ef4444;
  color: white;
  transform: scale(1.1);
}

.loading-msg {
  text-align: center;
  padding: 40px;
  color: var(--color-text-sec);
  font-style: italic;
}

/* ══════════════════════════════════════
   EDITOR DE COMENTARIOS (Modal versículo)
   ══════════════════════════════════════ */
.hl-comment-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 8px;
  font-size: 0.9em;
  font-family: inherit;
  resize: vertical;
  background: var(--bg-input, #fff);
  color: var(--text-main);
  line-height: 1.5;
}

.hl-comment-textarea:focus {
  outline: none;
  border-color: var(--color-accent, #b8860b);
}

.comment-editor-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.btn-comment-delete {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid #ef4444;
  background: transparent;
  color: #ef4444;
  font-size: 0.85em;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-comment-delete:hover {
  background: #ef4444;
  color: white;
}

/* ══════════════════════════════════════
   PANEL USUARIO: LISTA DE COMENTARIOS
   ══════════════════════════════════════ */
.user-comment-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border-color, #eee);
  position: relative;
}

.user-comment-item:hover {
  background: var(--bg-hover, rgba(0, 0, 0, 0.04));
}

.user-comment-ref {
  font-size: 0.8em;
  font-weight: 600;
  color: var(--color-accent, #b8860b);
  letter-spacing: 0.02em;
}

.user-comment-preview {
  font-size: 0.85em;
  color: var(--text-main);
  line-height: 1.45;
  padding-right: 24px;
}

.user-comment-item .btn-delete-highlight {
  position: absolute;
  top: 10px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s;
  font-size: 16px;
  line-height: 1;
}

.user-comment-item:hover .btn-delete-highlight {
  opacity: 1;
}

/* Preview de comentario en la lista de subrayados */
.user-highlight-comment-preview {
  font-size: 0.78em;
  color: var(--color-text-sec);
  font-style: italic;
  margin-top: 2px;
  line-height: 1.35;
}