/* === Google Sign-In Button Dark/Light Mode Fix === */

.google-signin-container {
    height: 44px;
    min-width: 200px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    position: relative;
}

/* Hide the duplicate button that causes FOUC */
.g_id_signin > div > div:first-child {
    display: none !important;
}

/* Smooth transition when button loads */
.g_id_signin {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    width: 100%;
}

.g_id_signin.loaded,
.g_id_signin iframe {
    opacity: 1;
}

/* Force Google button iframe to respect theme */
.g_id_signin iframe {
    transition: filter 0.3s ease, opacity 0.3s ease;
}

/* Dark mode adjustments for Google button */
html[data-theme="dark"] .g_id_signin iframe {
    filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.9);
    border-radius: 4px;
}

/* Light mode - ensure no filters */
html[data-theme="light"] .g_id_signin iframe {
    filter: none;
}

/* Loading skeleton that matches button size */
.google-signin-skeleton {
    position: absolute;
    top: 0;
    left: 0;
    height: 44px;
    width: 200px;
    background: var(--skeleton-bg, #f0f0f0);
    border: 1px solid var(--skeleton-border, #dadce0);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--skeleton-text, #5f6368);
    font-size: 14px;
    font-family: 'Roboto', sans-serif;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Hide skeleton when button loads */
.g_id_signin.loaded ~ .google-signin-skeleton,
.g_id_signin:not(:empty) ~ .google-signin-skeleton {
    opacity: 0;
    pointer-events: none;
}

/* Dark mode skeleton */
html[data-theme="dark"] .google-signin-skeleton {
    --skeleton-bg: #2a2a2a;
    --skeleton-border: #555;
    --skeleton-text: #aaa;
}

/* Light mode skeleton */
html[data-theme="light"] .google-signin-skeleton {
    --skeleton-bg: #f0f0f0;
    --skeleton-border: #dadce0;
    --skeleton-text: #5f6368;
}
