/**
 * User Menu Styles - Centralized CSS
 * This file contains all styles for the user dropdown menu
 * Used across all pages to ensure consistency
 */

/* ===== USER MENU CONTAINER ===== */
.user-menu {
  position: relative;
  display: flex;
  align-items: center;
  white-space: nowrap;
  height: 100%;
}

/* ===== DROPDOWN TRIGGER (User Name) ===== */
.user-menu .dropdown-trigger {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px;
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
  font-size: 23px;
  font-weight: 500;
  transition: all 0.3s ease;
  color: #333;
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
}

/* ===== USER AVATAR CIRCLE ===== */
.user-avatar-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4A90E2, #357ABD);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
  transition: all 0.3s ease;
}

.user-avatar-circle #user-initial {
  color: white;
  font-size: 18px;
  font-weight: 600;
  text-transform: uppercase;
  line-height: 1;
}

.user-menu .dropdown-trigger:hover {
  color: #fdc21c;
  background-color: rgba(253, 194, 28, 0.1);
  transform: translateX(5px);
}

.user-menu .dropdown-trigger:hover .user-avatar-circle {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

/* ===== DROPDOWN ARROW ===== */
.user-menu .dropdown-arrow {
  font-size: 16px;
  transition: transform 0.3s ease;
}

.user-menu .dropdown-trigger.active .dropdown-arrow {
  transform: rotate(180deg);
}

/* ===== DROPDOWN MENU ===== */
.user-menu .dropdown-menu,
#user-dropdown-menu {
  position: absolute !important;
  top: calc(100% + 5px) !important;
  left: 0 !important;
  right: 0 !important;
  margin: 0 auto !important;
  background: white !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
  min-width: 200px !important;
  z-index: 1000 !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transition: all 0.3s ease !important;
}

.user-menu .dropdown-menu.show,
#user-dropdown-menu.show {
  opacity: 1 !important;
  visibility: visible !important;
}

/* ===== DROPDOWN ITEMS ===== */
.user-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  color: #374151;
  text-decoration: none;
  font-size: 16px;
  transition: all 0.3s ease;
  border-radius: 0;
  margin: 0;
  border-bottom: 1px solid #f8f9fa;
}

.user-menu .dropdown-item:last-child {
  border-bottom: none;
}

.user-menu .dropdown-item:hover {
  background-color: rgba(253, 194, 28, 0.1);
  color: #fdc21c;
}

.user-menu .dropdown-item i {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

/* ===== RESPONSIVE STYLES ===== */
@media (max-width: 768px) {
  .user-menu .dropdown-trigger {
    font-size: 18px;
    padding: 12px 16px; /* Increased padding for better touch target */
    min-height: 48px; /* Minimum touch target size */
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .user-avatar-circle {
    width: 35px;
    height: 35px;
  }
  
  .user-avatar-circle #user-initial {
    font-size: 16px;
  }
  
  .user-menu .dropdown-menu,
  #user-dropdown-menu {
    top: calc(100% + 8px) !important; /* Increased gap */
    left: 0 !important;
    right: 0 !important;
    margin: 0 auto !important;
    min-width: 220px !important; /* Increased minimum width for "Cerrar Sesión" */
    max-width: 280px !important; /* Increased max-width */
    width: auto !important; /* Allow width to adjust to content */
    border-radius: 12px !important; /* More rounded corners for mobile */
    overflow: visible !important; /* Show full text on mobile */
    white-space: nowrap !important; /* Prevent text wrapping */
  }
}

@media (max-width: 480px) {
  .user-menu .dropdown-trigger {
    padding: 14px 18px; /* Even larger padding for smaller screens */
    min-height: 52px; /* Larger touch target for small screens */
  }
  
  .user-avatar-circle {
    width: 32px;
    height: 32px;
  }
  
  .user-avatar-circle #user-initial {
    font-size: 14px;
  }
  
  .user-menu .dropdown-menu,
  #user-dropdown-menu {
    top: calc(100% + 10px) !important; /* Increased gap for small screens */
    left: 0 !important;
    right: 0 !important;
    margin: 0 auto !important;
    min-width: 200px !important; /* Increased minimum width for "Cerrar Sesión" */
    max-width: 250px !important; /* Increased max-width */
    width: auto !important; /* Allow width to adjust to content */
    border-radius: 12px !important;
    overflow: visible !important; /* Changed back to visible to show full text */
    white-space: nowrap !important; /* Prevent text wrapping */
  }
  
  .user-menu .dropdown-item {
    padding: 16px 20px; /* Increased padding for better touch targets */
    font-size: 16px; /* Larger font for better readability */
    min-height: 48px; /* Minimum touch target size */
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Keep original alignment */
    text-align: left; /* Keep original alignment */
    margin: 0; /* Remove any margins on mobile */
    overflow: visible; /* Show full text on mobile */
    white-space: nowrap; /* Prevent text wrapping on mobile */
  }
}

/* ===== DARK MODE STYLES ===== */
body.active .user-menu .dropdown-trigger {
  color: #f1f5f9;
}

body.active .user-menu .dropdown-trigger:hover {
  color: #fdc21c;
  background-color: rgba(253, 194, 28, 0.1);
}

body.active .user-avatar-circle {
  background: linear-gradient(135deg, #6B73FF, #4A90E2);
  box-shadow: 0 2px 8px rgba(107, 115, 255, 0.3);
}

body.active .user-menu .dropdown-trigger:hover .user-avatar-circle {
  box-shadow: 0 4px 12px rgba(107, 115, 255, 0.4);
}

/* ===== USER AVATAR CIRCLE LARGE (Dashboard) ===== */
.user-avatar-circle-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4A90E2, #357ABD);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(74, 144, 226, 0.3);
  transition: all 0.3s ease;
}

