/* RedAI-Web – base extras (tooltips, sidebar overrides, etc.) */

    /* Estilos personalizados para tooltips - Posición abajo a la derecha */
    [title] {
      position: relative;
    }

    [title]:hover::after {
      content: attr(title);
      position: absolute;
      bottom: -40px;
      right: 0;
      background: rgba(0, 0, 0, 0.9);
      color: white;
      padding: 8px 12px;
      border-radius: 6px;
      font-size: 12px;
      white-space: nowrap;
      z-index: 10000;
      pointer-events: none;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
      border: 1px solid rgba(255, 255, 255, 0.1);
      backdrop-filter: blur(8px);
      animation: tooltipFadeIn 0.2s ease-out;
    }

    [title]:hover::before {
      content: '';
      position: absolute;
      bottom: -8px;
      right: 10px;
      width: 0;
      height: 0;
      border-left: 6px solid transparent;
      border-right: 6px solid transparent;
      border-bottom: 6px solid rgba(0, 0, 0, 0.9);
      z-index: 10000;
      pointer-events: none;
      animation: tooltipFadeIn 0.2s ease-out;
    }

    /* Tooltip arriba (footer RedAI-Seal para que no se salga de pantalla) */
    .tooltip-above[title]:hover::after {
      bottom: 100%;
      top: auto;
      right: 0;
      margin-bottom: 8px;
      transform: none;
    }
    .tooltip-above[title]:hover::before {
      bottom: 100%;
      top: auto;
      margin-bottom: 2px;
      border-bottom: 6px solid rgba(0, 0, 0, 0.9);
      border-top: none;
    }

    @keyframes tooltipFadeIn {
      from {
        opacity: 0;
        transform: translateY(5px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    /* Ajustes específicos para botones pequeños */
    .quick-btn[title]:hover::after,
    .action-btn[title]:hover::after,
    .btn[title]:hover::after {
      bottom: -35px;
      right: -5px;
      font-size: 11px;
      padding: 6px 10px;
    }

    .quick-btn[title]:hover::before,
    .action-btn[title]:hover::before,
    .btn[title]:hover::before {
      bottom: -6px;
      right: 5px;
    }

    /* Ajustes para elementos en tarjetas */
    .character-card [title]:hover::after,
    .user-card [title]:hover::after {
      bottom: -40px;
      right: 0;
      max-width: 200px;
      white-space: normal;
      word-wrap: break-word;
    }

    /* Ajustes para badges y chips */
    .badge[title]:hover::after,
    .chip[title]:hover::after {
      bottom: -35px;
      right: -5px;
      font-size: 11px;
      padding: 6px 10px;
    }

    .badge[title]:hover::before,
    .chip[title]:hover::before {
      bottom: -6px;
      right: 5px;
    }

    /* Ajustes para elementos en modal */
    .modal [title]:hover::after {
      bottom: -40px;
      right: 0;
      z-index: 10001;
    }

    /* Ajustes para elementos en header */
    .header [title]:hover::after {
      bottom: -40px;
      right: 0;
      z-index: 10002;
    }

    /* Ajustes para elementos en navegación */
    .nav [title]:hover::after {
      bottom: -40px;
      right: 0;
      z-index: 10002;
    }

    /* Ajustes para contadores */
    .counter-chip[title]:hover::after {
      bottom: -35px;
      right: 0;
      font-size: 11px;
      padding: 6px 10px;
    }

    .counter-chip[title]:hover::before {
      bottom: -6px;
      right: 10px;
    }

    /* Hit area de botones: toda la zona del botón responde al ratón (ningún hijo ni pseudo-elemento captura el evento) */
    button,
    .btn,
    [role="button"] {
      cursor: pointer;
      position: relative;
    }
    /* Todos los descendientes a cualquier nivel: no capturan el ratón, así el botón recibe hover/click en toda su superficie */
    button *:not(.hit),
    .btn *:not(.hit),
    [role="button"] *:not(.hit) {
      pointer-events: none !important;
    }
    /* Pseudo-elementos decorativos no deben crear zonas muertas */
    button::before,
    button::after,
    .btn::before,
    .btn::after,
    [role="button"]::before,
    [role="button"]::after {
      pointer-events: none !important;
    }
    /* Mantener .hit clickable donde se use (ej. action-tile del menú de acciones) */
    .hit {
      pointer-events: auto !important;
    }

    /* Ocultar tooltips nativos del navegador */
    [title] {
      position: relative;
    }

    [title]:hover {
      position: relative;
    }

    /* Asegurar que los tooltips no interfieran con otros elementos */
    [title]:hover::after,
    [title]:hover::before {
      pointer-events: none;
      user-select: none;
    }

    /* Ajustes para elementos específicos que necesitan más espacio */
    .header-actions [title]:hover::after {
      bottom: -45px;
      right: 0;
    }

    .header-actions [title]:hover::before {
      bottom: -8px;
      right: 10px;
    }

    /* Ajustes para elementos en páginas de personajes */
    .switch[title]:hover::after,
    .checkbox-label[title]:hover::after {
      bottom: -40px;
      right: 0;
      max-width: 250px;
      white-space: normal;
      word-wrap: break-word;
    }

    .segmented-control[title]:hover::after {
      bottom: -45px;
      right: 0;
    }

    /* Estilos para la barra lateral desplegable */
    .sidebar-toggle {
      position: fixed !important;
      top: 80px !important;
      left: 20px !important;
      z-index: 9999 !important;
      background: rgba(15, 18, 28, 0.95) !important;
      border: 2px solid rgba(124, 58, 237, 0.5) !important;
      color: #e6e9f2 !important;
      padding: 14px !important;
      border-radius: 12px !important;
      cursor: pointer !important;
      transition: all 0.3s ease !important;
      backdrop-filter: blur(15px) !important;
      box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4) !important;
      display: flex !important;
      align-items: center !important;
      justify-content: center !important;
      min-width: 48px !important;
      min-height: 48px !important;
      font-size: 18px !important;
    }

    .sidebar-toggle:hover {
      background: rgba(124, 58, 237, 0.2) !important;
      border-color: rgba(124, 58, 237, 0.8) !important;
      transform: translateY(-3px) scale(1.05) !important;
      box-shadow: 0 8px 30px rgba(124, 58, 237, 0.3) !important;
      color: #ffffff !important;
    }

    /* Tooltip del botón sidebar: a la derecha para no salirse por la izquierda */
    .sidebar-toggle[title]:hover::after {
      bottom: auto;
      right: auto;
      left: 100%;
      top: 50%;
      margin-left: 10px;
      margin-bottom: 0;
      transform: translateY(-50%);
    }
    .sidebar-toggle[title]:hover::before {
      bottom: auto;
      right: auto;
      left: 100%;
      top: 50%;
      margin-left: 4px;
      margin-bottom: 0;
      transform: translateY(-50%);
      border-left: 6px solid rgba(0, 0, 0, 0.9);
      border-right: none;
      border-bottom: 6px solid transparent;
      border-top: 6px solid transparent;
    }

    .sidebar-toggle i {
      font-size: 20px !important;
      color: inherit !important;
      font-weight: 600 !important;
    }

    .sidebar {
      position: fixed;
      top: 0;
      left: -320px; /* Oculto por defecto */
              width: 320px;
        height: 100vh;
        background: var(--neo-surface);
        border-right: 1px solid rgba(124, 58, 237, 0.2);
        z-index: 100000;
      transition: all 0.3s ease;
      backdrop-filter: blur(20px);
      box-shadow: 4px 0 30px rgba(0, 0, 0, 0.5);
      overflow-y: auto;
      visibility: hidden;
      opacity: 0;
      transform: translateX(-100%);
    }

    .sidebar.open {
      left: 0;
      visibility: visible;
      opacity: 1;
      transform: translateX(0);
    }

    /* Tooltips dentro del sidebar: a la derecha del elemento para no salirse por la izquierda */
    .sidebar [title]:hover::after {
      bottom: auto;
      right: auto;
      left: 100%;
      top: 50%;
      margin-left: 10px;
      margin-bottom: 0;
      transform: translateY(-50%);
    }
    .sidebar [title]:hover::before {
      bottom: auto;
      right: auto;
      left: 100%;
      top: 50%;
      margin-left: 4px;
      margin-bottom: 0;
      transform: translateY(-50%);
      border-left: 6px solid rgba(0, 0, 0, 0.9);
      border-right: none;
      border-bottom: 6px solid transparent;
      border-top: 6px solid transparent;
    }

    /* Ocultar el botón cuando la barra lateral está abierta */
    .sidebar.open ~ .sidebar-toggle,
    .sidebar.open + .sidebar-toggle {
      opacity: 0 !important;
      visibility: hidden !important;
      pointer-events: none !important;
    }

    .sidebar-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 20px;
      border-bottom: 1px solid rgba(124, 58, 237, 0.1);
      background: rgba(124, 58, 237, 0.05);
    }

    .sidebar-logo {
      display: flex;
              align-items: center;
        gap: 12px;
        color: var(--neo-text);
        font-weight: 600;
        font-size: 18px;
    }

    .sidebar-logo i {
      color: #7c3aed;
      font-size: 24px;
    }

    .sidebar-close {
              background: transparent;
        border: none;
        color: var(--neo-muted);
        padding: 8px;
        border-radius: 8px;
      cursor: pointer;
      transition: all 0.2s ease;
    }

          .sidebar-close:hover {
        background: rgba(124, 58, 237, 0.1);
        color: var(--neo-text);
      }

      /* Modo claro: mismo esquema que oscuro (variables del tema) */
      html[data-mode="light"] .sidebar {
        background: var(--neo-surface);
        border-right-color: color-mix(in srgb, var(--neo-primary) 12%, transparent);
        box-shadow: 4px 0 30px color-mix(in srgb, var(--neo-primary) 8%, transparent);
      }

      html[data-mode="light"] .sidebar-header {
        background: color-mix(in srgb, var(--neo-primary) 6%, var(--neo-surface));
        border-bottom-color: color-mix(in srgb, var(--neo-primary) 12%, transparent);
      }

      /* Sidebar botones en light: definidos en sidebar.css para evitar bugs al cambiar tema */

      html[data-mode="light"] .sidebar-section-title {
        color: var(--neo-text);
        border-bottom-color: color-mix(in srgb, var(--neo-primary) 12%, transparent);
      }

      html[data-mode="light"] .sidebar-logo {
        color: var(--neo-text);
      }

      html[data-mode="light"] .sidebar-close {
        color: var(--neo-muted);
      }

      html[data-mode="light"] .sidebar-close:hover {
        background: color-mix(in srgb, var(--neo-primary) 10%, var(--neo-surface));
        color: var(--neo-text);
      }

      html[data-mode="light"] .changelog-btn {
        background: linear-gradient(135deg, var(--neo-primary), var(--neo-accent));
        border-color: color-mix(in srgb, var(--neo-primary) 25%, transparent);
        color: white;
      }

      html[data-mode="light"] .changelog-btn-new {
        background: var(--neo-surface-2);
        border-color: color-mix(in srgb, var(--neo-primary) 12%, transparent);
        color: var(--neo-text);
      }

      html[data-mode="light"] .changelog-btn-new:hover {
        transform: translateX(2px) translateY(-1px);
        background: linear-gradient(135deg, var(--neo-primary), var(--neo-accent));
        border-color: color-mix(in srgb, var(--neo-primary) 40%, transparent);
        color: white;
        box-shadow: 0 6px 20px color-mix(in srgb, var(--neo-primary) 35%, transparent);
      }

      html[data-mode="light"] .changelog-btn-new:hover .changelog-icon {
        color: white;
      }

      html[data-mode="light"] .changelog-btn-new:hover .changelog-icon i {
        transform: rotate(10deg);
      }

      html[data-mode="light"] .changelog-btn-new:active {
        transform: translateX(2px) translateY(-1px) scale(1.05);
        animation: changelogClickNew 0.3s ease-out;
      }



    .sidebar-content {
      padding: 20px;
    }

    .sidebar-section {
      margin-bottom: 30px;
    }

    .sidebar-section-title {
      display: flex;
      align-items: center;
      gap: 10px;
      margin: 0 0 15px 0;
              font-size: 16px;
        font-weight: 600;
        color: var(--neo-text);
        padding-bottom: 8px;
        border-bottom: 1px solid rgba(124, 58, 237, 0.1);
    }

    .sidebar-section-title i {
      color: #7c3aed;
      font-size: 16px;
    }

    .sidebar-buttons {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    /* Estilos base/hover/icon de .sidebar-btn: solo en sidebar.css para no bugear al cambiar tema */

    .sidebar-btn span {
      flex: 1;
      font-weight: 500;
    }

    /* Botones Premium Deshabilitados - Animaciones Avanzadas */
    .sidebar-btn.premium-disabled {
      position: relative;
      overflow: hidden;
      cursor: pointer;
      background: linear-gradient(135deg, rgba(15, 18, 28, 0.8) 0%, rgba(30, 41, 59, 0.6) 100%);
      border: 1px solid rgba(127, 127, 127, 0.3);
      color: rgba(148, 163, 184, 0.7);
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      filter: grayscale(0.8);
    }

    .sidebar-btn.premium-disabled:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
      border-color: rgba(234, 179, 8, 0.4);
      filter: grayscale(0.6);
    }

    .sidebar-btn.premium-disabled:active {
      transform: translateY(0);
      animation: shakeLock 0.6s ease-in-out;
    }

    /* Contenido del botón */
    .btn-content {
      position: relative;
      z-index: 2;
      display: flex;
      align-items: center;
      gap: 12px;
      width: 100%;
    }

    /* Contenedor de iconos */
    .icon-container {
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      width: 24px;
      height: 24px;
    }

    .icon-container i {
      font-size: 16px;
      opacity: 0.85;
      color: #8b5cf6 !important;
      transition: all 0.3s ease;
    }

    /* Icono de candado: siempre visible */
    .lock-icon {
      position: absolute;
      top: -2px;
      right: -2px;
      font-size: 12px;
      opacity: 0.9;
      filter: drop-shadow(0 0 2px rgba(0,0,0,0.3));
      animation: lockPulse 2s ease-in-out infinite, lockSwing 3s ease-in-out infinite;
      transition: all 0.3s ease;
    }

    /* Efecto de brillo: tinte violeta para verse en claro y oscuro */
    .shine-effect {
      position: absolute;
      top: 0;
      left: -100%;
      width: 100%;
      height: 100%;
      background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.22), rgba(167, 139, 250, 0.18), transparent);
      animation: shineSweep 4s ease-in-out infinite;
      z-index: 1;
    }

    /* Contenedor de partículas */
    .particles-container {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      pointer-events: none;
      z-index: 1;
    }

    /* Texto del botón */
    .btn-text {
      flex: 1;
      font-weight: 500;
      font-size: 14px;
    }

    /* Animaciones */
    @keyframes lockPulse {
      0%, 100% { opacity: 0.8; transform: scale(1); }
      50% { opacity: 0.4; transform: scale(1.1); }
    }

    @keyframes lockSwing {
      0%, 100% { transform: rotate(-2deg); }
      50% { transform: rotate(2deg); }
    }

    @keyframes shineSweep {
      0% { left: -100%; }
      50% { left: 100%; }
      100% { left: 100%; }
    }

    @keyframes shakeLock {
      0%, 100% { transform: translateX(0); }
      10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
      20%, 40%, 60%, 80% { transform: translateX(2px); }
    }

    @keyframes lockOpen {
      0% { transform: rotate(0deg); }
      50% { transform: rotate(-15deg); }
      100% { transform: rotate(0deg); }
    }

    @keyframes goldenGlow {
      0% { filter: brightness(1); }
      50% { filter: brightness(1.3) saturate(1.2); }
      100% { filter: brightness(1); }
    }

    /* Efectos hover */
    .sidebar-btn.premium-disabled:hover .lock-icon {
      animation: lockOpen 0.5s ease-in-out, goldenGlow 1s ease-in-out;
      color: #fbbf24;
      text-shadow: 0 0 10px rgba(251, 191, 36, 0.6);
    }

    .sidebar-btn.premium-disabled:hover .icon-container i {
      opacity: 0.8;
      transform: scale(1.1);
    }

    .sidebar-btn.premium-disabled .btn-text {
      color: #cbd5e1;
    }
    .sidebar-btn.premium-disabled:hover .btn-text {
      color: #e2e8f0;
    }

    /* Efecto de partículas: visibles en ambos modos */
    .sidebar-btn.premium-disabled::before {
      content: '✨';
      position: absolute;
      top: 10px;
      right: 10px;
      font-size: 10px;
      opacity: 0;
      filter: drop-shadow(0 0 2px rgba(0,0,0,0.2));
      animation: particleFloat 6s ease-in-out infinite;
      z-index: 1;
    }

    .sidebar-btn.premium-disabled::after {
      content: '🌀';
      position: absolute;
      bottom: 10px;
      left: 10px;
      font-size: 8px;
      opacity: 0;
      filter: drop-shadow(0 0 2px rgba(0,0,0,0.2));
      animation: particleFloat 8s ease-in-out infinite 2s;
      z-index: 1;
    }

    @keyframes particleFloat {
      0%, 100% { opacity: 0; transform: translateY(0) rotate(0deg); }
      20% { opacity: 0.7; transform: translateY(-5px) rotate(180deg); }
      80% { opacity: 0.7; transform: translateY(-10px) rotate(360deg); }
    }

    @keyframes toastSlideIn {
      0% { transform: translateX(100%); }
      100% { transform: translateX(0); }
    }

    /* Estilos para el toast premium */
    .premium-toast {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .toast-icon {
      font-size: 16px;
      animation: rocketBounce 1s ease-in-out infinite;
    }

    .toast-text {
      font-weight: 500;
    }

    @keyframes rocketBounce {
      0%, 100% { transform: translateY(0); }
      50% { transform: translateY(-2px); }
    }

    /* Efectos adicionales para botones premium */
    .sidebar-btn.premium-disabled:hover .shine-effect {
      animation: shineSweep 2s ease-in-out infinite;
    }

    /* Efecto de progresión de color (para futuras actualizaciones) */
    .sidebar-btn.premium-disabled.progress-25 .lock-icon {
      filter: hue-rotate(30deg) brightness(1.1);
    }

    .sidebar-btn.premium-disabled.progress-50 .lock-icon {
      filter: hue-rotate(60deg) brightness(1.2);
    }

    .sidebar-btn.premium-disabled.progress-75 .lock-icon {
      filter: hue-rotate(90deg) brightness(1.3);
    }

    .sidebar-btn.premium-disabled.progress-100 .lock-icon {
      filter: hue-rotate(120deg) brightness(1.4);
      animation: lockUnlock 0.5s ease-in-out;
    }

    @keyframes lockUnlock {
      0% { transform: scale(1); }
      50% { transform: scale(1.2); }
      100% { transform: scale(1); }
    }

    /* Tooltip personalizado para botones premium */
    .sidebar-btn.premium-disabled[title]:hover::after {
      content: attr(title);
      position: absolute;
      bottom: -45px;
      left: 50%;
      transform: translateX(-50%);
      background: linear-gradient(135deg, rgba(15, 18, 28, 0.95) 0%, rgba(30, 41, 59, 0.95) 100%);
      color: #fbbf24;
      padding: 8px 12px;
      border-radius: 8px;
      font-size: 12px;
      font-weight: 500;
      white-space: nowrap;
      z-index: 10000;
      pointer-events: none;
      box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
      border: 1px solid rgba(251, 191, 36, 0.3);
      backdrop-filter: blur(8px);
      animation: tooltipFadeIn 0.3s ease-out;
    }

    .sidebar-btn.premium-disabled[title]:hover::before {
      content: '';
      position: absolute;
      bottom: -8px;
      left: 50%;
      transform: translateX(-50%);
      width: 0;
      height: 0;
      border-left: 6px solid transparent;
      border-right: 6px solid transparent;
      border-bottom: 6px solid rgba(30, 41, 59, 0.95);
      z-index: 10000;
      pointer-events: none;
    }

    /* Dentro del sidebar, tooltip premium a la derecha para no salirse de pantalla */
    .sidebar .sidebar-btn.premium-disabled[title]:hover::after {
      bottom: auto;
      left: 100%;
      margin-left: 10px;
      top: 50%;
      transform: translateY(-50%);
    }
    .sidebar .sidebar-btn.premium-disabled[title]:hover::before {
      bottom: auto;
      left: 100%;
      margin-left: 4px;
      top: 50%;
      transform: translateY(-50%);
      border-left: 6px solid rgba(30, 41, 59, 0.95);
      border-right: none;
      border-bottom: 6px solid transparent;
      border-top: 6px solid transparent;
    }

    .sidebar-btn.premium-disabled .coming-soon {
      font-size: 11px;
      color: #94a3b8;
      background: rgba(148, 163, 184, 0.2);
      border: 1px solid rgba(148, 163, 184, 0.4);
      padding: 2px 6px;
      border-radius: 6px;
      font-weight: 500;
    }



    .sidebar-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100vw;
      height: 100vh;
      background: rgba(0, 0, 0, 0.5);
      z-index: 99999;
      opacity: 0;
      visibility: hidden;
      transition: all 0.3s ease;
      backdrop-filter: blur(2px);
    }

    .sidebar-overlay.active {
      opacity: 1;
      visibility: visible;
    }

    /* Responsive para la barra lateral */
    @media (max-width: 768px) {
      .sidebar {
        width: 280px;
        left: -280px;
      }
      
      .sidebar-toggle {
        top: 75px !important;
        left: 15px !important;
        padding: 12px !important;
        min-width: 44px !important;
        min-height: 44px !important;
      }
      
      .sidebar-toggle i {
        font-size: 18px !important;
      }
    }

    /* Asegurar visibilidad en todos los temas */
    html[data-mode="light"] .sidebar-toggle {
      background: var(--neo-surface) !important;
      border-color: color-mix(in srgb, var(--neo-primary) 55%, transparent) !important;
      color: var(--neo-text) !important;
      box-shadow: 0 6px 25px color-mix(in srgb, var(--neo-primary) 12%, transparent) !important;
    }

    html[data-mode="light"] .sidebar-toggle:hover {
      background: color-mix(in srgb, var(--neo-primary) 12%, var(--neo-surface)) !important;
      border-color: var(--neo-primary) !important;
      color: var(--neo-primary) !important;
    }

    /* Asegurar que el botón esté siempre visible */
    .sidebar-toggle {
      opacity: 1 !important;
      visibility: visible !important;
      pointer-events: auto !important;
    }

    /* Prevenir que otros elementos lo oculten */
    body > .sidebar-toggle {
      position: fixed !important;
      z-index: 9999 !important;
    }

    /* Estilos de emergencia para asegurar visibilidad */
    #sidebarToggle {
      display: flex !important;
      visibility: visible !important;
      opacity: 1 !important;
      position: fixed !important;
      top: 80px !important;
      left: 20px !important;
      z-index: 99999 !important;
      background: #7c3aed !important;
      border: 2px solid #ffffff !important;
      color: #ffffff !important;
      padding: 14px !important;
      border-radius: 12px !important;
      cursor: pointer !important;
      box-shadow: 0 4px 20px rgba(124, 58, 237, 0.5) !important;
      min-width: 48px !important;
      min-height: 48px !important;
      align-items: center !important;
      justify-content: center !important;
      font-size: 20px !important;
      font-weight: bold !important;
    }

    #sidebarToggle:hover {
      background: #6d28d9 !important;
      transform: translateY(-2px) !important;
      box-shadow: 0 6px 25px rgba(124, 58, 237, 0.7) !important;
    }

    #sidebarToggle i {
      color: #ffffff !important;
      font-size: 20px !important;
      font-weight: bold !important;
    }

    /* Ajustes para tooltips específicos */
    .sidebar-btn.premium-disabled[title]:hover::after {
      max-width: 300px;
      white-space: normal;
      word-wrap: break-word;
    }

    /* Ajustes para elementos en chat */
    .control-btn[title]:hover::after,
    .input-action-btn[title]:hover::after {
      bottom: -35px;
      right: -5px;
      font-size: 11px;
      padding: 6px 10px;
    }

    /* Ajustes para elementos en vista de personaje */
    .mega-like[title]:hover::after,
    .follow-pill[title]:hover::after,
    .btn-icon[title]:hover::after {
      bottom: -35px;
      right: -5px;
      font-size: 11px;
      padding: 6px 10px;
    }

    .gal-del[title]:hover::after {
      bottom: -30px;
      right: -5px;
      font-size: 10px;
      padding: 4px 8px;
    }

    /* Ajustes para elementos de configuración */
    .anon-switch[title]:hover::after {
      bottom: -40px;
      right: 0;
      max-width: 250px;
      white-space: normal;
      word-wrap: break-word;
    }

    /* Ajustes para elementos de color */
    input[type="color"][title]:hover::after {
      bottom: -35px;
      right: 0;
      font-size: 11px;
      padding: 6px 10px;
    }

    /* Ajustes para elementos de navegación */
    .nav-link[title]:hover::after {
      bottom: -40px;
      right: 0;
      z-index: 10002;
    }

    /* Ajustes para elementos de notificaciones */
    .notifications-toggle[title]:hover::after {
      bottom: -35px;
      right: 0;
      z-index: 10002;
    }

    /* Ajustes para botón volver arriba */
    .back-to-top[title]:hover::after {
      bottom: -35px;
      right: 0;
      z-index: 10002;
    }

    /* ===== SISTEMA RESPONSIVE COMPLETO ===== */
    
    /* Pantallas Ultra HD (8K) */
    @media (min-width: 7680px) {
        .container {
            max-width: 7200px;
            margin: 0 auto;
        }
        
        .header-container {
            padding: 0 3rem;
        }
        
        .nav-link {
            padding: 1.5rem 2rem;
            font-size: 1.3rem;
        }
        
        .counter-chip {
            padding: 1rem 1.5rem;
            font-size: 1.2rem;
        }
        
        .logo-text {
            font-size: 3rem;
        }
        
        .logo-subtitle {
            font-size: 1.4rem;
        }
    }
    
    /* Pantallas 4K */
    @media (min-width: 3840px) and (max-width: 7679px) {
        .container {
            max-width: 3600px;
            margin: 0 auto;
        }
        
        .header-container {
            padding: 0 2.5rem;
        }
        
        .nav-link {
            padding: 1.25rem 1.75rem;
            font-size: 1.2rem;
        }
        
        .counter-chip {
            padding: 0.875rem 1.25rem;
            font-size: 1.1rem;
        }
        
        .logo-text {
            font-size: 2.75rem;
        }
        
        .logo-subtitle {
            font-size: 1.3rem;
        }
    }
    
    /* Pantallas QHD (2560px) */
    @media (min-width: 2560px) and (max-width: 3839px) {
        .container {
            max-width: 2400px;
            margin: 0 auto;
        }
        
        .header-container {
            padding: 0 2rem;
        }
        
        .nav-link {
            padding: 1rem 1.5rem;
            font-size: 1.1rem;
        }
        
        .counter-chip {
            padding: 0.75rem 1rem;
            font-size: 1rem;
        }
        
        .logo-text {
            font-size: 2.5rem;
        }
        
        .logo-subtitle {
            font-size: 1.2rem;
        }
    }
    
    /* Pantallas Full HD (1920px) */
    @media (max-width: 1920px) and (min-width: 1440px) {
        .container {
            max-width: 1400px;
        }
        
        .header-container {
            padding: 0 1.5rem;
        }
    }
    
    /* Pantallas HD (1366px) */
    @media (max-width: 1439px) and (min-width: 1024px) {
        .container {
            max-width: 1200px;
        }
        
        .header-container {
            padding: 0 1rem;
        }
        
        .nav {
            gap: 1rem;
        }
        
        .nav-link {
            padding: 0.75rem 1rem;
            font-size: 0.95rem;
        }
        
        .counter-group {
            gap: 0.75rem;
        }
        
        .counter-chip {
            padding: 0.6rem 0.8rem;
            font-size: 0.9rem;
        }
    }
    
    /* Móviles grandes (480–767px) */
    @media (max-width: 767px) and (min-width: 480px) {
        .header-container {
            flex-direction: column;
            gap: 1rem;
            padding: 1rem;
        }
        
        .header-center {
            order: 2;
            width: 100%;
        }
        
        .nav {
            justify-content: center;
            flex-wrap: wrap;
            gap: 0.5rem;
        }
        
        .nav-link {
            padding: 0.5rem 0.75rem;
            font-size: 0.85rem;
            min-width: auto;
        }
        
        .nav-link i {
            font-size: 1rem;
        }
        
        .header-actions {
            order: 1;
            width: 100%;
            justify-content: space-between;
        }
        
        .counter-group {
            flex-wrap: wrap;
            gap: 0.25rem;
        }
        
        .counter-chip {
            padding: 0.4rem 0.6rem;
            font-size: 0.8rem;
        }
        
        .logo {
            flex-direction: column;
            text-align: center;
            gap: 0.5rem;
        }
        
        .logo-text {
            font-size: 1.6rem;
        }
        
        .logo-subtitle {
            font-size: 0.85rem;
        }
    }
    
    /* Móviles medianos */
    @media (max-width: 479px) and (min-width: 360px) {
        .header-container {
            padding: 0.75rem;
            gap: 0.75rem;
        }
        
        .nav {
            gap: 0.25rem;
        }
        
        .nav-link {
            padding: 0.4rem 0.6rem;
            font-size: 0.8rem;
            border-radius: 8px;
        }
        
        .nav-link span {
            display: none;
        }
        
        .nav-link i {
            font-size: 1.1rem;
            margin: 0;
        }
        
        .counter-group {
            flex-direction: column;
            gap: 0.25rem;
        }
        
        .counter-chip {
            padding: 0.3rem 0.5rem;
            font-size: 0.75rem;
            min-width: auto;
        }
        
        .counter-chip .label {
            display: none;
        }
        
        .logo-text {
            font-size: 1.4rem;
        }
        
        .logo-subtitle {
            font-size: 0.75rem;
        }
        
        .beta-badge {
            font-size: 8px;
            padding: 1px 4px;
        }
    }
    
    /* Móviles pequeños */
    @media (max-width: 359px) {
        .header-container {
            padding: 0.5rem;
        }
        
        .nav-link {
            padding: 0.3rem 0.5rem;
            font-size: 0.75rem;
        }
        
        .counter-chip {
            padding: 0.25rem 0.4rem;
            font-size: 0.7rem;
        }
        
        .logo-text {
            font-size: 1.2rem;
        }
        
        .logo-subtitle {
            font-size: 0.7rem;
        }
    }
    
    /* Responsive para contenido principal */
    @media (max-width: 1024px) {
        .page {
            padding: 1rem;
        }
        
        .page-header {
            padding: 2rem 1rem;
        }
        
        .page-header h1 {
            font-size: 2rem;
        }
        
        .page-header p {
            font-size: 1rem;
        }
    }
    
    @media (max-width: 768px) {
        .page {
            padding: 0.75rem;
        }
        
        .page-header {
            padding: 1.5rem 0.75rem;
            text-align: center;
        }
        
        .page-header h1 {
            font-size: 1.75rem;
        }
        
        .page-header p {
            font-size: 0.9rem;
        }
        
        .header-content {
            flex-direction: column;
            gap: 1rem;
            text-align: center;
        }
        
        .header-icon {
            width: 60px;
            height: 60px;
        }
        
        .header-icon i {
            font-size: 1.5rem;
        }
    }
    
    @media (max-width: 480px) {
        .page {
            padding: 0.5rem;
        }
        
        .page-header {
            padding: 1rem 0.5rem;
        }
        
        .page-header h1 {
            font-size: 1.5rem;
        }
        
        .page-header p {
            font-size: 0.8rem;
        }
        
        .header-icon {
            width: 50px;
            height: 50px;
        }
        
        .header-icon i {
            font-size: 1.25rem;
        }
    }
    
    /* Responsive para toasts y notificaciones */
    @media (max-width: 768px) {
        #toastContainer {
            right: 10px;
            bottom: 10px;
            gap: 8px;
        }
        
        .toast {
            min-width: 280px;
            max-width: calc(100vw - 20px);
            padding: 12px 14px;
            font-size: 14px;
            border-radius: 10px;
        }
    }
    
    @media (max-width: 480px) {
        #toastContainer {
            right: 8px;
            bottom: 8px;
            gap: 6px;
        }
        
        .toast {
            min-width: 260px;
            max-width: calc(100vw - 16px);
            padding: 10px 12px;
            font-size: 13px;
            border-radius: 8px;
        }
    }
    
    @media (max-width: 360px) {
        #toastContainer {
            right: 5px;
            bottom: 5px;
        }
        
        .toast {
            min-width: 240px;
            max-width: calc(100vw - 10px);
            padding: 8px 10px;
            font-size: 12px;
        }
    }
    
    /* Responsive para modales */
    @media (max-width: 1024px) {
        .admin-modal-container {
            width: 95vw;
            max-height: 95vh;
        }
    }
    
    @media (max-width: 768px) {
        .admin-modal-container {
            width: 98vw;
            max-height: 98vh;
            border-radius: 12px;
        }
        
        .admin-modal-header {
            padding: 1rem;
        }
        
        .admin-modal-body {
            padding: 1rem;
        }
    }
    
    @media (max-width: 480px) {
        .admin-modal-container {
            width: 100vw;
            height: 100vh;
            border-radius: 0;
        }
        
        .admin-modal-header {
            padding: 0.75rem;
        }
        
        .admin-modal-body {
            padding: 0.75rem;
        }
    }
    
    /* Responsive para el visor de media */
    @media (max-width: 1024px) {
        .media-viewer-container {
            width: 90vw;
            height: 80vh;
            border-radius: 16px;
        }
    }
    
    @media (max-width: 768px) {
        .media-viewer-container {
            width: 95vw;
            height: 85vh;
            border-radius: 12px;
        }
        
        .media-viewer-header {
            padding: 1rem;
        }
        
        .media-viewer-title {
            font-size: 1rem;
        }
        
        .media-nav-btn {
            width: 40px;
            height: 40px;
            font-size: 1rem;
        }
    }
    
    @media (max-width: 480px) {
        .media-viewer-container {
            width: 98vw;
            height: 90vh;
            border-radius: 8px;
        }
        
        .media-viewer-header {
            padding: 0.75rem;
        }
        
        .media-viewer-title {
            font-size: 0.9rem;
        }
        
        .media-nav-btn {
            width: 36px;
            height: 36px;
            font-size: 0.9rem;
        }
        
        .media-indicators {
            gap: 0.25rem;
        }
        
        .indicator-btn {
            width: 8px;
            height: 8px;
        }
    }
    
    /* Responsive para sidebar */
    @media (max-width: 768px) {
        .sidebar {
            width: 100vw;
            max-width: 320px;
        }
        
        .sidebar-header {
            padding: 1rem;
        }
        
        .sidebar-section {
            padding: 0.75rem;
        }
        
        .sidebar-btn {
            padding: 0.75rem;
            font-size: 0.9rem;
        }
    }
    
    @media (max-width: 480px) {
        .sidebar {
            width: 100vw;
            max-width: 280px;
        }
        
        .sidebar-header {
            padding: 0.75rem;
        }
        
        .sidebar-section {
            padding: 0.5rem;
        }
        
        .sidebar-btn {
            padding: 0.6rem;
            font-size: 0.85rem;
        }
    }
    
    /* Responsive para formularios */
    @media (max-width: 768px) {
        .admin-form-grid {
            grid-template-columns: 1fr;
            gap: 1rem;
        }
        
        .admin-form-group {
            margin-bottom: 1rem;
        }
        
        .admin-input {
            padding: 0.75rem;
            font-size: 16px; /* Evita zoom en iOS */
        }
        
        .admin-label {
            font-size: 0.9rem;
        }
    }
    
    @media (max-width: 480px) {
        .admin-form-group {
            margin-bottom: 0.75rem;
        }
        
        .admin-input {
            padding: 0.6rem;
            font-size: 16px;
        }
        
        .admin-label {
            font-size: 0.85rem;
        }
    }
    
    /* Responsive para botones */
    @media (max-width: 768px) {
        .btn {
            padding: 0.75rem 1rem;
            font-size: 0.9rem;
        }
        
        .btn-primary {
            padding: 0.75rem 1.25rem;
        }
    }
    
    @media (max-width: 480px) {
        .btn {
            padding: 0.6rem 0.8rem;
            font-size: 0.85rem;
        }
        
        .btn-primary {
            padding: 0.6rem 1rem;
        }
    }
    
    /* Responsive para tablas */
    @media (max-width: 768px) {
        .table-responsive {
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
        }
        
        .table {
            min-width: 600px;
        }
        
        .table th,
        .table td {
            padding: 0.5rem;
            font-size: 0.85rem;
        }
    }
    
    @media (max-width: 480px) {
        .table th,
        .table td {
            padding: 0.4rem;
            font-size: 0.8rem;
        }
    }
    
    /* Responsive para cards */
    @media (max-width: 768px) {
        .changelog-card {
            padding: 1rem;
            margin-bottom: 1rem;
        }
        
        .card-header {
            flex-direction: column;
            gap: 0.75rem;
            align-items: flex-start;
        }
        
        .entry-info {
            flex-direction: column;
            gap: 0.5rem;
        }
    }
    
    @media (max-width: 480px) {
        .changelog-card {
            padding: 0.75rem;
            margin-bottom: 0.75rem;
        }
        
        .card-header {
            gap: 0.5rem;
        }
        
        .entry-title {
            font-size: 1rem;
        }
        
        .entry-subtitle {
            font-size: 0.8rem;
        }
    }
    
    /* Responsive para estadísticas */
    @media (max-width: 768px) {
        .stats-container {
            grid-template-columns: repeat(2, 1fr);
            gap: 1rem;
        }
    }
    
    @media (max-width: 480px) {
        .stats-container {
            grid-template-columns: 1fr;
            gap: 0.75rem;
        }
        
        .stat-card {
            padding: 1rem;
        }
        
        .stat-number {
            font-size: 1.5rem;
        }
        
        .stat-label {
            font-size: 0.8rem;
        }
    }
    
    /* Responsive para controles de búsqueda */
    @media (max-width: 768px) {
        .admin-controls {
            flex-direction: column;
            gap: 1rem;
        }
        
        .controls-left,
        .controls-right {
            width: 100%;
        }
        
        .search-container {
            width: 100%;
        }
        
        .search-input {
            width: 100%;
            font-size: 16px;
        }
    }
    
    @media (max-width: 480px) {
        .admin-controls {
            gap: 0.75rem;
        }
        
        .search-input {
            padding: 0.6rem;
            font-size: 16px;
        }
        
        .create-btn {
            width: 100%;
            justify-content: center;
        }
    }
    
    /* Responsive para notificaciones públicas */
    @media (max-width: 768px) {
        #public-changelog-notification > div {
            padding: 1.5rem;
            border-radius: 12px;
            max-width: 90vw;
            width: 90vw;
        }
        
        #public-changelog-notification h3 {
            font-size: 1.25rem;
        }
        
        #public-changelog-notification p {
            font-size: 0.9rem;
        }
    }
    
    @media (max-width: 480px) {
        #public-changelog-notification > div {
            padding: 1rem;
            border-radius: 8px;
            max-width: 95vw;
            width: 95vw;
        }
        
        #public-changelog-notification h3 {
            font-size: 1.1rem;
        }
        
        #public-changelog-notification p {
            font-size: 0.8rem;
        }
        
        #public-changelog-notification button {
            padding: 0.6rem 1rem;
            font-size: 0.85rem;
        }
    }

    /* ===== OPTIMIZACIONES ESPECÍFICAS PARA MÓVILES ===== */
    
    /* Prevenir zoom en inputs en iOS */
    @media screen and (max-width: 768px) {
        input[type="text"],
        input[type="email"],
        input[type="password"],
        input[type="search"],
        input[type="url"],
        input[type="tel"],
        input[type="number"],
        textarea,
        select {
            font-size: 16px !important;
            -webkit-appearance: none;
            appearance: none;
            border-radius: 8px;
        }
        
        /* Mejorar touch targets */
        button,
        .btn,
        .nav-link,
        .sidebar-btn,
        .counter-chip {
            min-height: 44px;
            min-width: 44px;
        }
        
        /* Optimizar scroll */
        body {
            -webkit-overflow-scrolling: touch;
            overflow-x: hidden;
        }
        
        /* Prevenir scroll horizontal */
        .container,
        .page,
        .admin-container,
        .changelog-container {
            max-width: 100vw;
            overflow-x: hidden;
        }
        
        /* Ajustar padding para notch */
        .header-container {
            padding-left: env(safe-area-inset-left);
            padding-right: env(safe-area-inset-right);
        }
        
        .sidebar {
            padding-left: env(safe-area-inset-left);
            padding-right: env(safe-area-inset-right);
        }
        
        /* Optimizar modales para pantalla completa en móviles */
        .admin-modal-container,
        .media-viewer-container,
        #public-changelog-notification > div {
            width: 100vw !important;
            height: 100vh !important;
            max-width: 100vw !important;
            max-height: 100vh !important;
            border-radius: 0 !important;
            margin: 0 !important;
            top: 0 !important;
            left: 0 !important;
            transform: none !important;
        }
        
        /* Ajustar contenido de modales */
        .admin-modal-body,
        .media-viewer-content {
            height: calc(100vh - 60px);
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }
        
        /* Optimizar formularios en móviles */
        .admin-form-grid {
            grid-template-columns: 1fr !important;
            gap: 1rem !important;
        }
        
        .admin-form-group {
            margin-bottom: 1rem !important;
        }
        
        /* Mejorar navegación en móviles */
        .nav {
            gap: 0.5rem !important;
        }
        
        .nav-link {
            padding: 0.75rem !important;
            border-radius: 12px !important;
        }
        
        /* Optimizar sidebar en móviles */
        .sidebar {
            width: 100vw !important;
            max-width: 100vw !important;
        }
        
        /* Mejorar toasts en móviles */
        #toastContainer {
            right: 10px !important;
            bottom: 10px !important;
            left: 10px !important;
            width: auto !important;
        }
        
        .toast {
            width: 100% !important;
            max-width: none !important;
            min-width: auto !important;
        }
    }
    
    /* Optimizaciones específicas para pantallas muy pequeñas */
    @media screen and (max-width: 360px) {
        .header-container {
            padding: 0.5rem !important;
        }
        
        .nav-link {
            padding: 0.5rem !important;
            font-size: 0.8rem !important;
        }
        
        .nav-link span {
            display: none !important;
        }
        
        .nav-link i {
            font-size: 1.2rem !important;
            margin: 0 !important;
        }
        
        .counter-chip {
            padding: 0.4rem !important;
            font-size: 0.75rem !important;
        }
        
        .counter-chip .label {
            display: none !important;
        }
        
        .logo-text {
            font-size: 1.2rem !important;
        }
        
        .logo-subtitle {
            font-size: 0.7rem !important;
        }
        
        .beta-badge {
            font-size: 8px !important;
            padding: 1px 4px !important;
        }
    }
    
    /* Prevenir problemas de layout en orientación landscape */
    @media screen and (max-height: 500px) and (orientation: landscape) {
        .header-container {
            padding: 0.5rem !important;
        }
        
        .nav-link {
            padding: 0.5rem !important;
        }
        
        .logo-text {
            font-size: 1.5rem !important;
        }
        
        .logo-subtitle {
            font-size: 0.8rem !important;
        }
        
        .admin-modal-container,
        .media-viewer-container {
            height: 100vh !important;
        }
        
        .admin-modal-body,
        .media-viewer-content {
            height: calc(100vh - 50px) !important;
        }
    }
    
    /* Optimizaciones para dispositivos con notch */
    @supports (padding: max(0px)) {
        .header-container {
            padding-left: max(1rem, env(safe-area-inset-left));
            padding-right: max(1rem, env(safe-area-inset-right));
        }
        
        .sidebar {
            padding-left: max(1rem, env(safe-area-inset-left));
            padding-right: max(1rem, env(safe-area-inset-right));
        }
        
        .admin-modal-container,
        .media-viewer-container {
            padding-top: max(0px, env(safe-area-inset-top));
            padding-bottom: max(0px, env(safe-area-inset-bottom));
        }
    }
    
    /* Mejorar rendimiento en dispositivos móviles */
    @media screen and (max-width: 768px) {
        * {
            -webkit-tap-highlight-color: transparent;
        }
        
        .btn,
        .nav-link,
        .sidebar-btn {
            transition: all 0.2s ease !important;
        }
        
        /* Optimizar animaciones para móviles */
        .changelog-card,
        .admin-card {
            animation-duration: 0.3s !important;
        }
        
        /* Mejorar scroll performance */
        .sidebar,
        .admin-modal-body,
        .media-viewer-content {
            -webkit-overflow-scrolling: touch;
            scroll-behavior: smooth;
        }
    }

/* Translate button (Traducir / Translate) – used in announcements, changelog, comments, description */
.translate-row {
    margin-top: 6px;
    display: block;
}
.btn-translate-block {
    background: transparent;
    border: 0;
    color: var(--neo-primary, #6366f1);
    cursor: pointer;
    font-size: inherit;
    padding: 0;
    opacity: 0.9;
}
.btn-translate-block:hover {
    opacity: 1;
    text-decoration: underline;
}
.btn-translate-block:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* ============================================================
   ANIMACIONES: reducir velocidad y respetar prefers-reduced-motion
   Evita que en algunos dispositivos (alta tasa de refresco, etc.)
   las animaciones se vean demasiado aceleradas o bruscas.
   ============================================================ */
:root {
  --neo-transition-fast: 0.22s;
  --neo-transition-normal: 0.3s;
  --neo-transition-slow: 0.4s;
  --neo-animation-duration: 0.35s;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --neo-transition-fast: 0.01ms;
    --neo-transition-normal: 0.01ms;
    --neo-transition-slow: 0.01ms;
    --neo-animation-duration: 0.01ms;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
}
