/**
 * EK Social Login Styles
 * Transparent buttons with loading spinner - Mobile/PWA optimized
 */

/* Main container */
.ek-social-login {
    margin: 20px 0;
    text-align: center;
}

/* Divider */
.ek-social-divider {
    display: flex;
    align-items: center;
    margin: 15px 0;
    color: #666;
    font-size: 13px;
}

.ek-social-divider::before,
.ek-social-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #ddd;
}

.ek-social-divider span {
    padding: 0 15px;
    white-space: nowrap;
}

/* Button container */
.ek-social-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Base button style - Transparent */
.ek-social-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: transparent;
    color: #333;
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.ek-social-btn:hover {
    background: rgba(0, 0, 0, 0.02);
    border-color: #bbb;
    text-decoration: none !important;
    color: #333;
}

.ek-social-btn:active {
    transform: scale(0.98);
}

.ek-social-btn:focus {
    outline: 2px solid #4285F4;
    outline-offset: 2px;
}

/* Facebook button */
.ek-social-btn.ek-facebook {
    border-color: #1877f2;
    color: #1877f2;
}

.ek-social-btn.ek-facebook:hover {
    background: rgba(24, 119, 242, 0.05);
    border-color: #1877f2;
    color: #1877f2;
}

.ek-social-btn.ek-facebook svg {
    flex-shrink: 0;
}

/* Google button */
.ek-social-btn.ek-google {
    border-color: #dadce0;
    color: #3c4043;
}

.ek-social-btn.ek-google:hover {
    background: rgba(0, 0, 0, 0.02);
    border-color: #bbb;
}

.ek-social-btn.ek-google svg {
    flex-shrink: 0;
}

/* Small buttons for checkout */
.ek-social-btn.ek-small {
    padding: 10px 18px;
    font-size: 13px;
    min-width: 120px;
}

/* Loading spinner */
.ek-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: ek-spin 0.8s linear infinite;
    flex-shrink: 0;
}

.ek-social-btn.ek-loading {
    pointer-events: none;
    opacity: 0.8;
}

.ek-social-btn.ek-loading .ek-spinner {
    display: block;
}

.ek-social-btn.ek-loading span {
    opacity: 0.7;
}

.ek-social-btn.ek-loading svg {
    opacity: 0.5;
}

@keyframes ek-spin {
    to { transform: rotate(360deg); }
}

/* Checkout section */
.ek-social-checkout {
    margin-bottom: 20px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 4px;
    text-align: center;
}

.ek-checkout-text {
    margin: 0 0 12px 0 !important;
    font-size: 14px;
    color: #666;
}

.ek-checkout-buttons {
    justify-content: center;
}

/* Tab style login/register */
.ek-social-tabs {
    display: flex;
    margin-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.ek-social-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: #666;
    font-size: 14px;
    transition: all 0.2s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.ek-social-tab:hover {
    color: #333;
}

.ek-social-tab.active {
    color: #333;
    border-bottom-color: #333;
    font-weight: 500;
}

/* Error message */
.ek-social-error {
    margin-bottom: 15px;
    padding: 12px 15px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
    color: #dc2626;
    font-size: 14px;
}

/* Mobile optimization */
@media (max-width: 480px) {
    .ek-social-login {
        margin: 15px 0;
    }

    .ek-social-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .ek-social-btn {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
        font-size: 15px;
        min-height: 48px; /* Touch-friendly */
    }

    .ek-social-btn.ek-small {
        padding: 12px 16px;
        min-height: 44px;
    }

    .ek-social-checkout {
        padding: 12px 15px;
        margin-left: -15px;
        margin-right: -15px;
        border-radius: 0;
    }

    .ek-checkout-buttons {
        flex-direction: row !important;
    }

    .ek-checkout-buttons .ek-social-btn {
        flex: 1;
        min-width: 0;
        padding: 12px 10px;
    }

    .ek-checkout-buttons .ek-social-btn span {
        font-size: 12px;
    }
}

/* PWA / Standalone mode */
@media (display-mode: standalone) {
    .ek-social-btn {
        min-height: 50px;
    }
}

/* Safe area for notched phones */
@supports (padding: env(safe-area-inset-bottom)) {
    .ek-social-checkout {
        padding-bottom: calc(15px + env(safe-area-inset-bottom));
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .ek-social-login,
    .ek-social-checkout {
        color: #e0e0e0;
    }

    .ek-social-divider {
        color: #999;
    }

    .ek-social-divider::before,
    .ek-social-divider::after {
        background: #444;
    }

    .ek-social-btn {
        border-color: #555;
        color: #e0e0e0;
        background: transparent;
    }

    .ek-social-btn:hover {
        background: rgba(255, 255, 255, 0.05);
        color: #fff;
    }

    .ek-social-btn.ek-facebook {
        border-color: #1877f2;
        color: #4599ff;
    }

    .ek-social-btn.ek-google {
        border-color: #555;
        color: #e0e0e0;
    }

    .ek-social-checkout {
        background: #2a2a2a;
    }

    .ek-checkout-text {
        color: #999;
    }

    .ek-social-error {
        background: #451a1a;
        border-color: #7f1d1d;
        color: #fca5a5;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .ek-social-btn {
        border-width: 2px;
    }

    .ek-social-btn:focus {
        outline-width: 3px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .ek-social-btn {
        transition: none;
    }

    .ek-spinner {
        animation: none;
        border: 2px solid currentColor;
        opacity: 0.5;
    }
}

/* WooCommerce my-account page */
.woocommerce-account .ek-social-login {
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* WordPress login page (wp-login.php) */
body.login .ek-social-login {
    margin: 16px 0 16px 0 !important;
    padding: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    text-align: center !important;
}

body.login .ek-social-divider {
    margin: 10px 0 !important;
    font-size: 11px !important;
    justify-content: center !important;
}

body.login .ek-social-buttons {
    flex-direction: column !important;
    gap: 6px !important;
    align-items: center !important;
    justify-content: center !important;
}

body.login .ek-social-btn {
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px 12px !important;
    font-size: 11px !important;
    min-height: 36px !important;
    min-width: unset !important;
    box-sizing: border-box !important;
}

body.login .ek-social-btn svg {
    width: 14px !important;
    height: 14px !important;
}

body.login .ek-social-btn .ek-spinner {
    width: 12px !important;
    height: 12px !important;
}

/* Theme compatibility - Woodmart */
.woodmart-woo-form .ek-social-login {
    margin-top: 15px;
}

/* Theme compatibility - Ecomus */
.ecomus-login-form .ek-social-login {
    margin-top: 15px;
}

/* Theme compatibility - Storefront */
.storefront-primary-navigation .ek-social-login {
    display: none;
}

/* Hide when logged in (safety) */
.logged-in .ek-social-login,
.logged-in .ek-social-checkout {
    display: none;
}
