/* Express Buy Frontend Styles */

/* ===================================
   Express Buy Button - Base Styles
   =================================== */

.express-buy-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    line-height: 1.4;
    font-family: inherit;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.express-buy-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.express-buy-button:active {
    transform: translateY(0);
}

.express-buy-button .eb-icon {
    font-size: 18px;
    line-height: 1;
}

/* Pulse animation on load */
@keyframes eb-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.express-buy-button.eb-loading {
    pointer-events: none;
    opacity: 0.7;
}

.express-buy-button.eb-loading .eb-icon {
    animation: eb-pulse 1s ease-in-out infinite;
}

/* ===================================
   Single Product Page Button
   =================================== */

.express-buy-single {
    width: 100%;
    margin-top: 15px;
    padding: 14px 28px;
    font-size: 17px;
}

/* Make it stand out more on single product pages */
.express-buy-single::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.express-buy-single:hover::before {
    left: 100%;
}

/* ===================================
   Product Card/Loop Button
   =================================== */

.express-buy-loop {
    width: 100%;
    margin-top: 10px;
    padding: 10px 20px;
    font-size: 14px;
}

/* Compact version for smaller cards */
@media (max-width: 768px) {
    .express-buy-loop {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .express-buy-loop .eb-icon {
        font-size: 16px;
    }
}

/* ===================================
   WooCommerce Integration Fixes
   =================================== */

/* Ensure button appears below Add to Cart on product cards */
.woocommerce ul.products li.product .express-buy-loop {
    clear: both;
    display: block;
}

/* Fix for some themes that have tight spacing */
.woocommerce ul.products li.product .button {
    margin-bottom: 5px;
}

/* Align with WooCommerce buttons */
.woocommerce .express-buy-button {
    display: inline-flex;
}

/* For grid layouts */
.woocommerce ul.products li.product {
    position: relative;
}

/* ===================================
   Express Buy Modal/Popup
   =================================== */

.express-buy-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    animation: eb-fade-in 0.3s ease;
}

@keyframes eb-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.express-buy-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.express-buy-modal-content {
    background: #ffffff;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: eb-slide-up 0.3s ease;
    position: relative;
}

@keyframes eb-slide-up {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.express-buy-modal-header {
    padding: 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
    border-radius: 16px 16px 0 0;
}

.express-buy-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 8px;
}

.express-buy-modal-close {
    background: transparent;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #6b7280;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.express-buy-modal-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.express-buy-modal-body {
    padding: 24px;
}

.express-buy-product-info {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 12px;
    margin-bottom: 20px;
}

.express-buy-product-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.express-buy-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.express-buy-product-details h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.express-buy-product-price {
    font-size: 20px;
    font-weight: 700;
    color: #00d084;
}

.express-buy-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.express-buy-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.express-buy-form-group label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.express-buy-form-group input,
.express-buy-form-group select,
.express-buy-form-group textarea {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.express-buy-form-group input:focus,
.express-buy-form-group select:focus,
.express-buy-form-group textarea:focus {
    outline: none;
    border-color: #00d084;
    box-shadow: 0 0 0 3px rgba(0, 208, 132, 0.1);
}

.express-buy-submit {
    margin-top: 8px;
    padding: 14px 24px;
    background: linear-gradient(135deg, #00d084 0%, #00a86b 100%) !important;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.express-buy-submit:hover {
    background: linear-gradient(135deg, #00a86b 0%, #008b5a 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 208, 132, 0.3);
}

.express-buy-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ===================================
   Gateway Selection
   =================================== */

.express-buy-gateways {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.express-buy-gateway {
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    background: white;
}

.express-buy-gateway:hover {
    border-color: #00d084;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.express-buy-gateway.active {
    border-color: #00d084;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

.express-buy-gateway img {
    max-width: 100px;
    height: 30px;
    object-fit: contain;
    margin-bottom: 8px;
}

.express-buy-gateway-name {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

/* ===================================
   Loading State
   =================================== */

.express-buy-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    z-index: 10;
}

.express-buy-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #00d084;
    border-radius: 50%;
    animation: eb-spin 0.8s linear infinite;
}

@keyframes eb-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===================================
   Responsive Design
   =================================== */

@media (max-width: 768px) {
    .express-buy-modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .express-buy-modal-header,
    .express-buy-modal-body {
        padding: 20px;
    }
    
    .express-buy-product-info {
        flex-direction: column;
        text-align: center;
    }
    
    .express-buy-product-image {
        margin: 0 auto;
    }
    
    .express-buy-gateways {
        grid-template-columns: 1fr;
    }
}

/* ===================================
   Theme Compatibility Fixes
   =================================== */

/* Fix for themes with aggressive button styling */
.express-buy-button,
.express-buy-submit {
    text-transform: none !important;
    letter-spacing: normal !important;
}

/* Ensure button text is visible */
.express-buy-button * {
    color: inherit;
}

/* Fix for flexbox issues in some themes */
.woocommerce ul.products li.product .express-buy-loop {
    flex: 0 0 auto;
}

/* Success message */
.express-buy-success {
    padding: 16px;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 2px solid #10b981;
    border-radius: 12px;
    color: #065f46;
    text-align: center;
    font-weight: 600;
    margin-bottom: 16px;
}

/* Error message */
.express-buy-error {
    padding: 16px;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 2px solid #ef4444;
    border-radius: 12px;
    color: #991b1b;
    text-align: center;
    font-weight: 600;
    margin-bottom: 16px;
}