/* Humyze override for pyzza_auth/static/auth/css/login.css.
   This file intentionally replaces the upstream file through Pyzza resource overlay. */
/**
 * Login Page - Apple-inspired Design
 * 遵循站点设计语言和苹果 Human Interface Guidelines
 */

/* Container */
.auth-container {
    --auth-primary-bg: #1d1d1f;
    --auth-primary-bg-hover: #000000;
    --auth-primary-text: #ffffff;
    --auth-field-bg: rgba(255, 255, 255, 0.78);
    --auth-focus-ring: rgba(29, 29, 31, 0.12);
    --auth-border-strong: rgba(29, 29, 31, 0.18);
    min-height: calc(100svh - var(--nav-height, 52px));
    background: linear-gradient(180deg, #fbfbfd 0%, #f5f5f7 52%, #f2f3f5 100%);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: clamp(32px, 8vh, 72px) 18px 44px;
}

/* Card */
.auth-card {
    width: 100%;
    max-width: 408px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: saturate(180%) blur(22px);
    -webkit-backdrop-filter: saturate(180%) blur(22px);
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.08), 0 1px 0 rgba(255, 255, 255, 0.72) inset;
    padding: clamp(26px, 5vw, 36px);
    transition: box-shadow 150ms ease, border-color 150ms ease;
}

.auth-card:hover {
    border-color: var(--auth-border-strong);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.72) inset;
}

/* Title */
.auth-title {
    font-size: clamp(24px, 4vw, 26px);
    font-weight: 720;
    color: #1d1d1f;
    text-align: center;
    margin: 0 0 24px 0;
    letter-spacing: 0;
    line-height: 1.15;
}

/* Form */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-input-group {
    position: relative;
}

/* Input */
.auth-input {
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    font-size: 15px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    background-color: var(--auth-field-bg);
    color: #1d1d1f;
    caret-color: #1d1d1f;
    letter-spacing: 0;
    transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.auth-input:focus {
    outline: none;
    border-color: #1d1d1f;
    box-shadow: 0 0 0 4px var(--auth-focus-ring);
    background-color: #ffffff;
}

.auth-input::placeholder {
    color: var(--color-muted);
    opacity: 0.6;
}

/* Email actions */
.auth-actions {
    display: grid;
    gap: 10px;
    margin-top: 8px;
}

.auth-submit-btn,
.auth-secondary-btn {
    width: 100%;
    min-height: 44px;
    font-size: 0.94rem;
    font-weight: 600;
    letter-spacing: 0;
    padding: 0 24px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease, color 150ms ease;
    -webkit-tap-highlight-color: transparent;
}

.auth-submit-btn {
    background-color: var(--auth-primary-bg);
    color: var(--auth-primary-text);
    border: 1px solid var(--auth-primary-bg);
    box-shadow: none;
}

.auth-submit-btn:hover {
    background-color: var(--auth-primary-bg-hover);
    border-color: var(--auth-primary-bg-hover);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14);
}

.auth-secondary-btn {
    background: #ffffff;
    color: #1d1d1f;
    border: 1px solid #d2d2d7;
    box-shadow: none;
}

.auth-secondary-btn:hover {
    background: #ffffff;
    border-color: #86868b;
}

.auth-submit-btn:active,
.auth-secondary-btn:active {
    transform: translateY(1px);
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 24px 0;
    color: var(--color-muted);
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 0.5px solid var(--color-border);
}

.auth-divider span {
    padding: 0 16px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0;
}

/* Social Buttons */
.auth-social-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    border: 1px solid #d2d2d7;
    border-radius: 4px;
    background-color: #ffffff;
    font-size: 15px;
    font-weight: 500;
    color: #1d1d1f;
    letter-spacing: 0;
    cursor: pointer;
    transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
    -webkit-tap-highlight-color: transparent;
}

.auth-social-btn:hover {
    background-color: #ffffff;
    border-color: #86868b;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

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

.auth-social-btn i {
    font-size: 20px;
}

.auth-social-btn.google i {
    color: #ea4335;
}

.auth-social-btn.facebook i {
    color: #1877f2;
}

.auth-social-btn.reddit i {
    color: #FF4500;
}

/* Options (Remember Me & Forgot Password) */
.auth-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
}

