/* Google Sign-in Page Styles - 2024/2025 Design */

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* CSS Variables */
:root {
    --gm3-sys-color-primary: #0b57d0;
    --gm3-sys-color-on-primary: #fff;
    --gm3-sys-color-surface: #f0f4f9;
    --gm3-sys-color-surface-container: #fff;
    --gm3-sys-color-on-surface: #1f1f1f;
    --gm3-sys-color-on-surface-variant: #444746;
    --gm3-sys-color-outline: #747775;
    --gm3-sys-color-outline-variant: #c4c7c5;
    --gm3-sys-color-error: #d93025;
}

/* Fonts */
@font-face {
    font-family: 'Product Sans';
    font-style: normal;
    font-weight: 400;
    src: url('../fonts/GoogleSans-Regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Product Sans';
    font-style: normal;
    font-weight: 500;
    src: url('../fonts/GoogleSans-Medium.woff2') format('woff2');
}

@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 400;
    src: url('../fonts/Roboto-Regular.woff2') format('woff2');
}

/* Body */
body {
    font-family: 'Product Sans', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background-color: var(--gm3-sys-color-surface);
    color: var(--gm3-sys-color-on-surface);
    font-size: 14px;
    line-height: 1.4286;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Main Container */
.main-container {
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Card Container */
.card-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 24px;
}

/* Card */
.card {
    width: 100%;
    max-width: 840px;
    background-color: var(--gm3-sys-color-surface-container);
    border-radius: 28px;
    padding: 48px;
    min-height: 500px;
}

@media (max-width: 600px) {
    .card {
        border-radius: 0;
        padding: 24px;
        max-width: 100%;
        min-height: auto;
    }
    
    .card-container {
        padding: 0;
    }
}

/* Card Content - Two Column Layout */
.card-content {
    display: flex;
    flex-direction: row;
    gap: 48px;
    height: 100%;
    min-height: 380px;
}

@media (max-width: 800px) {
    .card-content {
        flex-direction: column;
        gap: 24px;
    }
}

/* Left Column - Branding */
.card-left {
    flex: 0 0 auto;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

@media (max-width: 800px) {
    .card-left {
        min-width: auto;
    }
}

/* Right Column - Form */
.card-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Password page specific layout */
.card-content.password-layout {
    align-items: center;
}

.card-content.password-layout .card-left {
    justify-content: flex-start;
    padding-right: 64px;
    padding-top: 0;
    flex: 0 0 340px;
}

.card-content.password-layout .card-right {
    justify-content: flex-start;
    padding-top: 140px;
    flex: 1;
    max-width: 450px;
}

.card-content.password-layout .card-right form {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.card-content.password-layout .input-field {
    width: 100%;
}

.card-content.password-layout .show-password-container {
    margin-bottom: 0;
}

.card-content.password-layout .button-container {
    margin-top: auto;
    padding-top: 48px;
}

/* Google Logo - G Icon */
.logo-container {
    margin-bottom: 24px;
}

.brand-logo {
    width: 52px;
    height: 52px;
}

/* Title */
.title {
    font-family: 'Product Sans', Arial, sans-serif;
    font-size: 36px;
    font-weight: 400;
    line-height: 1.2;
    color: var(--gm3-sys-color-on-surface);
    margin-bottom: 8px;
}

@media (max-width: 600px) {
    .title {
        font-size: 24px;
    }
}

.subtitle {
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--gm3-sys-color-on-surface);
    margin-bottom: 0;
}

/* User Chip (for password/2FA pages) */
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px 4px 4px;
    border: 1px solid var(--gm3-sys-color-outline-variant);
    border-radius: 20px;
    cursor: pointer;
    background-color: transparent;
    transition: background-color 0.2s;
    margin-bottom: 24px;
    width: fit-content;
}

.user-chip:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #e8eaed;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar svg {
    width: 20px;
    height: 20px;
}

.user-email {
    font-size: 14px;
    color: var(--gm3-sys-color-on-surface);
    white-space: nowrap;
}

.dropdown-arrow {
    flex-shrink: 0;
    margin-left: 0;
}

/* Form Styles */
form {
    display: flex;
    flex-direction: column;
}

/* Input Container */
.input-container {
    margin-bottom: 4px;
}

.input-wrapper {
    position: relative;
}

