/**
 * DC WooCommerce Buy Now Plugin - All Styles
 * Version: 1.0.2 - FIXED VARIATION SWITCHING
 */

/* ==========================================================================
   ADMIN STYLES
   ========================================================================== */

/* Product Edit Page */
#dc_buy_now_product_data .options_group {
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

#dc_buy_now_product_data .options_group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

#dc_buy_now_product_data .form-field {
    margin-bottom: 15px;
}

#dc_buy_now_product_data .form-field label {
    font-weight: 600;
    color: #23282d;
}

/* Color Picker Styling */
.dc-color-picker {
    width: 100px !important;
}

.wp-picker-container {
    margin-bottom: 10px;
}

/* Variation Settings - IMPROVED */
.dc-buy-now-variation-settings {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    margin: 15px 0;
    position: relative;
}

.dc-buy-now-variation-settings[data-variation-id] {
    border-left: 4px solid #0073aa;
}

.dc-buy-now-variation-settings h4 {
    margin: 0 0 15px 0;
    padding: 0;
    font-size: 14px;
    font-weight: 600;
    color: #23282d;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
}

.dc-buy-now-variation-settings .form-row {
    margin-bottom: 12px;
}

.dc-buy-now-variation-settings label {
    font-weight: 600;
    color: #23282d;
    display: block;
    margin-bottom: 5px;
}

.dc-buy-now-variation-settings input[type="text"],
.dc-buy-now-variation-settings input[type="url"] {
    width: 100%;
    max-width: 400px;
}

.dc-buy-now-variation-settings .description {
    color: #666;
    font-style: italic;
    font-size: 12px;
    margin-top: 5px;
}

/* URL Input Status Indicators */
.dc-variation-url-input.dc-has-url {
    border-left: 4px solid #46b450;
}

.dc-variation-url-input.dc-no-url {
    border-left: 4px solid #ddd;
}

/* Settings page preview */
.dc-buy-now-preview-container {
    background: #f9f9f9;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-top: 10px;
}

.dc-buy-now-preview-button {
    background: #000000 !important;
    color: #ffffff !important;
    border: none !important;
    padding: 0.618em 1em !important;
    font-weight: 700 !important;
    border-radius: 3px !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    font-size: 1em !important;
    line-height: 1 !important;
    margin: 0 !important;
    cursor: pointer !important;
    width: 100% !important;
    display: block !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    transition: all 0.3s ease !important;
}

.dc-buy-now-preview-button:hover {
    background: #333333 !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

/* ==========================================================================
   FRONTEND STYLES
   ========================================================================== */

/* Buy Now Button Base Styles - Matching Add to Cart */
.dc-buy-now-wrapper {
    margin: 15px 0;
    clear: both;
}

.dc-buy-now-button {
    display: inline-block;
    background: #000000;
    color: #ffffff;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-align: center;
    font-weight: 700;
    border-radius: 3px;
    text-transform: none;
    letter-spacing: normal;
    font-size: 1em;
    line-height: 1;
    padding: 0.618em 1em;
    margin: 0;
    width: auto;
    min-height: 0;
    vertical-align: baseline;
    font-family: inherit;
}

/* Full width styling (like Add to Cart) */
.dc-buy-now-button.dc-full-width {
    width: 100%;
    display: block;
}

/* Animation enabled */
.dc-buy-now-button.dc-animations-enabled {
    transition: all 0.3s ease;
}

.dc-buy-now-button.dc-animations-enabled:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.dc-buy-now-button.dc-animations-enabled:active {
    transform: translateY(0);
}

/* Hover states */
.dc-buy-now-button:hover,
.dc-buy-now-button:focus {
    color: #ffffff;
    text-decoration: none;
    outline: none;
}

.dc-buy-now-button:active {
    outline: none;
}

/* Match WooCommerce button styling exactly */
.woocommerce .dc-buy-now-button,
.woocommerce-page .dc-buy-now-button {
    background: #000000;
    color: #ffffff;
    border: none;
    padding: 0.618em 1em;
    font-weight: 700;
    border-radius: 3px;
    text-transform: none;
    letter-spacing: normal;
    font-size: 1em;
    line-height: 1;
    margin: 0;
    cursor: pointer;
    position: relative;
    overflow: visible;
    text-align: center;
    display: inline-block;
    vertical-align: baseline;
}

.woocommerce .dc-buy-now-button.dc-full-width,
.woocommerce-page .dc-buy-now-button.dc-full-width {
    width: 100%;
    display: block;
}

/* Single product page specific styling */
.single-product .dc-buy-now-wrapper {
    margin: 20px 0;
}

.single-product .cart .dc-buy-now-wrapper {
    margin-top: 15px;
}

.single-product .dc-buy-now-button {
    width: 100%;
    display: block;
    padding: 0.75em 1.5em;
    font-size: 1.1em;
}

/* Variable Product Styles - IMPROVED */
.dc-buy-now-variable .dc-buy-now-button {
    opacity: 0.6;
    cursor: not-allowed;
    transition: all 0.3s ease;
}

.dc-buy-now-variable .dc-buy-now-button.dc-active {
    opacity: 1;
    cursor: pointer;
}

.dc-buy-now-variable .dc-buy-now-button.dc-updating {
    opacity: 0.7;
    background: #666 !important;
    cursor: wait;
}

/* Loading States - ENHANCED */
.dc-buy-now-button.dc-loading {
    opacity: 0.8;
    pointer-events: none;
    position: relative;
    background: #666 !important;
    cursor: wait;
}

.dc-buy-now-button.dc-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: dc-spin 1s linear infinite;
}

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

