/* StagesPanel.css - Styles for League Stages Accordion */

/* Ensure flex container fills width */
.content-private .d-flex.flex-column.gap-2 {
  width: 100%;
}

/* Container for each stage item */
.stage-item-container {
  margin-bottom: 15px;
  border-radius: 12px;
  overflow: visible;
  transition: all 0.3s ease;
  /* Allow dropdowns to escape when stage is expanded */
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* When stage is expanded, allow overflow for dropdowns */
.stage-item-container.expanded {
  overflow: visible !important;
}

/* Header row styling */
.stage-row-header {
  position: relative;
  transition: all 0.3s ease;
  padding: 1rem !important;
  width: 100%;
  flex-shrink: 0;
  min-height: auto;
}


/* Expanded content container */
.stage-expanded-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 0 0 12px 12px;
  width: 100%;
  position: relative;
}

.stage-expanded-content.expanded {
  max-height: none;
  /* Allow unlimited height for content */
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  /* Allow dropdowns to escape overflow constraints when fully expanded */
  overflow: visible !important;
}

/* Ensure animation still works by clipping only during transition */
.stage-expanded-content:not(.expanded) {
  overflow: hidden;
}

/* Content wrapper inside expanded section */
.stage-info-wrapper {
  padding: 0;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease 0.1s, transform 0.3s ease 0.1s;
}

.stage-expanded-content.expanded .stage-info-wrapper {
  opacity: 1;
  transform: translateY(0);
}

/* Progress bar animation */
.stage-progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 0.5rem;
  position: relative;
}

.stage-progress-fill {
  height: 100%;
  background: linear-gradient(to right, #F5484D, #dc2626);
  transition: width 1s linear;
  position: relative;
  overflow: hidden;
  will-change: width;
}

/* Subtle glow effect instead of shimmer */
.stage-progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to right,
      transparent 0%,
      rgba(255, 255, 255, 0.1) 50%,
      transparent 100%);
  opacity: 0.5;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .stage-info-wrapper {
    padding: 0;
  }

  /* Play mode padding (default) */
  .stage-row-header {
    padding: 1rem 0px 1rem 0.25rem !important;
    /* Changed left padding from 0.75rem to 0.25rem */
  }

  /* Edit mode padding (reduced) */
  .stage-row-header.editing-mode {
    padding: 0px 0px 0px 0.25rem !important;
    /* Changed left padding from 0.75rem to 0.25rem */
  }

  .stage-item-container.stage-item {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }

  /* Ensure proper text truncation on mobile */
  .stage-name-wrapper {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
  }

  /* Override Bootstrap .mb-3 margin for add-stage button */
  .add-stage-slot-btn.mb-3 {
    margin-bottom: 10px !important;
  }

  /* Add horizontal spacing to add-stage button */
  .add-stage-slot-btn {
    margin-left: 0.25rem !important;
    margin-right: 0.25rem !important;
    width: calc(100% - 0.5rem) !important;
    /* Adjust width to account for margins */
  }

  /* ----------------------------------------
     PLAY MODE - Single Row Layout
     ---------------------------------------- */

  .stage-row-header:not(.editing-mode) {
    display: flex;
    align-items: center;
    flex-wrap: nowrap !important;
  }

  /* Number - first element */
  .stage-row-header:not(.editing-mode) .stage-number {
    flex: 0 0 auto;
    margin-right: 0px;
    /* Changed from 0.5rem - no space between number and name */
  }

  /* Name - takes available space */
  .stage-row-header:not(.editing-mode) .stage-name-container {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
  }

  /* Live badge - pushed to right */
  .stage-row-header:not(.editing-mode) .live-badge-pulsing {
    margin-left: auto;
    margin-right: 1rem;
  }

  /* ----------------------------------------
     EDIT MODE - Single Row Layout (actions at right)
     ---------------------------------------- */

  .stage-row-header.editing-mode {
    display: flex;
    align-items: center;
    flex-wrap: nowrap !important;
  }

  /* Number */
  .stage-row-header.editing-mode .stage-number {
    flex: 0 0 auto;
    margin-right: 0px;
    /* Changed from 0.5rem - no space between number and name */
  }

  /* Name - takes available space */
  .stage-row-header.editing-mode .stage-name-container {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
  }

  /* Badge - after name, before actions */
  .stage-row-header.editing-mode .mobile-badge-column {
    flex: 0 0 auto;
    margin-left: 0.5rem;
    margin-right: 1rem;
    /* 1rem space before actions */
  }

  /* Actions container - at extreme right */
  .stage-row-header.editing-mode .mobile-actions-container {
    flex: 0 0 auto;
    /* Grid handles internal 2x2 layout */
  }
}