.input-field {
    width: 100%;
    height: 56px;
    padding: 16px;
    font-size: 16px;
    font-family: 'Roboto', Arial, sans-serif;
    border: 1px solid var(--gm3-sys-color-outline);
    border-radius: 4px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: transparent;
    color: var(--gm3-sys-color-on-surface);
}

.input-field:focus {
    border-color: var(--gm3-sys-color-primary);
    box-shadow: inset 0 0 0 1px var(--gm3-sys-color-primary);
}

.input-field:focus + .input-label,
.input-field:not(:placeholder-shown) + .input-label,
.input-field.has-value + .input-label {
    transform: translateY(-28px) scale(0.75);
    background: var(--gm3-sys-color-surface-container);
    padding: 0 4px;
    color: var(--gm3-sys-color-primary);
}

.input-field:not(:focus):not(:placeholder-shown) + .input-label,
.input-field:not(:focus).has-value + .input-label {
    color: var(--gm3-sys-color-on-surface-variant);
}

.input-label {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--gm3-sys-color-on-surface-variant);
    pointer-events: none;
    transition: all 0.2s ease-out;
    transform-origin: left top;
    background: transparent;
}

/* Input Error State */
.input-container.error .input-field {
    border-color: var(--gm3-sys-color-error);
}

.input-container.error .input-field:focus {
    box-shadow: inset 0 0 0 1px var(--gm3-sys-color-error);
}

.input-container.error .input-label,
.input-container.error .input-field:focus + .input-label {
    color: var(--gm3-sys-color-error);
}

/* Error Message */
.error-message {
    display: none;
    align-items: flex-start;
    gap: 8px;
    margin-top: 8px;
    color: var(--gm3-sys-color-error);
    font-size: 12px;
    line-height: 1.4;
}

.input-container.error .error-message {
    display: flex;
}

.error-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.error-text {
    flex: 1;
}

/* Links */
.link {
    color: var(--gm3-sys-color-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.link:hover {
    background-color: rgba(11, 87, 208, 0.08);
    border-radius: 4px;
}

.forgot-link {
    display: inline-block;
    margin: 12px 0 24px;
}

/* Guest Mode Text */
.guest-mode-text {
    font-size: 14px;
    color: var(--gm3-sys-color-on-surface);
    line-height: 1.5;
    margin-bottom: 32px;
}

.guest-mode-text .link {
    display: inline;
}

/* Show Password Checkbox */
.show-password-container {
    margin: 8px 0 24px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    user-select: none;
}

.checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid var(--gm3-sys-color-on-surface-variant);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.checkbox:checked + .checkbox-custom {
    background-color: var(--gm3-sys-color-primary);
    border-color: var(--gm3-sys-color-primary);
}

.checkbox:checked + .checkbox-custom::after {
    content: '';
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.checkbox:focus + .checkbox-custom {
    box-shadow: 0 0 0 2px rgba(11, 87, 208, 0.2);
}

.checkbox-text {
    font-size: 14px;
    color: var(--gm3-sys-color-on-surface);
}

/* Button Container */
.button-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 32px;
}

@media (max-width: 600px) {
    .button-container {
        flex-direction: column-reverse;
        gap: 16px;
        align-items: stretch;
    }
    
    .button-container .link {
        text-align: center;
    }
}

/* Text Button (Create account, etc) */
.text-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 12px;
    font-family: 'Product Sans', Arial, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--gm3-sys-color-primary);
    background: transparent;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s;
}

.text-button:hover {
    background-color: rgba(11, 87, 208, 0.08);
}

/* Primary Button (Next) */
.primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 90px;
    height: 40px;
    padding: 0 24px;
    background-color: var(--gm3-sys-color-primary);
    color: var(--gm3-sys-color-on-primary);
    font-family: 'Product Sans', Arial, sans-serif;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 100px;
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s;
}

.primary-button:hover {
    background-color: #0842a0;
    box-shadow: 0 1px 3px 1px rgba(0,0,0,0.15), 0 1px 2px 0 rgba(0,0,0,0.3);
}

.primary-button:active {
    background-color: #063a8a;
}

.primary-button:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--gm3-sys-color-surface-container), 0 0 0 4px var(--gm3-sys-color-primary);
}

.primary-button:disabled {
    background-color: rgba(31, 31, 31, 0.12);
    color: rgba(31, 31, 31, 0.38);
    cursor: not-allowed;
    box-shadow: none;
}