.auth-options .auth-link {
    font-size: 13px;
    font-weight: 500;
    color: #1d1d1f;
    text-decoration: none;
    letter-spacing: 0;
    transition: background 150ms ease, color 150ms ease;
    padding: 4px 8px;
    border-radius: 4px;
    -webkit-tap-highlight-color: transparent;
}

.auth-options .auth-link:hover {
    color: #1d1d1f;
    background: rgba(0, 0, 0, 0.04);
}

.auth-remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-remember-forgot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
}

.auth-remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-remember-me input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid #d2d2d7;
    cursor: pointer;
}

.auth-remember-me label {
    font-size: 13px;
    color: #6e6e73;
    font-weight: 500;
    letter-spacing: 0;
    cursor: pointer;
    user-select: none;
}

/* Terms/Policies consent */
.auth-terms {
    margin: 12px 0 0;
    padding: 12px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 4px;
    border: none;
}

.auth-terms-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.5;
    color: #6e6e73;
}
.auth-terms-item input[type="checkbox"] {
    /* Remove offset to align neatly with multi-line text */
    margin-top: 0;
    width: 18px;
    height: 18px;
    min-width: 18px; /* prevent flex shrink */
    min-height: 18px; /* prevent flex shrink */
    flex: 0 0 18px;   /* keep fixed size */
    flex-shrink: 0;   /* do not shrink when text wraps */
    align-self: flex-start;
    border-radius: 4px;
    border: 1px solid #d2d2d7;
    cursor: pointer;
}

/* Normalize checkbox appearance and size across browsers on auth pages */
.auth-card input[type="checkbox"] {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    accent-color: initial;
    width: 18px;
    height: 18px;
    border: 1px solid #d2d2d7;
    border-radius: 4px;
    background-color: #ffffff;
    background-image: none;
    display: inline-block;
    position: relative;
    vertical-align: middle;
    box-sizing: border-box;
    background-clip: padding-box;
    transform: none;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-card input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 4px var(--auth-focus-ring);
}

.auth-card input[type="checkbox"]:checked {
    background-color: #1d1d1f;
    border-color: #1d1d1f;
}

.auth-card input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 6px;
    width: 4px;
    height: 9px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Extra specificity to defeat UA/native styles that might sneak in */
.auth-remember-me input[type="checkbox"],
.auth-terms-item input[type="checkbox"] {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: none !important;
    accent-color: initial !important;
    width: 18px !important;
    height: 18px !important;
    border-radius: 4px !important;
}
.auth-terms-item span,
.auth-terms-item label {
    font-size: 13px;
    letter-spacing: 0;
}

/* Let text occupy remaining width and wrap without squeezing the checkbox */
.auth-terms-item span {
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    word-break: break-word;
}

.auth-terms-item a {
    color: #1d1d1f;
    text-decoration: none;
    font-weight: 500;
    transition: color 150ms ease;
}

.auth-terms-item a:hover {
    color: #1d1d1f;
    text-decoration: underline;
}

.auth-terms-item a:visited {
    color: #1d1d1f;
}

.auth-terms-sep {
    color: #6e6e73;
    opacity: 0.7;
}

.auth-forgot-password {
    display: flex;
    align-items: center;
}

.auth-forgot-password .auth-link {
    font-size: 14px;
    color: #1d1d1f;
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-forgot-password .auth-link:hover {
    color: #1d1d1f;
    text-decoration: underline;
}

.auth-input-group {
    position: relative;
}

/* Password Toggle */
.auth-password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--color-muted);
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s var(--ease-1);
    -webkit-tap-highlight-color: transparent;
}

.auth-password-toggle:hover {
    color: var(--color-text);
    background: var(--surface-subtle);
}

.auth-password-toggle i {
    font-size: 18px;
}

/* 确保密码输入框右侧有足够空间放置图标 */
.auth-input[type="password"],
.auth-input-group input[type="password"] {
    padding-right: 46px;
}

/* Prevent dark autofill background and ensure readable text */
.auth-input:-webkit-autofill,
.auth-input:-webkit-autofill:hover,
.auth-input:-webkit-autofill:focus {
    -webkit-text-fill-color: #1d1d1f !important;
    caret-color: #1d1d1f;
    transition: background-color 9999s ease-in-out 0s;
    box-shadow: 0 0 0px 1000px #ffffff inset;
}

