/**
 * OneTap Login for WooCommerce - Frontend Styles
 * v1.0.0
 */

/* ==================== SEPARATOR ==================== */

.onetap-separator {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 20px 0 15px;
}

.onetap-separator::before,
.onetap-separator::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #ddd;
}

.onetap-separator span {
    padding: 0 15px;
    color: #666;
    font-size: 13px;
    text-transform: lowercase;
}

/* ==================== BUTTON CONTAINER ==================== */

.onetap-button-wrapper {
    margin: 15px 0;
}

.onetap-google-btn-container {
    display: flex;
    justify-content: flex-start; /* Left-align all buttons */
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    /* CLS Prevention: Reserve space for Google button */
    min-height: 44px;
    min-width: 200px;
}

/* ==================== BUTTON ALIGNMENT ==================== */

.onetap-align-left .onetap-google-btn-container {
    justify-content: flex-start;
}

.onetap-align-center .onetap-google-btn-container {
    justify-content: center;
}

.onetap-align-right .onetap-google-btn-container {
    justify-content: flex-end;
}

/* Separator alignment follows button */
.onetap-align-center .onetap-separator {
    justify-content: center;
}

.onetap-align-right .onetap-separator {
    justify-content: flex-end;
}

/* ==================== CLS PREVENTION - SKELETON ==================== */

.onetap-skeleton-placeholder {
    height: 44px;
    width: 100%;
    max-width: 400px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: onetap-shimmer 1.2s ease-in-out infinite;
}

@keyframes onetap-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Hide skeleton when button is loaded */
.onetap-google-btn-container.onetap-loaded .onetap-skeleton-placeholder {
    display: none;
}

/* Dark mode skeleton */
@media (prefers-color-scheme: dark) {
    .onetap-skeleton-placeholder {
        background: linear-gradient(90deg, #333 25%, #444 50%, #333 75%);
        background-size: 200% 100%;
    }
}

/* ==================== COOKIE CONSENT PLACEHOLDER ==================== */

.onetap-consent-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    width: 100%;
    max-width: 400px;
    padding: 10px 16px;
    border-radius: 4px;
    background-color: #f5f5f5;
    border: 1px dashed #ccc;
    color: #666;
    font-size: 13px;
    text-align: center;
    box-sizing: border-box;
}

.onetap-consent-placeholder .onetap-consent-icon {
    font-size: 16px;
    color: #999;
}

.onetap-consent-placeholder .onetap-consent-text {
    flex: 1;
    line-height: 1.3;
}

/* Pill shape for consent placeholder */
.onetap-waiting-consent .onetap-consent-placeholder {
    border-radius: 22px;
}

/* Dark mode consent placeholder */
@media (prefers-color-scheme: dark) {
    .onetap-consent-placeholder {
        background-color: #2a2a2a;
        border-color: #444;
        color: #aaa;
    }

    .onetap-consent-placeholder .onetap-consent-icon {
        color: #777;
    }
}

/* ==================== BUTTON CONTAINER INNER ==================== */

.onetap-google-btn-container>div {
    width: 100% !important;
    max-width: 400px;
}

.onetap-google-btn-container iframe {
    width: 100% !important;
    max-width: 100% !important;
}

/* ==================== SPECIFIC CONTEXTS ==================== */

/* My Account - Login */
.woocommerce-form-login .onetap-button-wrapper {
    margin-top: 20px;
}

/* My Account - Register */
.woocommerce-form-register .onetap-button-wrapper {
    margin-top: 20px;
}

/* Alternative registration form */
.onetap-button-register,
.onetap-button-register-alt {
    margin-top: 20px;
}

/* Checkout */
.onetap-button-checkout {
    max-width: 450px;
    margin: 0 0 20px 0; /* Left-aligned, not centered */
    padding: 0;
    background: transparent;
    text-align: left;
}

.onetap-button-checkout .onetap-separator {
    display: none;
}

/* Hide extra text for less intrusive experience */
.onetap-button-checkout::before {
    display: none;
}

/* Cart */
.onetap-button-cart {
    max-width: 350px;
    margin: 20px 0; /* Left-aligned, not centered */
    text-align: left;
}

/* Always hide separator on cart page */
.onetap-button-cart .onetap-separator {
    display: none !important;
}

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

@media (max-width: 768px) {
    .onetap-button-checkout {
        max-width: 100%;
        margin: 0 0 20px;
        padding: 15px;
    }

    .onetap-button-cart {
        max-width: 100%;
    }
}

/* ==================== FLUX CHECKOUT ==================== */

.flux-checkout .onetap-button-checkout {
    margin: 0 0 20px;
    max-width: 100%;
}

/* ==================== ERROR MESSAGES ==================== */

.onetap-error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* ==================== DARK MODE ==================== */

@media (prefers-color-scheme: dark) {
    .onetap-separator span {
        color: #999;
    }

    .onetap-separator::before,
    .onetap-separator::after {
        border-color: #444;
    }

    /* Checkout button dark mode adjustments if needed */
    .onetap-button-checkout {
        background: transparent;
    }
}

