/**
 * Frontend CSS for FV Woo Product Page & Brochure Buttons.
 */

/* Container for custom buttons - ensures proper alignment */
.fv-custom-buttons-wrapper {
    display: flex;
    gap: 0.75em;
    margin-top: 1em;
    flex-wrap: wrap;
    align-items: center;
}

/* Primary Product Page button */
.fv-product-page-button.primary {
    display: inline-block;
    padding: 0.618em 1.2em;
    font-size: 1em;
    line-height: 1.4;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: 2px solid #0073aa;
    border-radius: 3px;
    background-color: #0073aa;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
    vertical-align: middle;
    order: 1;
}

.fv-product-page-button.primary:hover {
    background-color: #005a87;
    border-color: #005a87;
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
}

.fv-product-page-button.primary:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.3);
}

/* Secondary Brochure button */
.fv-brochure-button.secondary {
    display: inline-block;
    padding: 0.618em 1.2em;
    font-size: 0.95em;
    line-height: 1.4;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: 2px solid #666;
    border-radius: 3px;
    background-color: transparent;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
    vertical-align: middle;
    order: 2;
}

.fv-brochure-button.secondary:hover {
    background-color: #666;
    border-color: #666;
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
}

.fv-brochure-button.secondary:focus {
    outline: 2px solid #666;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px rgba(102, 102, 102, 0.3);
}

/* Ensure proper alignment in different themes */
.woocommerce .fv-custom-buttons-wrapper {
    margin-bottom: 1em;
    clear: both;
}

/* When Add to Cart is hidden, ensure buttons take proper space */
.woocommerce .single_add_to_cart_button[style*="display: none"] ~ .fv-custom-buttons-wrapper {
    margin-top: 0;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    .fv-custom-buttons-wrapper {
        flex-direction: column;
        gap: 0.5em;
        width: 100%;
    }
    
    .fv-product-page-button.primary,
    .fv-brochure-button.secondary {
        width: 100%;
        box-sizing: border-box;
        text-align: center;
    }
    
    .fv-product-page-button.primary {
        order: 1;
    }
    
    .fv-brochure-button.secondary {
        order: 2;
    }
}

/* Compatibility with popular themes */

/* Storefront theme compatibility */
.storefront .fv-custom-buttons-wrapper {
    margin-top: 1.5em;
}

.storefront .fv-product-page-button.primary {
    background-color: #96588a;
    border-color: #96588a;
}

.storefront .fv-product-page-button.primary:hover {
    background-color: #7d4a73;
    border-color: #7d4a73;
}

/* Astra theme compatibility */
.astra .fv-custom-buttons-wrapper {
    margin-top: 1em;
}

/* OceanWP theme compatibility */
.oceanwp .fv-custom-buttons-wrapper {
    margin-top: 1em;
}

/* GeneratePress theme compatibility */
.generatepress .fv-custom-buttons-wrapper {
    margin-top: 1em;
}

/* Flatsome theme compatibility */
.flatsome .fv-custom-buttons-wrapper {
    margin-top: 1em;
    gap: 1em;
}

.flatsome .fv-product-page-button.primary {
    border-radius: 5px;
    font-weight: 700;
}

.flatsome .fv-brochure-button.secondary {
    border-radius: 5px;
}

/* Divi theme compatibility */
.et-db #et-boc .et-l .fv-custom-buttons-wrapper {
    margin-top: 1em;
}

/* Loading states */
.fv-product-page-button.loading,
.fv-brochure-button.loading {
    opacity: 0.7;
    cursor: wait;
    pointer-events: none;
}

.fv-product-page-button.loading::after,
.fv-brochure-button.loading::after {
    content: "";
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-left: 0.5em;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: fv-spin 1s linear infinite;
}

@keyframes fv-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility improvements */
.fv-product-page-button:focus-visible,
.fv-brochure-button:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .fv-product-page-button.primary {
        border-width: 3px;
    }
    
    .fv-brochure-button.secondary {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .fv-product-page-button.primary,
    .fv-brochure-button.secondary {
        transition: none;
    }
    
    .fv-product-page-button.primary:hover,
    .fv-brochure-button.secondary:hover {
        transform: none;
    }
    
    .fv-product-page-button.loading::after,
    .fv-brochure-button.loading::after {
        animation: none;
    }
}

/* Custom styling overrides - these will be overridden by dynamic CSS */
.fv-product-page-button.primary,
.fv-brochure-button.secondary {
    /* Custom colors and fonts will be applied via dynamic CSS */
}

/* Color picker field styling in admin */
.fv-color-field-wrapper .wp-color-result {
    width: 40px;
    height: 40px;
    border-radius: 3px;
    border: 1px solid #ccc;
}

.fv-color-field-wrapper .wp-color-result:hover {
    border-color: #999;
}

/* Font family select styling */
.fv-font-family-select {
    min-width: 200px;
}

/* Font size input styling */
.fv-font-size-input {
    width: 80px;
}
