/* Custom Button Builder Frontend Styles */

.cbb-custom-button {
    display: inline-block;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    border: none;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.2;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
    position: relative;
    overflow: hidden;
}

.cbb-custom-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 186, 0.3) !important;
}

.cbb-custom-button:active {
    transform: translateY(1px);
}

.cbb-custom-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Button animations */
.cbb-custom-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transition: width 0.6s, height 0.6s, top 0.6s, left 0.6s;
    transform: translate(-50%, -50%);
    z-index: 0;
}

.cbb-custom-button:active::before {
    width: 300px;
    height: 300px;
    top: 50%;
    left: 50%;
}

.cbb-custom-button > * {
    position: relative;
    z-index: 1;
}

/* Responsive behavior */
@media screen and (max-width: 768px) {
    .cbb-custom-button {
        width: 100%;
        max-width: 300px;
        margin: 5px auto;
        display: block;
    }
}

/* Loading state */
.cbb-custom-button.loading {
    pointer-events: none;
    opacity: 0.7;
}

.cbb-custom-button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: cbb-spin 1s linear infinite;
    z-index: 2;
}

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

/* Accessibility improvements */
.cbb-custom-button:focus-visible {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .cbb-custom-button {
        border: 2px solid currentColor !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .cbb-custom-button,
    .cbb-custom-button::before,
    .cbb-custom-button.loading::after {
        transition: none !important;
        animation: none !important;
    }
}

/* Print styles */
@media print {
    .cbb-custom-button {
        border: 1px solid #000 !important;
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
    }
    
    .cbb-custom-button::before,
    .cbb-custom-button::after {
        display: none !important;
    }
}