.user-avatar-circle-large .user-initial-large {
  color: white;
  font-size: 32px;
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1;
}

/* Dark mode for large avatar */
body.active .user-avatar-circle-large {
  background: linear-gradient(135deg, #6B73FF, #4A90E2);
  box-shadow: 0 4px 16px rgba(107, 115, 255, 0.3);
}

/* Responsive for large avatar */
@media (max-width: 768px) {
  .user-avatar-circle-large {
    width: 60px;
    height: 60px;
  }
  
  .user-avatar-circle-large .user-initial-large {
    font-size: 24px;
  }
}

@media (max-width: 480px) {
  .user-avatar-circle-large {
    width: 50px;
    height: 50px;
  }
  
  .user-avatar-circle-large .user-initial-large {
    font-size: 20px;
  }
}

body.active .user-menu .dropdown-menu {
  background: #0f172a !important;
  border-color: #334155 !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3) !important;
}

body.active .user-menu .dropdown-item {
  color: #e2e8f0;
}

body.active .user-menu .dropdown-item:hover {
  background-color: rgba(253, 194, 28, 0.1);
  color: #fdc21c;
}

/* ===== DARK MODE STYLES FOR LOGOUT BUTTON ===== */
/* Estilos específicos para el botón de logout en modo oscuro */
body.active .user-menu .dropdown-menu .dropdown-item,
body.active #user-dropdown-menu .dropdown-item,
body.active .dropdown-menu .dropdown-item {
  color: #e2e8f0 !important;
  background: transparent !important;
  text-decoration: none !important;
}

body.active .user-menu .dropdown-menu .dropdown-item:hover,
body.active #user-dropdown-menu .dropdown-item:hover,
body.active .dropdown-menu .dropdown-item:hover {
  background-color: rgba(253, 194, 28, 0.1) !important;
  color: #fdc21c !important;
  text-decoration: none !important;
}

body.active .user-menu .dropdown-menu .dropdown-item i,
body.active #user-dropdown-menu .dropdown-item i,
body.active .dropdown-menu .dropdown-item i {
  color: inherit !important;
}

/* ===== DARK MODE STYLES FOR LOGOUT BUTTON ===== */
/* Los estilos del logout button están ahora en index.html para máxima prioridad */

/* ===== LOGIN LINK STYLES (for consistency) ===== */
#login-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px;
  font-size: 23px;
  font-weight: 500;
  color: #333;
  text-decoration: none;
  transition: all 0.3s ease;
  white-space: nowrap;
}

#login-link:hover {
  color: #fdc21c;
  background-color: rgba(253, 194, 28, 0.1);
  transform: translateX(5px);
}

body.active #login-link {
  color: #f1f5f9;
}

body.active #login-link:hover {
  color: #fdc21c;
  background-color: rgba(253, 194, 28, 0.1);
}

/* ===== RESPONSIVE LOGIN LINK ===== */
@media (max-width: 768px) {
  #login-link {
    font-size: 18px;
    padding: 12px 16px; /* Increased padding for better touch target */
    min-height: 48px; /* Minimum touch target size */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
  }
  
  #login-link:hover {
    transform: translateX(3px); /* Reduced transform for mobile */
  }
}

/* ===== SOBRESCRIBIR ESTILOS DEL INDEX.HTML ===== */
/* Los estilos específicos del logout button están ahora en index.html */

/* ===== MOBILE-SPECIFIC STYLES FOR LOGOUT ===== */
@media (max-width: 768px) {
  .user-menu .dropdown-item {
    /* Mejorar el área de toque en móvil */
    min-height: 48px; /* Increased from 44px */
    padding: 18px 24px; /* Increased padding */
    font-size: 18px;
    
    /* Mejorar la respuesta táctil */
    -webkit-tap-highlight-color: rgba(253, 194, 28, 0.3);
    -webkit-touch-callout: none;
    /* DESACTIVADO PARA DESARROLLO */
    /* -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none; */
    
    /* Asegurar que el toque funcione */
    touch-action: manipulation;
    
    /* Better visual feedback */
    border-radius: 8px;
    margin: 4px 8px;
    transition: all 0.2s ease;
  }
  
  .user-menu .dropdown-item:active {
    background-color: rgba(253, 194, 28, 0.25);
    transform: scale(0.96);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  }
  
  .user-menu .dropdown-item:hover {
    background-color: rgba(253, 194, 28, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(253, 194, 28, 0.2);
  }
  
  /* Estilos específicos para el botón de logout en móvil */
  #logout-btn {
    position: relative;
    overflow: visible; /* Show full text on mobile */
    border: 2px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Keep original alignment */
    white-space: nowrap; /* Prevent text wrapping on mobile */
    text-overflow: visible; /* Show full text on mobile */
    width: 100%; /* Ensure full width on mobile */
    box-sizing: border-box; /* Include padding in width calculation */
    padding: 18px 24px !important; /* Mobile-specific padding */
    margin: 0 !important; /* Remove any margins on mobile */
    text-align: left !important; /* Keep original alignment */
  }
  
  #logout-btn:hover {
    border-color: rgba(253, 194, 28, 0.3);
  }
  
  #logout-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.4s ease;
  }
  
  #logout-btn:active::before {
    left: 100%;
  }
  
  /* Improved dropdown positioning for mobile */
  .user-menu .dropdown-menu,
  #user-dropdown-menu {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(253, 194, 28, 0.2);
  }
}
