/* ==========================================================================
   Icon action buttons + soft-pill hover labels (admin table action cells)
   Loaded last in index.html (after dark.css) so these rules win.
   Theme: navy primary #032852 + semantic tints. No new deps; Feather icons.
   ========================================================================== */

/* Row container that sits inside a table action <td> */
.action-btns {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* Keep a status toggle inline (side by side) with the action icons */
.action-btns .main-toggle-group-demo {
  margin: 0;
  display: inline-flex;
  align-items: center;
}

/* The icon button itself */
.action-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background-color: rgba(3, 40, 82, 0.07);
  color: #032852;
  cursor: pointer;
  text-decoration: none;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color 0.18s ease, color 0.18s ease,
    box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.action-btn > i {
  font-size: 15px;
  line-height: 1;
}

.action-btn:hover {
  background-color: rgba(3, 40, 82, 0.14);
  box-shadow: 0 6px 16px rgba(3, 40, 82, 0.18);
  transform: translateY(-1px);
}

.action-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(3, 40, 82, 0.35);
}

/* ---- Semantic variants: tint icon + hover background ---- */
.action-btn--info {
  color: #01b8ff;
  background-color: rgba(1, 184, 255, 0.1);
}
.action-btn--info:hover {
  background-color: rgba(1, 184, 255, 0.18);
  box-shadow: 0 6px 16px rgba(1, 184, 255, 0.22);
}
.action-btn--info:focus-visible {
  box-shadow: 0 0 0 2px rgba(1, 184, 255, 0.4);
}

.action-btn--success {
  color: #19b159;
  background-color: rgba(25, 177, 89, 0.12);
}
.action-btn--success:hover {
  background-color: rgba(25, 177, 89, 0.2);
  box-shadow: 0 6px 16px rgba(25, 177, 89, 0.22);
}
.action-btn--success:focus-visible {
  box-shadow: 0 0 0 2px rgba(25, 177, 89, 0.4);
}

.action-btn--warning {
  color: #ff9b21;
  background-color: rgba(255, 155, 33, 0.12);
}
.action-btn--warning:hover {
  background-color: rgba(255, 155, 33, 0.2);
  box-shadow: 0 6px 16px rgba(255, 155, 33, 0.22);
}
.action-btn--warning:focus-visible {
  box-shadow: 0 0 0 2px rgba(255, 155, 33, 0.4);
}

.action-btn--danger {
  color: #f16d75;
  background-color: rgba(253, 96, 116, 0.12);
}
.action-btn--danger:hover {
  background-color: rgba(253, 96, 116, 0.2);
  box-shadow: 0 6px 16px rgba(253, 96, 116, 0.22);
}
.action-btn--danger:focus-visible {
  box-shadow: 0 0 0 2px rgba(253, 96, 116, 0.4);
}

.action-btn--secondary {
  color: #f1388b;
  background-color: rgba(241, 56, 139, 0.12);
}
.action-btn--secondary:hover {
  background-color: rgba(241, 56, 139, 0.2);
  box-shadow: 0 6px 16px rgba(241, 56, 139, 0.22);
}
.action-btn--secondary:focus-visible {
  box-shadow: 0 0 0 2px rgba(241, 56, 139, 0.4);
}

/* ---- The soft pill label ---- */
.action-btn__tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 30;
  padding: 5px 11px;
  border-radius: 999px;
  background-color: #032852;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%) translateY(4px) scale(0.9);
  transform-origin: bottom center;
  box-shadow: 0 8px 20px rgba(3, 40, 82, 0.28);
  transition: opacity 0.18s ease,
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Caret under the pill */
.action-btn__tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #032852;
}

/* Open the pill on hover / keyboard focus */
.action-btn:hover .action-btn__tip,
.action-btn:focus-visible .action-btn__tip {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

/* ---- Downward variant (fallback for top-row cells that would clip) ---- */
.action-btn__tip--down {
  bottom: auto;
  top: calc(100% + 8px);
  transform: translateX(-50%) translateY(-4px) scale(0.9);
  transform-origin: top center;
}
.action-btn__tip--down::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: #032852;
}
.action-btn:hover .action-btn__tip--down,
.action-btn:focus-visible .action-btn__tip--down {
  transform: translateX(-50%) translateY(0) scale(1);
}

/* ==========================================================================
   Dark mode (body.dark-theme) — consistent with dark.css
   ========================================================================== */
body.dark-theme .action-btn {
  background-color: rgba(255, 255, 255, 0.06);
  color: #e6e6ea;
}
body.dark-theme .action-btn:hover {
  background-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

body.dark-theme .action-btn--info {
  color: #4fd0ff;
  background-color: rgba(1, 184, 255, 0.16);
}
body.dark-theme .action-btn--success {
  color: #4fd08a;
  background-color: rgba(25, 177, 89, 0.18);
}
body.dark-theme .action-btn--warning {
  color: #ffb451;
  background-color: rgba(255, 155, 33, 0.18);
}
body.dark-theme .action-btn--danger {
  color: #ff8a91;
  background-color: rgba(253, 96, 116, 0.18);
}
body.dark-theme .action-btn--secondary {
  color: #ff70ad;
  background-color: rgba(241, 56, 139, 0.18);
}

body.dark-theme .action-btn__tip {
  background-color: #2a2a3a;
  color: #f4f4f8;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}
body.dark-theme .action-btn__tip::after {
  border-top-color: #2a2a3a;
}
body.dark-theme .action-btn__tip--down::after {
  border-top-color: transparent;
  border-bottom-color: #2a2a3a;
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .action-btn,
  .action-btn__tip {
    transition: none;
  }
}
