/* ==========================================================================
   Apple macOS Glass Profile Pill & Security Dropdown
   ========================================================================== */

.apple-profile-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.apple-profile-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 4px 14px 4px 5px;
  border-radius: 9999px;
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
  border: 1px solid rgba(148, 163, 184, 0.55);
  box-shadow:
    0 3px 10px rgba(15, 23, 42, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  outline: none;
}

.apple-profile-trigger:hover {
  background: linear-gradient(180deg, #ffffff 0%, #e2e8f0 100%);
  border-color: rgba(100, 116, 139, 0.55);
  box-shadow:
    0 6px 16px rgba(15, 23, 42, 0.14),
    inset 0 1px 0 #ffffff;
  transform: translateY(-1px);
}

.apple-profile-trigger:active,
.apple-profile-trigger[aria-expanded="true"] {
  transform: translateY(0);
  background: linear-gradient(180deg, #f1f5f9 0%, #cbd5e1 100%);
  box-shadow:
    0 2px 6px rgba(15, 23, 42, 0.12),
    inset 0 1px 2px rgba(15, 23, 42, 0.06);
}

.apple-profile-trigger::after {
  display: none !important;
}

/* Avatar con anillo de seguridad esmeralda y escudo */
.apple-avatar-wrap {
  position: relative;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.apple-avatar-img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid #22c55e;
  box-shadow: 0 0 0 1.5px rgba(34, 197, 94, 0.18);
  display: block;
}

.apple-avatar-shield {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #dcfce7;
  color: #15803d;
  border: 1.5px solid #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Texto del botón superior */
.apple-trigger-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  text-align: left;
}

.apple-trigger-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.015em;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.apple-trigger-secure-pill {
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(203, 213, 225, 0.85);
  font-size: 0.65rem;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.25;
}

.apple-secure-dot {
  width: 6.5px;
  height: 6.5px;
  border-radius: 50%;
  background-color: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.22);
  display: inline-block;
  flex-shrink: 0;
}

/* Popover desplegable estilo macOS Control Center */
.apple-profile-menu {
  width: 318px;
  padding: 1.05rem 1.1rem 0.85rem !important;
  margin-top: 10px !important;
  border-radius: 20px !important;
  background: linear-gradient(
    180deg,
    rgba(222, 228, 236, 0.96) 0%,
    rgba(248, 250, 252, 0.98) 36%,
    rgba(255, 255, 255, 0.99) 100%
  ) !important;
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid rgba(148, 163, 184, 0.5) !important;
  box-shadow:
    0 24px 48px -12px rgba(15, 23, 42, 0.26),
    0 6px 16px -3px rgba(15, 23, 42, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
  animation: appleMenuFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes appleMenuFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.apple-menu-header-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin: 0;
}

.apple-menu-security-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.22rem;
}

.apple-menu-security-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #0f172a;
}

.apple-verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.16rem 0.58rem;
  border-radius: 9999px;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  color: #15803d;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none !important;
}

.apple-verified-badge.inactive {
  background: #fef3c7;
  border-color: #fde68a;
  color: #b45309;
  transition: all 0.15s ease;
}

.apple-verified-badge.inactive:hover {
  background: #fde68a;
  color: #92400e;
}

.apple-menu-meta {
  margin-top: 0.32rem;
  font-size: 0.74rem;
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Tarjeta celeste de Sesión Protegida */
.apple-session-box {
  margin-top: 0.8rem;
  margin-bottom: 0.6rem;
  padding: 0.65rem 0.85rem;
  border-radius: 14px;
  background: linear-gradient(
    135deg,
    rgba(224, 242, 254, 0.82) 0%,
    rgba(207, 250, 254, 0.65) 100%
  );
  border: 1px solid rgba(186, 230, 253, 0.95);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.apple-session-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #0f172a;
}

.apple-session-sub {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #1e293b;
}

/* Elementos de acción del menú */
.apple-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.58rem 0.65rem;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #0f172a !important;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none !important;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.apple-menu-item-left {
  display: inline-flex;
  align-items: center;
  gap: 0.68rem;
}

.apple-menu-item:hover {
  background-color: rgba(15, 23, 42, 0.055);
  color: #0f172a !important;
}

.apple-menu-item.danger {
  color: #b91c1c !important;
}

.apple-menu-item.danger:hover {
  background-color: rgba(239, 68, 68, 0.08);
  color: #991b1b !important;
}

.apple-menu-shortcuts {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 0.72rem;
  font-weight: 500;
  color: #64748b;
  line-height: 1.25;
  letter-spacing: 0.04em;
}

.apple-menu-divider {
  height: 1px;
  background: rgba(148, 163, 184, 0.3);
  margin: 0.4rem 0;
}

@media (max-width: 576px) {
  .apple-trigger-info {
    display: none;
  }

  .apple-profile-trigger {
    padding: 4px;
  }
}
