/**
 * MiloTool Styles
 * Bottom-left pinned button with smooth profession selector
 */

/* Main Container - Pinned to Bottom Left */
.milo-tool {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 99999;
  font-family: "Mikado", sans-serif;
  pointer-events: auto;
}

.milo-tool-container {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  width: auto;
  min-width: 0;
}

/* Main Button */
.milo-tool-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.2s ease;
  text-decoration: none;
  color: inherit;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  width: 220px;
  height: 220px;
}

.milo-tool-button:hover {
  transform: scale(1.05);
}

.milo-tool-icon {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.milo-tool-button:hover .milo-tool-icon {
  box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

.milo-tool-button.active .milo-tool-icon:not(.has-profession) {
  /* Removed rotation to prevent layout shift */
  /* transform: rotate(45deg); */
}

.milo-tool-icon svg {
  width: 36px;
  height: 36px;
  color: #ffffff;
  fill: #ffffff;
}

/* Selected profession image in button */
.milo-tool-icon .milo-tool-profession-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Remove background when icon contains an image */
.milo-tool-icon:has(img),
.milo-tool-icon.has-profession {
  background: transparent !important;
  box-shadow: none !important;
}

.milo-tool-icon.has-profession {
  padding: 0;
}

.milo-tool-label {
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  line-height: 1.2;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  max-width: 100px;
  background: rgba(102, 126, 234, 0.9);
  padding: 5px 10px;
  border-radius: 8px;
}

/* Professions Container - Horizontal Layout */
.milo-professions-container {
  position: relative;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 9999;
  flex-shrink: 0;
}

.milo-professions-container.active {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

.milo-professions-container.layout-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
  margin-left: 20px;
  height: 150px; /* Match bubble height */
  width: auto;
}

/* Background bar for row layout */
.milo-professions-bar {
  position: absolute;
  left: -20px; /* Offset left to account for border-radius */
  bottom: 0;
  height: 150px;
  background: white;
  border-radius: 75px;
  z-index: -1;
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    opacity 0.3s ease, width 0.3s ease;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.milo-professions-container.layout-row.active .milo-professions-bar {
  transform: translateY(0);
  opacity: 1;
}

.milo-professions-container.layout-row .milo-profession-bubble {
  position: relative;
  z-index: 1;
}

.milo-professions-container.layout-wheel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 560px;
  height: 560px;
  margin-left: 0;
  pointer-events: none;
}

.milo-professions-container.layout-wheel.active {
  pointer-events: auto;
}

/* Individual Profession Bubbles */
.milo-profession-bubble {
  position: relative;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: none;
  overflow: visible;
  flex-shrink: 0;

  transform: scale(0);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    opacity 0.3s ease;
}

.milo-profession-bubble.show {
  opacity: 1;
  /* Transform will be managed by JS for position, but we use scale here. 
     Actually, let's just use scale in the class and left/bottom for pos. 
  */
  transform: scale(1);
}

.milo-profession-bubble:hover {
  transform: scale(1.1);
  z-index: 100;
}

.milo-profession-bubble:active {
  transform: scale(1.02);
}

.milo-profession-bubble .bubble-image {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
}

.milo-profession-bubble .bubble-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.milo-profession-bubble .bubble-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
}

.milo-profession-bubble .bubble-placeholder svg {
  width: 36px;
  height: 36px;
  fill: #ffffff;
}

/* Profession Name Tag - Below the bubble */
.milo-profession-bubble-name {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.milo-profession-bubble:hover .milo-profession-bubble-name {
  opacity: 1;
}

/* Reset Button Bubble */
.milo-profession-bubble.reset-bubble {
  background: linear-gradient(135deg, #888 0%, #555 100%);
  width: 60px;
  height: 60px;
  margin: 0 auto;
}

.milo-profession-bubble.reset-bubble svg {
  width: 28px;
  height: 28px;
  fill: #ffffff;
}

.milo-profession-bubble.reset-bubble .milo-profession-bubble-name {
  font-size: 10px;
}

/* Wheel layout positioning */
.milo-professions-container.layout-wheel {
  overflow: visible;
  pointer-events: none;
}

.milo-professions-container.layout-wheel .milo-profession-bubble {
  position: absolute;
  left: 50%;
  top: 50%;
  --wheel-radius: 260px;
  transform: translate(-50%, -50%) scale(0);
}

.milo-professions-container.layout-wheel .milo-profession-bubble.show {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(var(--angle, 0deg))
    translate(var(--wheel-radius)) rotate(calc(-1 * var(--angle, 0deg)))
    scale(1);
}

.milo-professions-container.layout-wheel .milo-profession-bubble:hover {
  transform: translate(-50%, -50%) rotate(var(--angle, 0deg))
    translate(var(--wheel-radius)) rotate(calc(-1 * var(--angle, 0deg)))
    scale(1.08);
}

.milo-professions-container.layout-wheel .milo-profession-bubble:active {
  transform: translate(-50%, -50%) rotate(var(--angle, 0deg))
    translate(var(--wheel-radius)) rotate(calc(-1 * var(--angle, 0deg)))
    scale(1.02);
}

.milo-professions-container.layout-wheel .milo-profession-bubble.reset-bubble {
  --wheel-radius: 0px;
}

.milo-professions-container.layout-wheel
  .milo-profession-bubble.reset-bubble.show {
  transform: translate(-50%, -50%) scale(1);
}

.milo-professions-container.layout-wheel
  .milo-profession-bubble.reset-bubble:hover {
  transform: translate(-50%, -50%) scale(1.08);
}

.milo-professions-container.layout-wheel
  .milo-profession-bubble.reset-bubble:active {
  transform: translate(-50%, -50%) scale(1.02);
}

/* Overlay for closing */
.milo-gooey-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99998;
  display: none;
}

.milo-gooey-overlay.active {
  display: block;
}

/* Hide MiloTool on touch devices - custom cursors aren't useful for touch */
@media (pointer: coarse) {
  .milo-tool,
  .milo-gooey-overlay,
  .milo-professions-container {
    display: none !important;
  }
}

/* Also hide on small screens (mobile) regardless of pointer type */
@media (max-width: 768px) {
  .milo-tool,
  .milo-gooey-overlay,
  .milo-professions-container {
    display: none !important;
  }
}

/* Accessibility */
.milo-tool-button:focus {
  outline: none;
}

.milo-profession-bubble:focus {
  outline: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .milo-tool-button,
  .milo-tool-icon,
  .milo-profession-bubble {
    transition: none;
  }
}

/* ========================================
   NOTIFICATIONS
   ======================================== */

.milo-tool-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 16px 20px;
  z-index: 100002;
  transform: translateX(120%);
  transition: transform 0.3s ease;
  max-width: 300px;
  border-left: 4px solid #667eea;
}

.milo-tool-notification.show {
  transform: translateX(0);
}

.milo-tool-notification-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.milo-tool-notification-message {
  font-family: "Mikado", sans-serif;
  font-size: 14px;
  color: #333333;
  line-height: 1.4;
}

.milo-tool-notification-close {
  background: none;
  border: none;
  font-size: 18px;
  color: #666666;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.milo-tool-notification-close:hover {
  background: #f0f0f0;
  color: #333333;
}

.milo-tool-notification-info {
  border-left-color: #667eea;
}

.milo-tool-notification-success {
  border-left-color: #28a745;
}

.milo-tool-notification-warning {
  border-left-color: #ffc107;
}

.milo-tool-notification-error {
  border-left-color: #dc3545;
}

@media (max-width: 768px) {
  .milo-tool-notification {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }
}
