.magiclink-webhook-btn {
    background-color: #0073aa;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.magiclink-webhook-btn:hover {
    background-color: #005a87;
}

.magiclink-webhook-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.magiclink-webhook-btn.sending {
    background-color: #ffb900;
    position: relative;
}

.magiclink-webhook-btn.sending:after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: magiclink-spin 1s linear infinite;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
}

.magiclink-webhook-btn.sent {
    background-color: #46b450;
}

.magiclink-webhook-btn.error {
    background-color: #dc3232;
}

.magiclink-webhook-btn.hidden-success {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

@keyframes magiclink-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Loading Overlay Styles - Base */
.magiclink-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.magiclink-overlay.active {
    opacity: 1;
    visibility: visible;
    display: flex !important;
}

.magiclink-overlay-content {
    text-align: center;
    color: #ffffff;
    padding: 40px;
    max-width: 500px;
}

/* Spinner Container - holds spinner and icon */
.magiclink-spinner-container {
    position: relative;
    display: inline-block;
    margin-bottom: 30px;
}

.magiclink-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: magiclink-spin 1s linear infinite;
}

/* Spinner Icon - centered in spinner */
.magiclink-spinner-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    object-fit: contain;
    border-radius: 50%;
}

/* Icon Animation Keyframes */
@keyframes magiclink-icon-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
}

@keyframes magiclink-icon-bounce {
    0%, 100% { transform: translate(-50%, -50%) translateY(0); }
    50% { transform: translate(-50%, -50%) translateY(-8px); }
}

@keyframes magiclink-icon-rotate {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes magiclink-icon-fade {
    0%, 100% { opacity: 1; transform: translate(-50%, -50%); }
    50% { opacity: 0.3; transform: translate(-50%, -50%); }
}

@keyframes magiclink-icon-shake {
    0%, 100% { transform: translate(-50%, -50%) translateX(0); }
    25% { transform: translate(-50%, -50%) translateX(-5px); }
    75% { transform: translate(-50%, -50%) translateX(5px); }
}

@keyframes magiclink-icon-flip {
    0% { transform: translate(-50%, -50%) perspective(400px) rotateY(0); }
    100% { transform: translate(-50%, -50%) perspective(400px) rotateY(360deg); }
}

.magiclink-overlay-title {
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: #ffffff;
    letter-spacing: -0.5px;
    min-height: 1.2em;
}

.magiclink-overlay-subtext {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
    line-height: 1.5;
    min-height: 1.5em;
}

/* Typewriter cursor */
.magiclink-overlay-title.typewriter::after,
.magiclink-overlay-subtext.typewriter::after {
    content: '|';
    animation: magiclink-blink 0.7s infinite;
    margin-left: 2px;
}

@keyframes magiclink-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Overlay with success state */
.magiclink-overlay.success .magiclink-spinner {
    border-color: #46b450;
    border-top-color: #46b450;
    animation: none;
}

.magiclink-overlay.success .magiclink-spinner:after {
    content: "✓";
    display: block;
    font-size: 30px;
    line-height: 52px;
    color: #46b450;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.magiclink-overlay.success .magiclink-spinner-icon,
.magiclink-overlay.error .magiclink-spinner-icon {
    display: none;
}

/* Overlay with error state */
.magiclink-overlay.error .magiclink-spinner {
    border-color: #dc3232;
    border-top-color: #dc3232;
    animation: none;
}

.magiclink-overlay.error .magiclink-spinner:after {
    content: "✕";
    display: block;
    font-size: 30px;
    line-height: 52px;
    color: #dc3232;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Pulse animation for overlay content */
@keyframes magiclink-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.magiclink-overlay.active:not(.success):not(.error) .magiclink-overlay-content {
    animation: magiclink-pulse 2s ease-in-out infinite;
}

/* Remove dots animation - now handled by JS typewriter */
.magiclink-overlay-title:after {
    content: none;
    animation: none;
}

/* Tooltip Base Styles */
.magiclink-webhook-btn[data-tooltip] {
    position: relative;
    overflow: visible;
}

.magiclink-webhook-btn[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    padding: 8px 12px;
    background-color: #333;
    color: #fff;
    font-size: 13px;
    font-weight: normal;
    line-height: 1.4;
    white-space: normal;
    text-align: center;
    border-radius: 4px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    max-width: 250px;
    word-wrap: break-word;
}

.magiclink-webhook-btn[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 2px;
    border: 6px solid transparent;
    border-top-color: #333;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
    pointer-events: none;
}

.magiclink-webhook-btn[data-tooltip]:hover::before,
.magiclink-webhook-btn[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Prevent tooltip from showing when button is disabled/processing */
.magiclink-webhook-btn[data-tooltip].sending::before,
.magiclink-webhook-btn[data-tooltip].sending::after,
.magiclink-webhook-btn[data-tooltip]:disabled::before,
.magiclink-webhook-btn[data-tooltip]:disabled::after {
    opacity: 0;
    visibility: hidden;
}