/* ==================== MARKETING CONSENT BANNER ==================== */

.onetap-marketing-banner {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 99999;
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    animation: onetap-slide-in 0.3s ease-out;
}

.onetap-marketing-banner-top {
    top: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.onetap-marketing-banner-bottom {
    bottom: 0;
}

.onetap-marketing-banner-floating {
    bottom: 20px;
    right: 20px;
    left: auto;
    max-width: 400px;
    border-radius: 12px;
    flex-direction: column;
    align-items: stretch;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.onetap-marketing-banner-inner {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.onetap-marketing-banner-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.onetap-marketing-banner-icon {
    font-size: 24px;
}

.onetap-marketing-banner-text {
    font-size: 14px;
    color: #333;
}

.onetap-marketing-banner-actions {
    display: flex;
    gap: 10px;
}

.onetap-marketing-btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.onetap-marketing-btn-primary {
    background: #4285f4;
    color: #fff;
}

.onetap-marketing-btn-primary:hover {
    background: #3367d6;
}

.onetap-marketing-btn-primary:disabled {
    background: #93b8f5;
    cursor: not-allowed;
}

.onetap-marketing-btn-secondary {
    background: #f1f3f4;
    color: #5f6368;
}

.onetap-marketing-btn-secondary:hover {
    background: #e8eaed;
}

.onetap-marketing-btn-link {
    background: transparent;
    color: #5f6368;
    text-decoration: underline;
}

.onetap-marketing-privacy-link {
    font-size: 12px;
    color: #666;
}

.onetap-marketing-banner-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

.onetap-marketing-banner-close:hover {
    color: #333;
}

/* ==================== MARKETING CONSENT MODAL ==================== */

.onetap-marketing-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.onetap-marketing-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    animation: onetap-fade-in 0.2s ease-out;
}

.onetap-marketing-modal-content {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: onetap-scale-in 0.3s ease-out;
}

.onetap-marketing-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

.onetap-marketing-modal-close:hover {
    color: #333;
}

.onetap-marketing-modal-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.onetap-marketing-modal-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 15px;
    color: #1d2327;
}

.onetap-marketing-modal-text {
    font-size: 15px;
    color: #50575e;
    margin: 0 0 25px;
    line-height: 1.5;
}

.onetap-marketing-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.onetap-marketing-modal-actions .onetap-marketing-btn-primary {
    padding: 14px 24px;
    font-size: 16px;
}

.onetap-marketing-modal-privacy {
    margin: 20px 0 0;
    font-size: 12px;
    color: #666;
}

.onetap-marketing-modal-privacy a {
    color: #4285f4;
}

/* ==================== SUCCESS/ERROR STATES ==================== */

.onetap-marketing-success {
    text-align: center;
    padding: 20px;
}

.onetap-marketing-success-icon {
    font-size: 48px;
    margin-bottom: 15px;
    color: #00a32a;
}

.onetap-marketing-success-text {
    font-size: 16px;
    color: #00a32a;
    margin: 0;
}

.onetap-marketing-error {
    font-size: 14px;
    color: #d63638;
    margin: 0 0 15px;
    padding: 10px;
    background: #fcf0f1;
    border-radius: 4px;
}

/* ==================== MARKETING CONSENT ANIMATIONS ==================== */

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

@keyframes onetap-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes onetap-scale-in {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ==================== MARKETING CONSENT RESPONSIVE ==================== */

@media (max-width: 600px) {
    .onetap-marketing-banner {
        flex-direction: column;
        padding: 20px;
        gap: 15px;
    }

    .onetap-marketing-banner-inner {
        flex-direction: column;
    }

    .onetap-marketing-banner-actions {
        width: 100%;
        flex-direction: column;
    }

    .onetap-marketing-btn {
        width: 100%;
    }

    .onetap-marketing-modal-content {
        padding: 30px 20px;
    }
}

/* ==================== MARKETING CONSENT DARK MODE ==================== */

@media (prefers-color-scheme: dark) {
    .onetap-marketing-banner {
        background: #1e1e1e;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    }

    .onetap-marketing-banner-text {
        color: #e0e0e0;
    }

    .onetap-marketing-btn-secondary {
        background: #333;
        color: #e0e0e0;
    }

    .onetap-marketing-btn-secondary:hover {
        background: #444;
    }

    .onetap-marketing-modal-content {
        background: #1e1e1e;
    }

    .onetap-marketing-modal-title {
        color: #e0e0e0;
    }

    .onetap-marketing-modal-text {
        color: #b0b0b0;
    }

    .onetap-marketing-banner-close,
    .onetap-marketing-modal-close {
        color: #666;
    }

    .onetap-marketing-banner-close:hover,
    .onetap-marketing-modal-close:hover {
        color: #e0e0e0;
    }

    .onetap-marketing-privacy-link,
    .onetap-marketing-modal-privacy {
        color: #888;
    }
}