/* Click Animation */
.dc-buy-now-button.dc-clicked {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* Shop/Archive Page Styles */
.dc-buy-now-shop {
    margin-top: 8px;
    padding: 8px 16px;
    font-size: 14px;
    min-width: auto;
    display: block;
    width: 100%;
    text-align: center;
}

.woocommerce ul.products li.product .dc-buy-now-shop {
    margin: 8px 0 0 0;
}

/* Product variations table */
.woocommerce table.variations .dc-buy-now-wrapper {
    margin: 0;
}

.woocommerce table.variations .dc-buy-now-button {
    padding: 8px 16px;
    font-size: 14px;
    min-width: auto;
}

/* Error/Success Messages */
.dc-buy-now-error,
.dc-buy-now-success {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    z-index: 9999;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    animation: dc-slide-in 0.3s ease;
}

.dc-buy-now-error {
    background: #dc3232;
    color: #fff;
}

.dc-buy-now-success {
    background: #46b450;
    color: #fff;
}

@keyframes dc-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media screen and (max-width: 768px) {
    .dc-buy-now-button {
        padding: 14px 20px;
        font-size: 16px;
        width: 100%;
        text-align: center;
        margin: 10px 0;
    }
    
    .dc-buy-now-wrapper {
        margin: 10px 0;
    }
    
    .dc-buy-now-shop {
        padding: 12px 16px;
        font-size: 15px;
    }
    
    .dc-buy-now-variation-settings {
        padding: 10px;
    }
    
    .dc-buy-now-variation-settings input[type="text"],
    .dc-buy-now-variation-settings input[type="url"] {
        max-width: 100%;
    }
    
    /* Mobile error/success messages */
    .dc-buy-now-error,
    .dc-buy-now-success {
        left: 10px;
        right: 10px;
        top: 10px;
    }
}

@media screen and (max-width: 480px) {
    .dc-buy-now-button {
        padding: 12px 16px;
        font-size: 15px;
        letter-spacing: 0.3px;
    }
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

.dc-buy-now-button:focus {
    outline: 2px solid #005177;
    outline-offset: 2px;
}

.dc-buy-now-button:focus:not(:focus-visible) {
    outline: none;
}

.dc-buy-now-button:focus-visible {
    outline: 2px solid #005177;
    outline-offset: 2px;
}

/* Screen reader text */
.dc-sr-only {
    position: absolute !important;
    clip: rect(1px, 1px, 1px, 1px);
    word-wrap: normal !important;
    border: 0;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    width: 1px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .dc-buy-now-button {
        border: 2px solid;
    }
    
    .dc-buy-now-variation-settings {
        border-color: #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .dc-buy-now-button,
    .dc-buy-now-button::before,
    .dc-buy-now-button::after {
        transition: none !important;
        animation: none !important;
    }
    
    .dc-buy-now-button:hover {
        transform: none !important;
    }
    
    .dc-buy-now-error,
    .dc-buy-now-success {
        animation: none !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .dc-buy-now-button {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    }
    
    .dc-buy-now-button:hover {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
    }
}

/* Print Styles */
@media print {
    .dc-buy-now-button {
        background: transparent !important;
        color: #000 !important;
        border: 2px solid #000 !important;
        box-shadow: none !important;
    }
    
    .dc-buy-now-button::before,
    .dc-buy-now-button::after {
        display: none !important;
    }
    
    .dc-buy-now-error,
    .dc-buy-now-success {
        display: none !important;
    }
}