/* ==================== MODERN LAYOUT FOR PORTABLE CONSOLES ==================== */
/* Rediseño inteligente manteniendo todas las funcionalidades existentes */

/* ==================== VARIABLES ==================== */
:root {
  --navbar-height: 56px;
  --sidebar-width: 280px;
  --sidebar-collapsed: 0px;
  --transition-speed: 0.3s;
}

/* ==================== NAVBAR SUPERIOR COMPACTO ==================== */

/* Header principal - STICKY CON AUTO-HIDE */
.header {
  height: var(--navbar-height);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between; /* ⭐ Distribuir elementos */
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  margin-left: 0;
  transition: transform 0.3s ease; /* ⭐ Animación suave */
}

/* Header oculto al scroll down */
.header.hidden {
  transform: translateY(-100%);
}

/* Header visible al scroll up */
.header.visible {
  transform: translateY(0);
}

/* Header left - Logo + Hamburger */
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Header center - Search */
.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  max-width: 600px;
}

/* Header right - Settings + Login */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Logo más pequeño - CLICKABLE */
.header .logo {
  font-size: 1.25rem;
  font-weight: 700;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer; /* ⭐ Clickable */
  transition: opacity 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.header .logo:hover {
  opacity: 0.8;
}

.header .logo-icon {
  font-size: 1.5rem;
}

.header .logo img {
  transition: transform 0.2s ease;
}

.header .logo:hover img {
  transform: scale(1.05);
}

/* Hamburger button - FUCSIA RETROFUTURISTA */
.header .hamburger-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ff006e, #8b5cf6);
  border: 2px solid #ff006e;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.25rem;
  color: white;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(255, 0, 110, 0.3);
}

.header .hamburger-btn:hover {
  background: linear-gradient(135deg, #ff1a82, #9d6cff);
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(255, 0, 110, 0.5);
}

.header .hamburger-btn:active {
  transform: scale(0.98);
}

/* Search container - MÁS FLEXIBLE */
.header .search-container {
  flex: 1;
  max-width: 500px;
  min-width: 200px;
  position: relative;
}

.header .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  pointer-events: none;
  z-index: 1;
}

.header .search-input {
  width: 100%;
  height: 40px;
  padding: 0 80px 0 40px;
  font-size: 0.9rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.header .search-input:focus {
  outline: none;
  border-color: var(--accent-color, #8b5cf6);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.header .search-input::placeholder {
  color: var(--text-secondary);
}

.header .search-shortcut {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 4px 8px;
  border-radius: 4px;
  pointer-events: none;
}

/* Header actions - COMPACTAS */
.header .header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Dropdown menu button */
.header .settings-dropdown {
  position: relative;
}

.header .settings-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.25rem;
  transition: all 0.2s ease;
}

.header .settings-btn:hover {
  background: var(--bg-tertiary);
}

/* Dropdown menu */
.settings-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 8px;
  min-width: 200px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1000;
}

.settings-dropdown-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.settings-dropdown-menu .menu-item {
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background 0.2s ease;
  color: var(--text-primary);
  text-decoration: none;
}

.settings-dropdown-menu .menu-item:hover {
  background: var(--bg-tertiary);
}

.settings-dropdown-menu .menu-item-icon {
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
}

.settings-dropdown-menu .menu-item-text {
  font-size: 0.9rem;
  font-weight: 500;
}

/* User button - MEJORADO */
.header .user-btn {
  min-width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.header .user-btn:hover {
  background: var(--bg-tertiary);
  transform: scale(1.05);
}

.header .user-btn .btn-icon {
  font-size: 1.25rem;
}

.header .user-btn .btn-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
}

.header .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

/* User info container cuando está logueado */
.header .user-info-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header .user-info-container img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

/* Ocultar texto en móvil */
@media (max-width: 768px) {
  .header .user-btn .btn-text {
    display: none;
  }
  
  .header .user-btn {
    padding: 0;
    width: 40px;
  }
}

