/* Button Component Styles */
.btn {
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    transition: background-color 0.15s ease;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.9rem;
}

.btn-save {
    background: #28a745;
    color: white;
    display: block;
    margin-left: auto;
    margin-top: 0.5rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    width: auto;
}

.btn-save:hover {
    background: #218838;
}

.button-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.button-tooltip-container {
  position: relative;
  display: inline-block;
}

.button-tooltip {
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #1f2937;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 1000;
  pointer-events: none;
}

.button-tooltip-container:hover .button-tooltip,
.button-tooltip-container:focus-within .button-tooltip {
  opacity: 1;
  visibility: visible;
}


/* Permission tooltip for disabled buttons */
.permission-tooltip {
    display: none;
    position: absolute;
    top: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1f2937;
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    white-space: normal;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
    width: max-content;
    max-width: 300px;
    word-wrap: break-word;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    pointer-events: auto;
}

.permission-tooltip::after {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: #1f2937;
}

/* Show tooltip when hovering the wrapper or the tooltip itself */
.permission-tooltip:hover {
    opacity: 1;
    visibility: visible;
}

/* Prefer permission tooltip when button is disabled */
.button-tooltip-container:hover > button[disabled] ~ .permission-tooltip {
    display: block;
    opacity: 1;
    visibility: visible;
}

/* Suppress standard tooltip when disabled */
.button-tooltip-container:hover > button[disabled] ~ .button-tooltip {
    opacity: 0;
    visibility: hidden;
}