/* Add error message styling */
.auth-error-message {
    color: var(--status-danger);
    background-color: var(--status-danger-bg);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    padding: 14px 18px;
    text-align: center;
    font-size: 14px;
    line-height: 1.45;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

body.auth-redirect-active {
    overflow: hidden;
}

.auth-redirect-overlay {
    position: fixed;
    inset: 0;
    z-index: 1150;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--scrim);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.auth-redirect-overlay[hidden] {
    display: none !important;
}

.auth-redirect-card {
    width: min(100%, 420px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 28px 24px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
    text-align: center;
}

.auth-redirect-spinner {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.18);
    border-top-color: #1d1d1f;
    animation: button-loading-spinner 0.8s linear infinite;
}

.auth-redirect-title {
    margin: 0;
    color: #1d1d1f;
    font-size: 19px;
    font-weight: 600;
    letter-spacing: 0;
}

.auth-redirect-message {
    margin: 0;
    color: #6e6e73;
    font-size: 14px;
    line-height: 1.55;
    max-width: 28ch;
}

/* Add loading state for buttons */
.auth-submit-btn.loading,
.auth-social-btn.loading {
    position: relative;
    color: transparent !important;
}

.auth-submit-btn.loading::after,
.auth-social-btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid var(--color-text);
    border-radius: 50%;
    border-right-color: transparent;
    animation: button-loading-spinner 0.75s linear infinite;
}

.auth-submit-btn.loading::after {
    border-color: #ffffff;
    border-right-color: transparent;
}

@keyframes button-loading-spinner {
    from {
        transform: rotate(0turn);
    }
    to {
        transform: rotate(1turn);
    }
}

/* 在现有的社交按钮样式后添加 TikTok 样式 */
.auth-social-btn.tiktok i {
    color: #000000; /* TikTok 图标颜色 */
}

/* 可选：添加 TikTok 特殊样式 */
.auth-social-btn.tiktok {
    background-color: #ffffff;
    border: 1px solid #d2d2d7;
}

.auth-social-btn.tiktok:hover {
    background-color: #ffffff;
}

/* 添加成功消息样式 */
.auth-success-message {
    color: var(--status-success);
    background-color: var(--status-success-bg);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    padding: 10px;
    margin: 10px 0;
    text-align: center;
    font-size: 14px;
}

/* 添加输入框错误样式 */
.auth-input-error {
    border-color: var(--status-danger) !important;
    box-shadow: 0 0 0 4px var(--status-danger-bg) !important;
    animation: shake 0.5s linear;
}

/* 为字段级别的错误消息添加样式 */
.field-error {
    color: var(--status-danger);
    font-size: 13px;
    margin-top: 4px;
    padding-left: 4px;
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes shake {
    0% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
    100% { transform: translateX(0); }
}

/* Keep login errors as a real toast so they are visible above the auth card. */
#errorMessage {
    position: fixed;
    top: calc(var(--nav-height, 52px) + 16px);
    left: 50%;
    transform: translateX(-50%);
    width: min(calc(100vw - 32px), 420px);
    margin: 0;
    z-index: 1200;
    display: none;
    opacity: 1;
}

/* 为forgot_password和reset_password页面的消息容器添加样式 */
.auth-message-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 400px;
    min-width: 300px;
    padding: 20px 24px;
    border-radius: 8px;
    font-size: 16px;
    text-align: center;
    transition: all 0.3s ease;
    display: none;
    z-index: 9999;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
    font-weight: 500;
    line-height: 1.4;
}

