/* The itinerary share menu's look (ShareItineraryMenu.svelte), wherever it is
   used: the map's itinerary panel, and the partner page's Itineraries tab
   (the owner, 2026-11-07: "reuse the same component"). Moved here from
   map/ItineraryPanel.css, which only the map loads. */

/* Share Menu Dropdown */
.share-menu-container {
  position: relative;
}

.share-menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 100;
  min-width: 220px;
  margin-top: 8px;
  overflow: hidden;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgb(0 0 0 / 15%);
}

.share-menu-item {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  text-align: left;
  cursor: pointer;
  background: none;
  border: none;
  transition: background-color 0.2s;
}

.share-menu-item:hover {
  background-color: #f5f5f5;
}

.share-menu-item:not(:last-child) {
  border-bottom: 1px solid #e8e8e8;
}

.share-menu-item .material-symbols-outlined {
  font-size: 20px;
  color: #666;
}

.share-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99;
  cursor: default;
  background: transparent;
  border: none;
}

.share-menu-item:disabled {
  cursor: default;
  opacity: 0.7;
}

.share-menu-item:disabled:hover {
  background-color: transparent;
}

/* U2 (pre-launch fixes) — visible help text under the "Add to plan" label
   when the user is signed in but not authorized (not the Skipper and not
   TEAM/ADMIN). The hint sits in a column with the label. */
.share-menu-item-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
}

.share-menu-item-label {
  line-height: 1.3;
}

.share-menu-item-hint {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.3;
  color: #777;
}

/* U2 — "blocked" disabled state (vs. the neutral in-flight disabled).
   Used when the user lacks permission to add the itinerary to the plan. */
.share-menu-item-blocked,
.share-menu-item-blocked:hover {
  color: #777;
  cursor: not-allowed;
  background-color: transparent;
}

.share-menu-item-blocked .material-symbols-outlined {
  color: #999;
}

.share-menu-section {
  padding: 12px 16px;
}

.share-menu-section-title {
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.share-menu-section-subtitle {
  margin-bottom: 12px;
  font-size: 12px;
  line-height: 1.4;
  color: #888;
}

.share-menu-loading,
.share-menu-empty {
  padding: 8px 0;
  font-size: 13px;
  color: #888;
}

.share-menu-bookings {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.share-menu-booking-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px;
  cursor: pointer;
  border-radius: 8px;
  transition: background-color 0.15s;
}

.share-menu-booking-item:hover {
  background-color: #f5f5f5;
}

.share-menu-booking-item input[type="checkbox"] {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: #4caf50;
  cursor: pointer;
}

.share-menu-booking-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.share-menu-booking-yacht {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  white-space: nowrap;
}

.share-menu-booking-dates {
  font-size: 12px;
  color: #666;
}

.share-menu-divider {
  height: 1px;
  margin: 0;
  background-color: #e8e8e8;
}

/* Share menu toggle item (for isDemo toggle) */
.share-menu-toggle-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px;
  cursor: pointer;
  border-radius: 8px;
  transition: background-color 0.15s;
}

.share-menu-toggle-item:hover {
  background-color: #f5f5f5;
}

.share-menu-toggle-item input[type="checkbox"] {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: #2196f3;
  cursor: pointer;
}

.share-menu-toggle-item input[type="checkbox"]:disabled {
  cursor: wait;
  opacity: 0.5;
}

.share-menu-toggle-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.share-menu-toggle-label {
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

.share-menu-toggle-description {
  font-size: 12px;
  line-height: 1.4;
  color: #666;
}

/* Dark: the white surface is unreadable there; the panel's own palette. */
html.dark .share-menu-dropdown {
  color: #f3f4f6;
  background-color: #374151;
}

html.dark .share-menu-item {
  color: #f3f4f6;
}

html.dark .share-menu-item:hover {
  background-color: #4b5563;
}

/* The Brochure row's submenu: its display options, indented under it (the owner, 2026-11-16). */
.share-menu-chevron {
  margin-inline-start: auto;
  transition: transform 0.15s ease;
}

.share-menu-chevron-open {
  transform: rotate(90deg);
}

[dir='rtl'] .share-menu-chevron:not(.share-menu-chevron-open) {
  transform: scaleX(-1);
}

.share-menu-sub {
  padding-inline-start: 1.25rem;
  background: rgb(0 0 0 / 3%);
}

html.dark .share-menu-sub {
  background: rgb(255 255 255 / 4%);
}

.share-menu-sub-item .material-symbols-outlined {
  font-size: 1.05rem;
}

  /* Copy link / Print PDF waiting on the server: the icon turns. */
  .share-menu-spin.svelte-y3lorf {
    animation: svelte-y3lorf-share-menu-spin 0.9s linear infinite;
  }

  @keyframes svelte-y3lorf-share-menu-spin {
    to { transform: rotate(360deg); }
  }

  @media (prefers-reduced-motion: reduce) {
    .share-menu-spin.svelte-y3lorf {
      animation: none;
    }
  }

  /* The menu's LOOK is the app's, not this component's: every `.share-menu-*`
     rule below the container lives in
     routes/[[t=t]]/(unlogged)/map/ItineraryPanel.css, which that panel
     @imports into a global sheet. Re-declaring them here would silently WIN
     (a Svelte-scoped selector outranks the plain global one) and restyle a
     shipped menu for no reason. So this block carries only what the global
     sheet has no rule for. */

  /* Anchored INSIDE the tile so the dropdown cannot be half-cut at the bottom
     edge of the scrolling list. `position: relative` is also in the global
     sheet; the inline-flex is what keeps the trigger sized to its icon when
     the menu sits in a tile's control cluster rather than a toolbar. */
  .share-menu-container.svelte-y3lorf {
    display: inline-flex;
  }

  /* Opened upward (placeMenu): above the trigger, when below would cut it off. */
  .share-menu-dropdown.share-menu-up.svelte-y3lorf {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 8px;
  }

  /* Row 3: a status, not a button — so it gets the item's layout without the
     button affordances. */
  .share-menu-status.svelte-y3lorf {
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: default;
    opacity: 0.75;
  }

  /* Per-itinerary failure copy. Inline rather than a toast: a toast is global
     state, and the whole point of U17 is that one tile's failure must not
     appear to belong to another's menu. */
  .share-menu-error.svelte-y3lorf {
    padding: 4px 16px 8px;
    color: #ef4444;
    font-size: 13px;
  }

  /* U18's touch-target floor, additive over the global padding. */
  .share-menu-item.svelte-y3lorf,
  .share-menu-toggle-item.svelte-y3lorf {
    min-height: 44px;
  }