@media (max-width: 600px) {
    .primary-button {
        width: 100%;
        height: 48px;
    }
}

/* Footer */
.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    flex-wrap: wrap;
    gap: 16px;
}

@media (max-width: 600px) {
    .footer {
        flex-direction: column;
        align-items: flex-start;
    }
}

.language-selector {
    position: relative;
}

.language-select {
    appearance: none;
    background: transparent;
    border: none;
    font-size: 12px;
    color: var(--gm3-sys-color-on-surface-variant);
    cursor: pointer;
    padding-right: 20px;
    font-family: 'Roboto', Arial, sans-serif;
}

.language-select:focus {
    outline: none;
}

.language-selector::after {
    content: '';
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid var(--gm3-sys-color-on-surface-variant);
    pointer-events: none;
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-link {
    font-size: 12px;
    color: var(--gm3-sys-color-on-surface-variant);
    text-decoration: none;
}

.footer-link:hover {
    color: var(--gm3-sys-color-on-surface);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.active {
    display: flex;
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gm3-sys-color-outline-variant);
    border-top-color: var(--gm3-sys-color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 2FA Pages Specific Styles */
.tfa-icon {
    width: 72px;
    height: 72px;
    margin-bottom: 24px;
}

.tfa-title {
    font-family: 'Product Sans', Arial, sans-serif;
    font-size: 24px;
    font-weight: 400;
    margin-bottom: 8px;
    color: var(--gm3-sys-color-on-surface);
}

.tfa-subtitle {
    font-size: 14px;
    color: var(--gm3-sys-color-on-surface-variant);
    margin-bottom: 24px;
    line-height: 1.5;
}

.phone-display {
    font-size: 14px;
    color: var(--gm3-sys-color-on-surface);
    margin-bottom: 24px;
}

/* Tap Verification */
.tap-container {
    text-align: center;
    padding: 24px 0;
}

.tap-number {
    font-size: 72px;
    font-weight: 500;
    color: var(--gm3-sys-color-primary);
    font-family: 'Product Sans', Arial, sans-serif;
    margin: 24px 0;
    line-height: 1;
}

.tap-instruction {
    font-size: 16px;
    color: var(--gm3-sys-color-on-surface);
    margin-bottom: 8px;
}

.tap-device {
    font-size: 14px;
    color: var(--gm3-sys-color-on-surface-variant);
    margin-bottom: 24px;
}

.waiting-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--gm3-sys-color-on-surface-variant);
    font-size: 14px;
    margin-top: 24px;
}

.waiting-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gm3-sys-color-outline-variant);
    border-top-color: var(--gm3-sys-color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.phone-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 24px;
}

/* Resend Link */
.resend-container {
    margin-top: 16px;
}

/* Try Another Way */
.try-another-way {
    margin-top: 24px;
}

/* Single Column Layout for 2FA pages */
.card-content.single-column {
    flex-direction: column;
    max-width: 400px;
    margin: 0 auto;
    text-align: center;
}

.card-content.single-column .card-left {
    min-width: auto;
    align-items: center;
}

.card-content.single-column .input-container,
.card-content.single-column form {
    text-align: left;
}

.card-content.single-column .button-container {
    justify-content: flex-end;
    gap: 8px;
}

/* ========================================
   DARK THEME (password page)
   ======================================== */
body.dark-theme {
    --gm3-sys-color-surface: #202124;
    --gm3-sys-color-surface-container: #0d0d0d;
    --gm3-sys-color-on-surface: #e8eaed;
    --gm3-sys-color-on-surface-variant: #9aa0a6;
    --gm3-sys-color-outline: #5f6368;
    --gm3-sys-color-outline-variant: #5f6368;
    --gm3-sys-color-primary: #8ab4f8;
    --gm3-sys-color-error: #f2b8b5;
}

body.dark-theme {
    background-color: #202124;
}

body.dark-theme .card {
    background-color: #000;
    border: none;
}

body.dark-theme .input-field {
    background-color: #000 !important;
    color: #e8eaed !important;
    border-color: #5f6368;
    -webkit-text-fill-color: #e8eaed !important;
}

body.dark-theme .input-field:focus {
    border-color: #8ab4f8;
    box-shadow: inset 0 0 0 1px #8ab4f8;
    background-color: #000 !important;
}

