/* Authentication Pages Shared Styles - MD3 Foundation */
/* Created: October 2025 - Consolidates common auth page CSS */

/* Auth Layout - Container & Card */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    background: var(--sys-surface);
}

.auth-card {
    background: var(--sys-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    box-shadow: var(--shadow-2);
    width: 100%;
    max-width: 400px;
}

.auth-logo {
    text-align: center;
    margin-bottom: var(--space-6);
}

.auth-logo img {
    display: inline-block;
}

.auth-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.auth-title {
    font-size: var(--headline-lg-size);
    font-weight: var(--headline-lg-weight);
    color: var(--sys-on-surface);
    margin-bottom: var(--space-2);
}

.auth-subtitle {
    color: var(--sys-on-surface-variant);
    font-size: var(--body-lg-size);
}

.auth-form {
    margin-bottom: var(--space-6);
}

.auth-footer {
    text-align: center;
    padding-top: var(--space-4);
    border-top: 1px solid var(--sys-outline-variant);
}

.auth-footer p {
    margin: var(--space-2) 0;
    color: var(--sys-on-surface-variant);
    font-size: var(--body-sm-size);
}

.auth-link {
    color: var(--sys-primary);
    text-decoration: none;
    font-weight: var(--label-lg-weight);
}

.auth-link:hover {
    text-decoration: underline;
}

/* Form Input Styles - Standardized across all auth pages */
.form-group {
    margin-bottom: var(--space-6);
}

.form-label {
    display: block;
    font-size: var(--label-lg-size);
    font-weight: var(--label-lg-weight);
    color: var(--sys-on-surface);
    margin-bottom: var(--space-2);
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--sys-outline);
    border-radius: 12px;
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    font-size: 15px;
    background: var(--sys-surface);
    color: var(--sys-on-surface);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 48px;
}

.form-input:focus {
    outline: none;
    border-color: var(--sys-primary);
    box-shadow: 0 0 0 3px rgba(10, 104, 255, 0.12);
}

.form-input::placeholder {
    color: var(--sys-on-surface-variant);
    opacity: 0.6;
}

.form-help {
    display: block;
    font-size: var(--body-sm-size);
    color: var(--sys-on-surface-variant);
    margin-top: var(--space-1);
}

.captcha-question {
    padding: var(--space-3);
    background: var(--sys-surface-variant);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-2);
    font-weight: 500;
    color: var(--sys-on-surface);
}

/* MD3 Primary Button - Standardized Effect */
.btn-primary {
    position: relative; /* Stable containing block for .btn-spinner */
    background-color: var(--sys-primary);
    color: var(--sys-on-primary);
    border: none;
    border-radius: 16px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(10, 104, 255, 0.25);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(10, 104, 255, 0.3);
}

.btn-full {
    width: 100%;
}

/* Form Messages - Success/Error */
.form-messages {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-4);
    font-size: var(--body-sm-size);
}

.form-messages.success {
    background: var(--sys-tertiary-container);
    color: var(--sys-on-tertiary-container);
    border: 1px solid var(--sys-tertiary);
}

.form-messages.error {
    background: var(--sys-error-container);
    color: var(--sys-on-error-container);
    border: 1px solid var(--sys-error);
}

/* OAuth Sign-in Section */
.oauth-section {
    margin-bottom: var(--space-6);
}

/* Custom SSO Button Design */
.btn-sso {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    padding: 16px 20px;
    border-radius: 16px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    min-height: 64px;
    border: 2px solid var(--sys-outline);
    background: linear-gradient(135deg, var(--sys-surface) 0%, var(--sys-surface-container) 100%);
    color: var(--sys-on-surface);
    position: relative;
    overflow: hidden;
}

.btn-sso::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(10, 104, 255, 0.1), transparent);
    transition: left 0.5s;
}

.btn-sso:hover::before {
    left: 100%;
}

.btn-sso:hover {
    border-color: var(--sys-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(10, 104, 255, 0.15);
}

.btn-sso:active {
    transform: translateY(0);
}

.sso-providers {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.provider-icon {
    width: 28px;
    height: 28px;
    transition: transform 0.2s ease;
}

.btn-sso:hover .provider-icon {
    transform: scale(1.1);
}

.provider-icon:nth-child(1) {
    /* Google - keep original colors */
}

.provider-icon:nth-child(2) {
    /* GitHub */
    color: #24292e;
}

.provider-icon:nth-child(3) {
    /* Apple */
    color: #000000;
}

.provider-icon:nth-child(4) {
    /* X */
    color: #000000;
}

.sso-text {
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    font-size: 15px;
    font-weight: 600;
    flex: 1;
    text-align: left;
}

.sso-arrow {
    font-size: 20px;
    font-weight: 600;
    color: var(--sys-primary);
    transition: transform 0.2s ease;
}

.btn-sso:hover .sso-arrow {
    transform: translateX(4px);
}

.oauth-help {
    font-size: 12px;
    color: var(--sys-on-surface-variant);
    text-align: center;
    margin-top: var(--space-2);
    margin-bottom: 0;
}

/* Divider */
.divider {
    position: relative;
    text-align: center;
    margin: var(--space-6) 0;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--sys-outline-variant);
}

.divider-text {
    position: relative;
    display: inline-block;
    padding: 0 var(--space-4);
    background: var(--sys-surface);
    color: var(--sys-on-surface-variant);
    font-size: var(--body-sm-size);
    font-weight: 500;
}

/* Password visibility toggle button focus styles for keyboard accessibility */
button[id^="toggle-"]:focus {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}

button[id^="toggle-"]:focus:not(:focus-visible) {
    outline: none;
}

button[id^="toggle-"]:focus-visible {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
    background-color: rgba(26, 115, 232, 0.08);
}

/* MD3 Button Loading State - December 2025 */
/* Bulletproof spinner using ::after pseudo-element (no DOM element needed) */
.btn-primary.btn-loading {
    pointer-events: none;
    color: transparent !important;
}

.btn-primary.btn-loading .btn-text {
    visibility: hidden;
}

.btn-primary.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin-top: -10px;
    margin-left: -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: auth-btn-spin 0.7s linear infinite;
}

/* Legacy .btn-spinner hidden (kept for backwards compatibility) */
.btn-primary .btn-spinner {
    display: none;
}

@keyframes auth-btn-spin {
    to { transform: rotate(360deg); }
}

/* CAPTCHA Error Styling */
.captcha-error {
    display: none;
    margin-top: 8px;
    padding: 12px 16px;
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: 8px;
    color: #991B1B;
    font-size: 14px;
}

.captcha-error.visible {
    display: block;
}

.captcha-error-text {
    margin-bottom: 8px;
}

.captcha-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #0A68FF;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.captcha-refresh-btn:hover {
    background: #0856D6;
}
