/* Shared Auth Page Styles */

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem 0;
}

.auth-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
    width: 100%;
}

.auth-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.auth-body {
    padding: 2rem;
}

.form-control {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.auth-field-label-row {
    margin-bottom: 0.35rem;
}

.auth-forgot-link {
    color: #667eea;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
}

.auth-forgot-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
}

.btn-google {
    background-color: #db4437;
    border-color: #db4437;
    color: white;
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
}

.btn-google:hover {
    background-color: #c23321;
    border-color: #c23321;
    color: white;
}

.auth-google-signin {
    display: flex;
    justify-content: center;
    width: 100%;
}

.auth-google-signin .g_id_signin {
    width: 100%;
}

.auth-google-signin iframe {
    width: 100% !important;
    margin: 0 !important;
}

.btn-google-oauth {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 10px;
    color: #3c4043;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.2;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    pointer-events: none;
    position: relative;
    z-index: 0;
}

.btn-google-oauth:hover {
    background: #f7f8f8;
    border-color: #d2d4d7;
    color: #3c4043;
    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.15);
}

.btn-google-oauth:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.btn-google-oauth .google-oauth-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

/* Google-recommended pattern: invisible full-size overlay receives the click (GSI uses iframe). */
.google-oauth-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0;
    overflow: hidden;
    cursor: pointer;
    pointer-events: auto;
}

.google-oauth-overlay .google-signin-host {
    width: 100%;
    height: 100%;
    min-height: 44px;
}

.google-oauth-overlay iframe {
    width: 100% !important;
    min-height: 44px !important;
    margin: 0 !important;
}

.divider {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e9ecef;
}

.divider span {
    background: white;
    padding: 0 1rem;
    color: #6c757d;
}

.password-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    color: #6c757d;
    cursor: pointer;
}

.form-group {
    position: relative;
    margin-bottom: 1.5rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(102, 126, 234, 0.90);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
    color: white;
    max-width: 400px;
    padding: 2rem;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.progress-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    overflow: hidden;
    margin: 1.5rem 0;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #fff, #f0f8ff);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
    animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.loading-steps {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 1rem;
}

.btn-primary.loading {
    position: relative;
    color: transparent;
}

.btn-primary.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Login method tabs (magic link vs password) */
.login-method-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.login-method-tab {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    padding: 0.75rem 0.85rem;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    background: #f8f9fc;
    color: #495057;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.login-method-tab:hover {
    border-color: #c5cbe8;
    background: #fff;
}

.login-method-tab:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.login-method-tab.is-active {
    border-color: #667eea;
    background: #fff;
    color: #3b3f72;
    box-shadow: 0 0 0 0.15rem rgba(102, 126, 234, 0.18);
}

.login-method-icon {
    position: relative;
    flex: 0 0 2.25rem;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12), rgba(118, 75, 162, 0.12));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #667eea;
}

.login-method-tab.is-active .login-method-icon {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}

.login-method-icon-badge {
    position: absolute;
    right: -0.2rem;
    bottom: -0.15rem;
    width: 0.95rem;
    height: 0.95rem;
    border-radius: 999px;
    background: #fff;
    color: #667eea;
    font-size: 0.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 1px rgba(102, 126, 234, 0.25);
}

.login-method-tab.is-active .login-method-icon-badge {
    background: #f3f0ff;
    color: #5a4b9a;
}

.login-method-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.15;
}

.login-method-title {
    font-size: 0.92rem;
    font-weight: 650;
}

.login-method-hint {
    margin-top: 0.15rem;
    font-size: 0.75rem;
    opacity: 0.75;
}

.login-method-panel {
    margin-bottom: 0.25rem;
}

@media (max-width: 420px) {
    .login-method-tabs {
        gap: 0.55rem;
    }

    .login-method-tab {
        padding: 0.65rem 0.55rem;
        gap: 0.5rem;
    }

    .login-method-title {
        font-size: 0.85rem;
    }
}