/* ==================== SIDEBAR MODERNO ==================== */

/* Sidebar - OVERLAY EN MÓVIL, SIEMPRE OCULTO HASTA CLICK */
.sidebar {
  position: fixed;
  left: -100%;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  z-index: 200;
  transition: left var(--transition-speed) ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar.open {
  left: 0;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
}

/* Sidebar header */
.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-header .sidebar-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-header .sidebar-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.25rem;
}

/* Sidebar content - CON SCROLL */
.sidebar-content {
  flex: 1;
  overflow-y: auto !important; /* ⭐ CRÍTICO: Habilitar scroll */
  overflow-x: hidden;
  padding: 12px;
  -webkit-overflow-scrolling: touch; /* Smooth scroll en iOS */
  scrollbar-width: thin;
  scrollbar-color: var(--accent-color, #8b5cf6) var(--bg-tertiary);
}

/* Scrollbar personalizado para sidebar */
.sidebar-content::-webkit-scrollbar {
  width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb {
  background: var(--accent-color, #8b5cf6);
  border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
  background: var(--accent-hover, #7c3aed);
}

/* Servers section - COLAPSABLE */
.sidebar-section {
  margin-bottom: 16px;
}

.sidebar-section-header {
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  transition: all 0.2s ease;
}

.sidebar-section-header:hover {
  background: var(--bg-primary);
}

.sidebar-section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-section-toggle {
  font-size: 0.875rem;
  transition: transform 0.2s ease;
}

.sidebar-section-header.collapsed .sidebar-section-toggle {
  transform: rotate(-90deg);
}

.sidebar-section-content {
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.sidebar-section-header.collapsed + .sidebar-section-content {
  max-height: 0;
}

/* Server items */
.sidebar-server-item {
  padding: 10px 12px;
  margin-bottom: 4px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
}

.sidebar-server-item:hover {
  background: var(--bg-tertiary);
}

.sidebar-server-item.active {
  background: rgba(139, 92, 246, 0.2);
  border-left: 3px solid #8b5cf6;
}

.sidebar-server-icon {
  font-size: 1.125rem;
}

.sidebar-server-name {
  font-size: 0.9rem;
  color: var(--text-primary);
}

/* Platforms section */
.sidebar-platforms {
  margin-top: 8px;
}

/* Platform search */
.sidebar-platform-search {
  padding: 0 12px;
  margin-bottom: 12px;
}

.sidebar-platform-search input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 36px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--text-primary);
}

/* Platform items */
.sidebar-platform-item {
  padding: 10px 12px;
  margin-bottom: 4px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
}

.sidebar-platform-item:hover {
  background: var(--bg-tertiary);
}

.sidebar-platform-item.active {
  background: rgba(139, 92, 246, 0.2);
  border-left: 3px solid #8b5cf6;
}

.sidebar-platform-icon {
  font-size: 1.125rem;
  width: 24px;
  text-align: center;
}

.sidebar-platform-name {
  font-size: 0.9rem;
  color: var(--text-primary);
  flex: 1;
}

.sidebar-platform-count {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 12px;
}

/* Sidebar overlay */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 199;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-speed) ease;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ==================== MAIN CONTENT ==================== */

/* Main content - SIN MARGIN, FULL WIDTH */
.main-content {
  margin-left: 0;
  width: 100%;
  min-height: calc(100vh - var(--navbar-height));
  padding-top: 0;
  overflow-y: auto; /* ⭐ CRÍTICO: Habilitar scroll vertical */
  overflow-x: hidden;
}

/* ⭐ FIX CRÍTICO: Asegurar scroll en toda la página */
body {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  height: auto !important;
}

html {
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

.main-content-wrapper {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  height: auto !important;
  min-height: calc(100vh - var(--navbar-height));
}

.app-container {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  height: auto !important;
}

/* ==================== SEGUNDA BARRA (BREADCRUMB + SEARCH) ==================== */

/* Esta barra SOLO se muestra en vista de plataforma, NO en home */
.platform-nav {
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: none; /* Oculta por defecto en home */
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.platform-nav.visible {
  display: flex;
}

/* Breadcrumb */
.platform-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.platform-breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.platform-breadcrumb a:hover {
  color: var(--text-primary);
}

.platform-breadcrumb .current {
  color: var(--text-primary);
  font-weight: 600;
}

/* Platform search */
.platform-search-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.platform-search {
  width: 250px;
  height: 36px;
  padding: 0 12px 0 36px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.875rem;
}

.platform-count {
  font-size: 0.875rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

@media (max-width: 768px) {
  .platform-nav {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 12px;
  }
  
  .platform-search-container {
    width: 100%;
  }
  
  .platform-search {
    flex: 1;
  }
}

/* ==================== RESPONSIVE ADJUSTMENTS ==================== */

/* Desktop - sidebar opcional */
@media (min-width: 1280px) {
  /* Opción: mostrar sidebar fijo en desktop */
  .sidebar-toggle-desktop {
    display: none; /* Ocultar toggle en desktop si quieres sidebar fija */
  }
}

/* Tablets */
@media (max-width: 1024px) {
  :root {
    --navbar-height: 52px;
  }
  
  .header {
    padding: 8px 14px;
  }
}

/* Móviles */
@media (max-width: 768px) {
  :root {
    --navbar-height: 50px;
    --sidebar-width: 280px;
  }
  
  .header {
    padding: 8px 12px;
  }
  
  .header .search-container {
    min-width: 150px;
  }
  
  .sidebar {
    width: 85%;
    max-width: 320px;
  }
}

@media (max-width: 480px) {
  :root {
    --navbar-height: 48px;
  }
  
  .header {
    padding: 6px 10px;
  }
  
  .header .hamburger-btn,
  .header .settings-btn,
  .header .user-btn {
    width: 36px;
    height: 36px;
  }
  
  .sidebar {
    width: 90%;
  }
}

/* ==================== SMOOTH ANIMATIONS ==================== */

/* Fade in/out */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.settings-dropdown-menu.active {
  animation: fadeIn 0.2s ease;
}

/* Slide in sidebar */
@keyframes slideIn {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

.sidebar.open {
  animation: slideIn 0.3s ease;
}

/* ==================== RESPONSIVE HEADER MEJORADO ==================== */

/* Logo responsive */
@media (max-width: 768px) {
  .header .logo .logo-text {
    display: none;
  }
  
  .header .search-container {
    max-width: none;
    flex: 1;
  }
  
  .header .search-shortcut {
    display: none;
  }
  
  .header .search-input {
    padding-right: 12px;
  }
}

@media (max-width: 1200px) {
  /* En pantallas < 1200px, ocultar texto del logo */
  .header .logo .logo-text {
    max-height: 20px;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 6px 10px;
    gap: 8px;
  }
  
  .header .hamburger-btn,
  .header .settings-btn,
  .header .user-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }
  
  .header .logo .logo-icon {
    width: 28px;
    height: 28px;
  }
  
  .header .search-input {
    height: 36px;
    font-size: 0.85rem;
  }
}

/* ==================== FIX PARA TOUCH SCROLL ==================== */

/* Habilitar scroll suave en touch devices */
* {
  -webkit-overflow-scrolling: touch;
}

body,
html,
.app-container,
.main-content-wrapper,
.main-content,
.sidebar-content {
  touch-action: pan-y !important;
  overscroll-behavior: contain;
}

/* Prevenir bloqueo de scroll */
.app-container {
  position: relative !important;
  overflow: visible !important;
}

.main-content-wrapper {
  position: relative !important;
  overflow: visible !important;
}

/* ==================== MODERN FOOTER ==================== */

.modern-footer {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(255, 0, 110, 0.1));
  border-top: 1px solid var(--border-color);
  padding: 60px 20px 30px;
  margin-top: 80px;
  position: relative;
  overflow: hidden;
}

.modern-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #ff006e, #8b5cf6, transparent);
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.footer-logo-section {
  margin-bottom: 30px;
}

.footer-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  filter: drop-shadow(0 4px 20px rgba(255, 0, 110, 0.3));
  transition: transform 0.3s ease;
}

.footer-logo:hover {
  transform: scale(1.1) rotate(5deg);
}

.footer-tagline {
  font-size: 1.125rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 600px;
  margin: 0 auto;
  font-weight: 300;
}

.footer-tagline strong {
  color: var(--text-primary);
  font-weight: 600;
  background: linear-gradient(135deg, #ff006e, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
  margin: 40px 0 30px;
  flex-wrap: wrap;
}

.footer-link {
  position: relative;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 8px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-link::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #ff006e, #8b5cf6);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.footer-link:hover {
  color: #ff006e;
  transform: translateY(-2px);
}

.footer-link:hover::before {
  width: 100%;
}

.footer-link-icon {
  font-size: 1.125rem;
}

.footer-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-color), transparent);
  margin: 30px auto;
  max-width: 800px;
}

.footer-copyright {
  font-size: 0.875rem;
  color: var(--text-secondary);
  opacity: 0.7;
}

.footer-copyright a {
  color: #ff006e;
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-copyright a:hover {
  color: #8b5cf6;
}

/* Responsive Footer */
@media (max-width: 768px) {
  .modern-footer {
    padding: 40px 15px 20px;
  }
  
  .footer-logo {
    width: 60px;
    height: 60px;
  }
  
  .footer-tagline {
    font-size: 1rem;
  }
  
  .footer-links {
    gap: 20px;
    flex-direction: column;
  }
  
  .footer-link {
    width: 100%;
    max-width: 200px;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .modern-footer {
    padding: 30px 10px 15px;
  }
  
  .footer-logo {
    width: 50px;
    height: 50px;
  }
  
  .footer-tagline {
    font-size: 0.9rem;
  }
}

/* ==================== PLATFORM NAVIGATION MEJORADO ==================== */

/* Platform nav más visible */
.platform-nav {
  padding: 16px 20px;
  background: rgba(139, 92, 246, 0.05);
  border-bottom: 1px solid var(--border-color);
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.platform-nav.visible {
  display: flex;
}

/* Breadcrumb más visible */
.platform-breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.platform-breadcrumb a {
  color: #ff006e;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  padding: 4px 8px;
  border-radius: 4px;
}

.platform-breadcrumb a:hover {
  background: rgba(255, 0, 110, 0.1);
  color: #ff1a82;
}

.platform-breadcrumb .current {
  color: var(--text-primary);
  font-weight: 600;
}

/* Platform search más grande y visible */
.platform-search-container {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  max-width: 500px;
}

.platform-search {
  flex: 1;
  height: 42px;
  padding: 0 16px 0 42px;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: all 0.2s ease;
  position: relative;
}

.platform-search:focus {
  outline: none;
  border-color: #ff006e;
  box-shadow: 0 0 0 3px rgba(255, 0, 110, 0.1);
}

.platform-search::placeholder {
  color: var(--text-secondary);
}

/* Ícono de búsqueda para platform search */
.platform-search-container::before {
  content: '🔍';
  position: absolute;
  left: 14px;
  font-size: 1.125rem;
  pointer-events: none;
}

.platform-search-container {
  position: relative;
}

.platform-count {
  font-size: 0.9rem;
  color: var(--text-secondary);
  white-space: nowrap;
  background: var(--bg-tertiary);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 500;
}

.platform-count span {
  color: #ff006e;
  font-weight: 700;
}

@media (max-width: 768px) {
  .platform-nav {
    padding: 12px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .platform-breadcrumb {
    font-size: 0.875rem;
  }
  
  .platform-search-container {
    width: 100%;
    max-width: none;
  }
  
  .platform-search {
    height: 38px;
  }
  
  .platform-count {
    text-align: center;
  }
}