.auth-message-info {
    color: var(--status-info);
    background-color: var(--status-info-bg);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.auth-message-success {
    color: var(--status-success);
    background-color: var(--status-success-bg);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    padding: 10px;
    margin: 10px 0;
    text-align: center;
    font-size: 14px;
}

.auth-message-error {
    color: var(--status-danger);
    background-color: var(--status-danger-bg);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.auth-message-container.show {
    display: block !important;
    animation: messageSlideIn 0.3s ease-out;
}

.auth-message-container.hide {
    animation: messageSlideOut 0.3s ease-in;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes messageSlideOut {
    from {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
}

.auth-description {
    font-size: 16px;
    color: #6e6e73;
    text-align: center;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.auth-links {
    text-align: center;
    margin-top: 1.5rem;
}

.auth-links .auth-link {
    color: #1d1d1f;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

.auth-links .auth-link:hover {
    color: #1d1d1f;
    text-decoration: underline;
}

/* Consent Modal */
.auth-modal-backdrop {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1200;
    padding: 20px;
}

.auth-modal-card {
    width: 100%;
    max-width: 420px;
    max-height: 85vh;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: saturate(180%) blur(24px);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    color: #1d1d1f;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
    padding: 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
}

.auth-modal-title {
    font-size: 19px;
    font-weight: 600;
    color: #1d1d1f;
    letter-spacing: 0;
    margin: 0 0 12px;
    flex-shrink: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.auth-modal-message {
    font-size: 15px;
    color: #6e6e73;
    letter-spacing: 0;
    margin: 0 0 20px;
    line-height: 1.47;
    flex: 1;
    min-height: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow-y: auto;
}

/* Modal policy links */
.auth-modal-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 16px;
}

.auth-modal-link {
    color: #1d1d1f;
    font-weight: 500;
    text-decoration: none;
    letter-spacing: 0;
}

.auth-modal-link:hover {
    color: #1d1d1f;
    text-decoration: underline;
}

.auth-modal-link:visited {
    color: #1d1d1f;
}

.auth-modal-sep {
    color: #6e6e73;
    opacity: 0.7;
}

.auth-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.auth-modal-btn {
    border-radius: 4px;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0;
    padding: 8px 20px;
    cursor: pointer;
    border: 1px solid #d2d2d7;
    background: #ffffff;
    color: #1d1d1f;
    transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
    -webkit-tap-highlight-color: transparent;
}

.auth-modal-primary {
    background: #1d1d1f;
    color: #ffffff;
    border-color: #1d1d1f;
    font-weight: 600;
}

.auth-modal-primary:hover {
    background: #000000;
    border-color: #000000;
}

.auth-modal-secondary:hover {
    background: #ffffff;
    border-color: #86868b;
}

/* Responsive Design */
@media (max-width: 734px) {
    .auth-container {
        padding: clamp(20px, 4vw, 32px);
    }

    .auth-card {
        padding: clamp(24px, 5vw, 32px);
    }

    .auth-title {
        font-size: 24px;
        margin-bottom: 24px;
    }

    .auth-form {
        gap: 14px;
    }

    .auth-divider {
        margin: 20px 0;
    }

    .auth-social-buttons {
        gap: 10px;
    }

    .auth-terms {
        padding: 10px;
    }

    /* Modal 响应式 */
    .auth-modal-card {
        max-height: 80vh;
        padding: 20px;
    }

    .auth-modal-title {
        font-size: 17px;
    }

    .auth-modal-message {
        font-size: 14px;
    }

    .auth-modal-actions {
        gap: 8px;
    }

    .auth-modal-btn {
        font-size: 14px;
        padding: 8px 16px;
    }
}

@media (max-width: 374px) {
    .auth-card {
        padding: 20px;
    }

    .auth-input {
        padding: 10px 14px;
        font-size: 14px;
    }

    .auth-input[type="password"],
    .auth-input-group input[type="password"] {
        padding-right: 42px;
    }

    .auth-submit-btn,
    .auth-secondary-btn {
        padding: 10px 20px;
        font-size: 14px;
    }

    .auth-social-btn {
        padding: 10px 20px;
        font-size: 14px;
    }

    /* Modal 小屏优化 */
    .auth-modal-card {
        max-height: 75vh;
        padding: 16px;
        margin: 16px;
    }

    .auth-modal-title {
        font-size: 16px;
        margin-bottom: 10px;
    }

    .auth-modal-message {
        font-size: 13px;
        margin-bottom: 16px;
    }

    .auth-modal-btn {
        font-size: 13px;
        padding: 7px 14px;
    }

    .auth-modal-actions {
        flex-direction: column;
    }

    .auth-modal-actions .auth-modal-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .auth-message-container {
        max-width: 90vw;
        min-width: 280px;
        padding: 16px 20px;
        font-size: 15px;
        margin: 0 16px;
    }
}

/* Accessibility */
*:focus-visible {
    outline: 2px solid #1d1d1f;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
