/* Auth Pages Shared Styles (login, signup, reset-password, verify-email, verify-email-change) */

/* ============================================================
   Reset & Base (for pages without Bootstrap)
   ============================================================ */
.auth-reset * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ============================================================
   Shared Body Styles
   ============================================================ */
body.auth-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Login/Signup use Segoe UI via Bootstrap, others use Inter */
body.auth-page-inter {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body.auth-page-bootstrap {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* signup needs extra top/bottom padding */
body.auth-page-signup {
    padding: 20px 0;
}

/* ============================================================
   Login & Signup Container/Header/Body (Bootstrap-based)
   ============================================================ */
.login-container,
.signup-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
    max-width: 450px;
    width: 100%;
}

.login-header,
.signup-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

.login-header h2,
.signup-header h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
}

.login-header p,
.signup-header p {
    margin: 10px 0 0 0;
    opacity: 0.9;
}

.login-body,
.signup-body {
    padding: 40px 30px;
}

/* ============================================================
   Form Controls (Bootstrap-based auth pages)
   ============================================================ */
.auth-page-bootstrap .form-group label {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.auth-page-bootstrap .form-control {
    border-radius: 10px;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s;
}

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

.auth-page-bootstrap .alert {
    border-radius: 10px;
    margin-bottom: 20px;
}

/* ============================================================
   Login-Specific
   ============================================================ */
.btn-login {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-weight: 600;
    font-size: 16px;
    width: 100%;
    transition: transform 0.2s;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

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

.divider span {
    background: white;
    padding: 0 15px;
    position: relative;
    color: #767676;
}

.signup-link,
.login-link {
    text-align: center;
    margin-top: 20px;
    color: #666;
}

.signup-link a,
.login-link a {
    color: #667eea;
    font-weight: 600;
    text-decoration: none;
}

.signup-link a:hover,
.login-link a:hover {
    text-decoration: underline;
}

#twoFactorSection {
    display: none;
}

.input-group-text {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-right: none;
}

.input-group .form-control {
    border-left: none;
}

/* Login: form check tight spacing */
.auth-form-check-tight {
    margin-top: -5px;
}

/* Login: remember me label */
.auth-label-light {
    font-weight: normal;
    color: #666;
}

/* Login: 2FA alert info */
.auth-alert-2fa {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    border: none;
}

.auth-alert-2fa p {
    margin: 0.5rem 0 0;
    font-size: 0.9rem;
}

/* Login: 2FA code input */
.auth-input-code {
    font-size: 1.2rem;
    letter-spacing: 3px;
    text-align: center;
}

/* Login: forgot password link */
.auth-forgot-link {
    text-align: center;
    margin-top: 15px;
}

.auth-forgot-link a {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
}

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

/* ============================================================
   OAuth Buttons (Login & Signup)
   ============================================================ */
.auth-oauth-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.auth-oauth-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border-radius: 10px;
}

/* ============================================================
   SSO Section (Login)
   ============================================================ */
.auth-sso-section {
    margin-top: 5px;
}

.btn-sso {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: #fff;
    transition: opacity 0.2s;
}

.btn-sso:hover {
    opacity: 0.9;
    color: #fff;
}

.auth-sso-hint {
    margin-top: 8px;
    font-size: 0.82rem;
    text-align: center;
}

/* ============================================================
   Resend Verification Section (Login)
   ============================================================ */
.auth-resend-section {
    display: none;
    margin-top: 20px;
    padding: 15px;
    background: #fff7ed;
    border-radius: 10px;
    border: 1px solid #fed7aa;
}

.auth-resend-section p {
    margin: 0 0 10px;
    color: #c2410c;
    font-size: 14px;
}

.auth-resend-btn {
    background: #f97316;
    color: white;
    border: none;
}

.auth-resend-message {
    display: none;
    margin-top: 10px;
    font-size: 13px;
}

/* ============================================================
   Forgot Password Modal (Login)
   ============================================================ */
.auth-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.auth-modal-content {
    background: white;
    border-radius: 16px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    margin: auto;
}

.auth-modal-content h4 {
    margin-bottom: 15px;
}

.auth-modal-content p {
    color: #666;
    margin-bottom: 20px;
}

.auth-modal-input {
    margin-bottom: 15px;
}