/* Fix autofill styles for dark theme */
body.dark-theme .input-field:-webkit-autofill,
body.dark-theme .input-field:-webkit-autofill:hover,
body.dark-theme .input-field:-webkit-autofill:focus,
body.dark-theme .input-field:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #000 inset !important;
    -webkit-text-fill-color: #e8eaed !important;
    background-color: #000 !important;
    color: #e8eaed !important;
    caret-color: #e8eaed !important;
    transition: background-color 5000s ease-in-out 0s;
}

body.dark-theme .input-label {
    color: #9aa0a6;
}

body.dark-theme .input-field:focus + .input-label,
body.dark-theme .input-field:not(:placeholder-shown) + .input-label {
    background: #000;
    color: #8ab4f8;
}

body.dark-theme .input-field:not(:focus):not(:placeholder-shown) + .input-label {
    color: #9aa0a6;
}

body.dark-theme .title {
    color: #e8eaed;
}

body.dark-theme .user-chip {
    border-color: #5f6368;
    background-color: transparent;
}

body.dark-theme .user-chip:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

body.dark-theme .user-email {
    color: #e8eaed;
}

body.dark-theme .user-avatar {
    background-color: #5f6368;
}

body.dark-theme .user-avatar svg path {
    fill: #e8eaed;
}

body.dark-theme .dropdown-arrow path {
    fill: #9aa0a6;
}

body.dark-theme .checkbox-custom {
    border-color: #9aa0a6;
}

body.dark-theme .checkbox:checked + .checkbox-custom {
    background-color: #8ab4f8;
    border-color: #8ab4f8;
}

body.dark-theme .checkbox:checked + .checkbox-custom::after {
    border-color: #000;
}

body.dark-theme .checkbox-text {
    color: #e8eaed;
}

body.dark-theme .link {
    color: #8ab4f8;
}

body.dark-theme .link:hover {
    background-color: rgba(138, 180, 248, 0.08);
}

/* Dark theme primary button - light blue on dark */
body.dark-theme .primary-button {
    background-color: #8ab4f8;
    color: #202124;
}

body.dark-theme .primary-button:hover {
    background-color: #aecbfa;
    box-shadow: 0 1px 3px 1px rgba(0,0,0,0.5);
}

body.dark-theme .primary-button:active {
    background-color: #8ab4f8;
}

/* Dark theme footer */
body.dark-theme .footer {
    background-color: transparent;
}

body.dark-theme .language-select {
    color: #9aa0a6;
}

body.dark-theme .language-selector::after {
    border-top-color: #9aa0a6;
}

body.dark-theme .footer-link {
    color: #9aa0a6;
}

body.dark-theme .footer-link:hover {
    color: #e8eaed;
}

/* Dark theme loading overlay */
body.dark-theme .loading-overlay {
    background: rgba(0, 0, 0, 0.9);
}

body.dark-theme .spinner {
    border-color: #5f6368;
    border-top-color: #8ab4f8;
}

/* Dark theme 2FA pages */
body.dark-theme .tfa-title {
    color: #e8eaed;
}

body.dark-theme .tfa-subtitle {
    color: #9aa0a6;
}

body.dark-theme .phone-display {
    color: #e8eaed;
}

body.dark-theme .tap-instruction {
    color: #e8eaed;
}

body.dark-theme .tap-number {
    color: #8ab4f8;
}

body.dark-theme .tap-device {
    color: #9aa0a6;
}

body.dark-theme .waiting-indicator {
    color: #9aa0a6;
}

body.dark-theme .waiting-spinner {
    border-color: #5f6368;
    border-top-color: #8ab4f8;
}

body.dark-theme .text-button {
    color: #8ab4f8;
}

body.dark-theme .text-button:hover {
    background-color: rgba(138, 180, 248, 0.08);
}

body.dark-theme .guest-mode-text {
    color: #9aa0a6;
}

body.dark-theme .subtitle {
    color: #e8eaed;
}

/* Dark theme phone icon for tap */
body.dark-theme .phone-icon svg rect:first-child {
    fill: #3c4043;
    stroke: #5f6368;
}

body.dark-theme .phone-icon svg rect:nth-child(2) {
    fill: #202124;
}

body.dark-theme .phone-icon svg circle {
    fill: #5f6368;
}
