/**
 * Estilos para Menú de Usuario y Vistas de Perfil/Suscripciones
 */

/* Menú desplegable de usuario */
.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #FFFFFF;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  min-width: 240px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  z-index: 1000;
  overflow: hidden;
}

.user-menu-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Header del menú con info del usuario */
.user-menu-header {
  padding: 16px;
  border-bottom: 1px solid var(--color-surface-variant);
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: white;
}

.user-menu-name {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu-email {
  font-size: 13px;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Items del menú */
.user-menu-items {
  padding: 8px 0;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--color-text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-size: 14px;
  font-family: inherit;
}

.user-menu-item:hover {
  background: var(--color-surface-variant);
}

.user-menu-item svg {
  width: 20px;
  height: 20px;
  opacity: 0.7;
}

.user-menu-item.danger {
  color: var(--color-danger);
}

.user-menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* Indicador de usuario autenticado en header */
.profile-btn.authenticated {
  background: var(--color-primary);
  color: white;
}

.profile-btn.authenticated:hover {
  background: var(--color-primary-dark, #1d4ed8);
}

/* Vista de Perfil */
.profile-view {
  padding: 24px 0;
}

.profile-header {
  text-align: center;
  margin-bottom: 32px;
}

.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: white;
  font-size: 40px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.profile-name {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 4px;
}

.profile-email {
  font-size: 14px;
  color: var(--color-text-secondary);
}

.profile-info-card {
  background: var(--color-surface);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.profile-info-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 16px;
}

.profile-info-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-surface-variant);
}

.profile-info-item:last-child {
  border-bottom: none;
}

.profile-info-label {
  font-size: 14px;
  color: var(--color-text-secondary);
}

.profile-info-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
}

/* Vista de Suscripciones */
.subscriptions-view {
  padding: 24px 0;
}

.subscription-card {
  background: var(--color-surface);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
  border: 2px solid var(--color-surface-variant);
}

.subscription-card.active {
  border-color: var(--color-primary);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(168, 85, 247, 0.05));
}

.subscription-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 16px;
}

.subscription-plan-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 4px;
}

.subscription-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: #10b981;
  color: white;
}

.subscription-status.inactive {
  background: var(--color-text-secondary);
}

.subscription-price {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 16px;
}

.subscription-price span {
  font-size: 16px;
  color: var(--color-text-secondary);
  font-weight: 400;
}

.subscription-features {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
}

.subscription-features li {
  padding: 8px 0;
  color: var(--color-text-secondary);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.subscription-features li::before {
  content: '✓';
  color: #10b981;
  font-weight: 700;
  font-size: 16px;
}

.subscription-renewal {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
}

/* Vista de Ajustes */
.app-settings-view {
  padding: 24px 0;
}

.settings-section {
  margin-bottom: 32px;
}

.settings-section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 16px;
}

.settings-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--color-surface, #fff);
  border-radius: 8px;
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
}

.settings-item-info {
  flex: 1;
}

.settings-item-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 4px;
}

.settings-item-description {
  font-size: 13px;
  color: var(--color-text-secondary);
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  width: 48px;
  height: 28px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1; /* Gris más visible para estado desactivado */
  transition: 0.3s;
  border-radius: 28px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--color-primary);
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* Select personalizado */
.settings-select {
  padding: 8px 12px;
  border: 2px solid var(--color-surface-variant);
  border-radius: 8px;
  background: var(--color-background);
  color: var(--color-text-primary);
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}

.settings-select:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Responsive */
@media (max-width: 768px) {
  .user-menu-dropdown {
    right: -8px;
    min-width: 220px;
  }

  .subscription-card {
    padding: 20px;
  }

  .subscription-plan-name {
    font-size: 18px;
  }

  .subscription-price {
    font-size: 24px;
  }
}