.auth-modal-message {
    display: none;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.auth-modal-btn {
    width: 100%;
    margin-bottom: 10px;
}

/* ============================================================
   Signup-Specific
   ============================================================ */
.btn-signup {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-weight: 600;
    font-size: 16px;
    width: 100%;
    transition: transform 0.2s;
}

.btn-signup:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.password-strength {
    height: 5px;
    border-radius: 3px;
    margin-top: 5px;
    background: #e0e0e0;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    width: 0%;
    transition: all 0.3s;
}

.password-hint {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

/* Signup: password requirements */
.password-requirements {
    font-size: 12px;
    margin-top: 10px;
    color: #666;
}

/* Signup: requirement dot default */
.auth-req-dot {
    font-size: 6px;
    color: #999;
}

/* Signup: divider without pseudo-element (uses child div for line) */
.auth-divider-line {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e0e0e0;
    z-index: -1;
}

/* ============================================================
   Reset Password Page (no Bootstrap, standalone)
   ============================================================ */
.auth-standalone-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 420px;
    padding: 40px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo h1 {
    font-size: 28px;
    color: #1e293b;
}

.auth-logo span {
    font-size: 32px;
}

.auth-standalone-container h2 {
    color: #1e293b;
    font-size: 24px;
    margin-bottom: 10px;
    text-align: center;
}

.auth-subtitle {
    color: #64748b;
    text-align: center;
    margin-bottom: 30px;
}

.auth-standalone-container .form-group {
    margin-bottom: 20px;
}

.auth-standalone-container label {
    display: block;
    color: #475569;
    font-weight: 500;
    margin-bottom: 8px;
}

.auth-standalone-container input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-standalone-container input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.auth-standalone-container .password-requirements {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 8px;
}

.auth-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Reset password: success/error button link */
.auth-btn-link {
    display: block;
    text-align: center;
    text-decoration: none;
    margin-top: 20px;
    color: white;
}

.auth-btn-link:hover {
    color: white;
    text-decoration: none;
}

.auth-message {
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.auth-message.error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.auth-message.success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.auth-back-link {
    text-align: center;
    margin-top: 20px;
}

.auth-back-link a {
    color: #667eea;
    text-decoration: none;
}

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

/* ============================================================
   Verify Email / Verify Email Change (standalone)
   ============================================================ */
.auth-standalone-container.auth-centered {
    text-align: center;
}

.auth-standalone-container .auth-logo h1 {
    margin-bottom: 30px;
}

.auth-status-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.auth-status-icon.success {
    color: #10b981;
}

.auth-status-icon.error {
    color: #ef4444;
}

.auth-standalone-container p {
    color: #64748b;
    margin-bottom: 20px;
    line-height: 1.6;
}

.auth-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: auth-spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.auth-new-email {
    background: #f0fdf4;
    color: #16a34a;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    margin-bottom: 20px;
}

/* ============================================================
   Password Toggle (show/hide)
   ============================================================ */
.password-wrapper {
    position: relative;
}

.password-wrapper .form-control {
    padding-right: 45px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 0;
    font-size: 16px;
    line-height: 1;
}

.password-toggle:hover {
    color: #667eea;
}

/* ============================================================
   Utility: hidden
   ============================================================ */
.hidden {
    display: none;
}

/* ============================================================
   Dark Mode Overrides
   Respects saved preference via dark-mode-init.js (no toggle on auth pages).
   Triggered by html.dark-mode or body.dark-mode class.
   ============================================================ */

/* --- Body gradient --- */
html.dark-mode body.auth-page,
body.dark-mode.auth-page {
    background: linear-gradient(135deg, #1a1a3e 0%, #2d1b4e 100%);
}

/* --- Login / Signup containers --- */
html.dark-mode .login-container,
html.dark-mode .signup-container {
    background: #16213e;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* --- Login / Signup body text --- */
html.dark-mode .login-body,
html.dark-mode .signup-body {
    color: #e2e8f0;
}

/* --- Bootstrap form controls --- */
html.dark-mode .auth-page-bootstrap .form-group label {
    color: #e2e8f0;
}

html.dark-mode .auth-page-bootstrap .form-control {
    background-color: #1a1a2e;
    border-color: #2d3748;
    color: #e2e8f0;
}

html.dark-mode .auth-page-bootstrap .form-control::placeholder {
    color: #718096;
}

html.dark-mode .auth-page-bootstrap .form-control:focus {
    background-color: #1a1a2e;
    border-color: #667eea;
    color: #e2e8f0;
}

/* --- Divider --- */
html.dark-mode .divider::before {
    background: #2d3748;
}

html.dark-mode .divider span {
    background: #16213e;
    color: #a0aec0;
}

/* --- Links --- */
html.dark-mode .signup-link,
html.dark-mode .login-link {
    color: #a0aec0;
}

html.dark-mode .signup-link a,
html.dark-mode .login-link a {
    color: #63b3ed;
}

html.dark-mode .auth-forgot-link a {
    color: #63b3ed;
}

/* --- OAuth buttons --- */
html.dark-mode .auth-oauth-btn {
    background-color: #1a1a2e;
    border-color: #2d3748;
    color: #e2e8f0;
}

html.dark-mode .auth-oauth-btn:hover {
    background-color: #1e2a4a;
    border-color: #4a5568;
    color: #e2e8f0;
}

/* --- Input group (2FA) --- */
html.dark-mode .input-group-text {
    background: #1a1a2e;
    border-color: #2d3748;
    color: #e2e8f0;
}

/* --- Remember me / form-check label --- */
html.dark-mode .auth-label-light {
    color: #a0aec0;
}

html.dark-mode .form-check-label {
    color: #a0aec0;
}

/* --- 2FA alert --- */
html.dark-mode .auth-alert-2fa {
    background: linear-gradient(135deg, #1a1a3e 0%, #1e2a4a 100%);
    color: #e2e8f0;
}

/* --- Resend verification section --- */
html.dark-mode .auth-resend-section {
    background: #2d1b4e;
    border-color: #4a5568;
}

html.dark-mode .auth-resend-section p {
    color: #f6ad55;
}

/* --- Forgot password modal --- */
html.dark-mode .auth-modal-content {
    background: #16213e;
    color: #e2e8f0;
}

html.dark-mode .auth-modal-content h4 {
    color: #e2e8f0;
}

html.dark-mode .auth-modal-content p {
    color: #a0aec0;
}

/* --- Password hints / requirements --- */
html.dark-mode .password-hint {
    color: #a0aec0;
}

html.dark-mode .password-requirements {
    color: #a0aec0;
}

html.dark-mode .password-strength {
    background: #2d3748;
}

html.dark-mode .password-toggle {
    color: #718096;
}

html.dark-mode .password-toggle:hover {
    color: #63b3ed;
}

/* --- SSO hint --- */
html.dark-mode .auth-sso-hint {
    color: #a0aec0;
}

/* --- Standalone container (reset-password, verify-email, verify-email-change) --- */
html.dark-mode .auth-standalone-container {
    background: #16213e;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

html.dark-mode .auth-logo h1 {
    color: #e2e8f0;
}

html.dark-mode .auth-standalone-container h2 {
    color: #e2e8f0;
}

html.dark-mode .auth-subtitle {
    color: #a0aec0;
}

html.dark-mode .auth-standalone-container label {
    color: #e2e8f0;
}

html.dark-mode .auth-standalone-container input {
    background-color: #1a1a2e;
    border-color: #2d3748;
    color: #e2e8f0;
}

html.dark-mode .auth-standalone-container input::placeholder {
    color: #718096;
}

html.dark-mode .auth-standalone-container input:focus {
    background-color: #1a1a2e;
    border-color: #667eea;
    color: #e2e8f0;
}

html.dark-mode .auth-standalone-container .password-requirements {
    color: #718096;
}

html.dark-mode .auth-standalone-container p {
    color: #a0aec0;
}

/* --- Auth messages (error / success) --- */
html.dark-mode .auth-message.error {
    background: #3b1a1a;
    color: #fc8181;
    border-color: #742a2a;
}

html.dark-mode .auth-message.success {
    background: #1a3b2a;
    color: #68d391;
    border-color: #276749;
}

/* --- Back link --- */
html.dark-mode .auth-back-link a {
    color: #63b3ed;
}

/* --- Spinner --- */
html.dark-mode .auth-spinner {
    border-color: #2d3748;
    border-top-color: #667eea;
}

/* --- New email display (verify-email-change) --- */
html.dark-mode .auth-new-email {
    background: #1a3b2a;
    color: #68d391;
}

/* --- Divider line (signup) --- */
html.dark-mode .auth-divider-line {
    background: #2d3748;
}

/* --- Bootstrap alert overrides --- */
html.dark-mode .auth-page-bootstrap .alert {
    background-color: #1a1a2e;
    border-color: #2d3748;
    color: #e2e8f0;
}
