/* 
 * Button Styles
 * Contains styles for buttons, CTAs, and interactive elements
 */

/* Basic Button */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* Primary Button */
.button.primary {
    background: var(--primary-color);
    color: white;
    z-index: 1;
    transition: all 0.3s ease, transform 0.2s ease;
}

.button.primary:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.button.primary:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Secondary Button */
.button.secondary {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.button.secondary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* CTA Button */
.cta-button {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.cta-button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.cta-button.primary {
    background: var(--primary-color);
}

.cta-button.secondary {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.cta-button.secondary:hover {
    background: var(--primary-color);
    color: white;
}

/* Learn More Link */
.learn-more {
    color: var(--primary-color);
    font-weight: 600;
    position: relative;
}

.learn-more::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.learn-more:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* Preview Button */
.preview-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.2rem;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    color: var(--text-color);
}

.preview-btn:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
    transform: translateY(-2px);
}

.preview-btn:focus {
    box-shadow: 0 0 0 2px var(--background-color), 0 0 0 4px var(--primary-color);
    outline: none;
}

.preview-btn::before {
    content: "👁️";
    font-size: 1rem;
}

/* Submit Button */
.submit-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem;
    margin-top: 1rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.submit-btn:active {
    transform: translateY(1px);
}

.submit-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.submit-btn:hover::after {
    width: 300px;
    height: 300px;
}

/* Back to Top Button */
#backToTop {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--primary-color);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    border: none;
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 99; /* Lower z-index than side panel */
}

#backToTop.visible {
    opacity: 1;
    visibility: visible;
}

#backToTop:hover {
    background: var(--secondary-color);
    transform: translateY(-5px);
}

/* Button States */
.button:disabled,
.cta-button:disabled,
.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Button Loading State */
.button.loading, 
.cta-button.loading {
    position: relative;
    pointer-events: none;
}

.button.loading span, 
.cta-button.loading span {
    visibility: hidden;
}

.button.loading::after, 
.cta-button.loading::after {
    content: '';
    position: absolute;
    width: 1.25rem;
    height: 1.25rem;
    top: calc(50% - 0.625rem);
    left: calc(50% - 0.625rem);
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: button-loading-spinner 0.8s ease infinite;
}

@keyframes button-loading-spinner {
    from {
        transform: rotate(0turn);
    }
    to {
        transform: rotate(1turn);
    }
}

.loading-spinner {
    animation: spin 1.5s linear infinite;
}

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

/* Ripple Effect */
.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
    width: 100px;
    height: 100px;
    margin-top: -50px;
    margin-left: -50px;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}


/* Media query for mobile devices */
@media (max-width: 768px) {
    /* Adjust positions for mobile */
    #backToTop {
        bottom: 2rem;
        right: 5.5rem; /* Position to the left of the side panel toggle */
        width: 45px;
        height: 45px;
    }
}

/* Alternative layout for very small screens */
@media (max-width: 350px) {
    #backToTop {
        bottom: 5.5rem; /* Stack vertically on very small screens */
        right: 2rem;
    }
}