/* ============================================
   BOULDER STATUS BADGES (from BetaManager)
   ============================================ */
.boulder-status-badge {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  /* NOT 50% - rectangular with small rounded corners */
  display: inline-block;
}

.boulder-status-badge.draft {
  background: rgba(255, 255, 255, 0.2);
  color: #a3a3a3;
}

.boulder-status-badge.published {
  background: #9AD746;
  color: #000000;
}

/* Mobile badge column */
.mobile-badge-column {
  display: flex;
  align-items: center;
}

@media (max-width: 768px) {
  .mobile-badge-column {
    justify-content: flex-end;
  }
}

/* Hover effects */

/* Status badge animations */
.stage-status-badge {
  display: inline-block;
  transition: all 0.2s ease;
}

.stage-item-container:hover .stage-status-badge {
  transform: scale(1.05);
}

/* Ping animation for LIVE badge */
@keyframes ping {

  75%,
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* Pulsing animation for the entire LIVE badge */
@keyframes pulse-live {

  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(245, 72, 77, 0.4);
  }

  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(245, 72, 77, 0);
  }
}

/* LIVE badge pulsing class */
.live-badge-pulsing {
  animation: pulse-live 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  transform-origin: center;
  will-change: transform, box-shadow;
  position: relative;
  display: inline-flex !important;
}

/* Progress bar container styling */
.stage-progress-container {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
}

/* Ensure stage items are structured correctly */
.stage-item {
  display: block;
  width: 100%;
  padding: 0 !important;
  /* Remove any padding */
}

/* Fix flex layout issues */
.stage-row-header.d-flex {
  width: 100% !important;
  flex-wrap: nowrap !important;
}

/* Fix for dropdown menu in expanded stages */
.stage-expanded-content .position-relative {
  /* Ensure dropdown container has proper stacking context */
  z-index: 10;
}

/* Ensure dropdown menu is not clipped */
.stage-expanded-content .dropdown-menu {
  /* Override any inherited overflow */
  position: absolute !important;
  z-index: 1050 !important;
  /* Higher than other elements */
}

/* Ensure gear button container allows overflow */
.stage-expanded-content .position-relative:has(.dropdown-menu) {
  overflow: visible !important;
}

/* Additional fix for the gear button's parent container */
.stage-expanded-content .rumble-info-top .position-relative {
  /* Allow overflow for dropdown */
  overflow: visible !important;
}

/* Event type icon styling */
.event-type-icon {
  width: 24px;
  height: 24px;
  min-width: 24px;
  transition: transform 0.2s ease;
}

.stage-row-header:hover .event-type-icon {
  transform: scale(1.1);
}

/* Desktop layout column spacing */
@media (min-width: 768px) {
  .stage-row-header .d-md-flex>div {
    padding-right: 1rem;
  }

  .stage-row-header .d-md-flex>div:last-child {
    padding-right: 0;
  }
}

/* Mobile text sizing */
@media (max-width: 767px) {
  .stage-row-header .small {
    font-size: 0.8125rem;
  }

  .stage-row-header .text-muted {
    opacity: 0.7;
  }
}

/* Accordion animation for LeagueSetting stages */
.stage-item .stage-expanded-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.stage-item.expanded .stage-expanded-content {
  max-height: none;
  /* Allow unlimited height for content */
}

/* ============================================
   ADD STAGE BUTTON (from Beta Manager)
   ============================================ */
.add-stage-slot-btn {
  width: 100%;
  height: 64px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  /* Changed from 12px to match Beta Manager */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 16px;
  font-weight: 500;
  transition: all 0.3s ease;
  cursor: pointer;
  padding: 0;
  outline: none;
}

.add-stage-slot-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.8);
}

.add-stage-slot-btn:hover svg {
  transform: scale(1.1);
}

.add-stage-slot-btn svg {
  transition: transform 0.3s ease;
}

.add-stage-slot-btn:focus-visible {
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

/* Stage action buttons (icon buttons) */
.stage-action-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  width: 42px;
  height: 42px;
  border-radius: 8px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.8);
  transition: all 0.2s ease;
  cursor: pointer;
  outline: none;
}

.stage-action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.3);
}

.stage-action-btn:focus-visible {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

/* Stage edit button */
.stage-edit-btn {
  background: linear-gradient(to right, #9747FF, #7c3aed);
  border: none;
  color: white;
  height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.stage-edit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(151, 71, 255, 0.3);
}

.stage-edit-btn:focus-visible {
  box-shadow: 0 0 0 2px rgba(151, 71, 255, 0.4);
}

/* Mobile adjustments */
@media (max-width: 576px) {
  .stage-action-btn-mobile {
    width: 36px;
    height: 36px;
  }

  .stage-edit-btn-mobile {
    height: 32px;
    padding: 0 12px;
    font-size: 14px;
  }

  .add-stage-slot-btn {
    height: 56px;
    font-size: 15px;
  }
}

/* Hide overlays in accordion stage maps */
.expanded-content .rum-data-new-style-container .badge-overlay-container {
  display: none !important;
}

.expanded-content .rum-data-new-style-container .position-absolute.bottom-0 {
  display: none !important;
}

/* Keep only the map style toggle visible */
.expanded-content .rum-data-new-style-container .map-style-toggle-pill {
  display: flex !important;
}

/* Hide additional content wrapper in expanded stage accordions */
.stage-expanded-content.expanded .px-3.pt-3.pb-2 {
  display: none !important;
}

/* Inline rename styles */
.inline-rename-input {
  max-width: 250px;
  background-color: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  color: white !important;
  font-weight: 600;
}

.inline-rename-input:focus {
  background-color: rgba(255, 255, 255, 0.15) !important;
  border-color: #9AD746 !important;
  box-shadow: 0 0 0 0.2rem rgba(185, 255, 102, 0.25) !important;
  outline: none;
}

/* Stage name wrapper for inline editing */
.stage-name-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  position: relative;
}

.stage-name-wrapper.editable {
  cursor: pointer;
}

.stage-name-wrapper.editable:hover {
  background-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.stage-name-wrapper .edit-icon {
  opacity: 0;
  transition: opacity 0.2s ease;
  color: #9AD746;
}

.stage-name-wrapper.editable:hover .edit-icon {
  opacity: 1;
}

/* Stage title truncation and scroll animation */
.stage-name-wrapper {
  flex: 1;
  min-width: 0;
  /* Allow flex item to shrink below content size */
  max-width: 100%;
  overflow: hidden;
}

/* Override the fixed width from sponsor styles */
.stage-name-wrapper .sponsor-marquee-text-truncate {
  max-width: 100% !important;
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* Scroll animation on hover when text is overflowing - DISABLED to allow TruncatedText to handle it */
.stage-row-header:hover .stage-name-wrapper .sponsor-marquee-text-truncate.is-overflowing {
  /* animation: scrollStageTitle 8s linear infinite; */
  text-overflow: clip !important;
  /* Keep original width - don't expand */
}

/* Simple scroll animation like address */
@keyframes scrollStageTitle {

  0%,
  10% {
    transform: translateX(0);
  }

  40%,
  50% {
    transform: translateX(calc(-100% + 200px));
    /* Show all text with margin */
  }

  80%,
  90% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(0);
  }
}

/* Ensure animation is smooth */
.stage-name-wrapper .sponsor-marquee-text-truncate {
  transition: none;
  /* Remove transition for smooth animation */
  will-change: transform;
}

/* Mobile adjustments for stage title */
@media (max-width: 768px) {
  .stage-row-header:hover .stage-name-wrapper .sponsor-marquee-text-truncate.is-overflowing {
    /* animation: scrollStageTitleMobile 8s linear infinite; */
    text-overflow: clip !important;
    /* Keep original width - don't expand */
  }

  @keyframes scrollStageTitleMobile {

    0%,
    10% {
      transform: translateX(0);
    }

    40%,
    50% {
      transform: translateX(calc(-100% + 150px));
      /* Show all text with margin */
    }

    80%,
    90% {
      transform: translateX(0);
    }

    100% {
      transform: translateX(0);
    }
  }
}