/* login.css - styles for the new login page */
:root {
    /* use base.html palette */
    --bg: #f4f6f8;
    /* same as .content background in base.html */
    --card: #ffffff;
    --muted: #6b7280;
    --primary: #2c3e50;
    /* sidebar color from base.html */
    --accent: #2c3e50;
    /* same accent for headings */
    --error: #9f1239;
    /* inline error text color */
    --primary-hover: #34495e;
    /* hover/darker variant */
    --shadow: 0 6px 18px rgba(44, 62, 80, 0.08);
}

body {
    background: var(--bg);
    margin: 0;
    font-family: Arial, sans-serif;
    color: #111827;
}

/* Two-column auth layout: intro on the left, login on the right */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    /* reduce gap between intro and login */
    padding: 48px 32px;
    /* slightly narrower page padding */
    box-sizing: border-box;
    max-width: 1080px;
    /* cap layout width to avoid excessive whitespace on wide screens */
    margin: 0 auto;
    /* center container */
}

.intro-panel {
    flex: 1 1 46%;
    max-width: 480px;
    /* narrower intro so login panel sits closer */
    padding-left: 12px;
}

.intro-title {
    font-size: 28px;
    color: var(--accent);
    margin: 0 0 16px 0;
}

.intro-lead {
    color: #475569;
    font-size: 16px;
    margin-bottom: 18px;
}

.intro-features li {
    margin: 8px 0;
    color: #374151;
}

.intro-cta {
    color: var(--muted);
    font-size: 14px;
}

.login-panel {
    flex: 0 0 420px;
}

/* flash messages displayed above the login card */
.flash-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    align-items: stretch;
}

.flash {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.2;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

/* semantic variants (map to common Flask categories: success, error, warning, info) */
.flash-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #bbf7d0;
}

.flash-error {
    background: #fff1f2;
    color: #9f1239;
    border: 1px solid #fecaca;
}

.flash-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.flash-info {
    background: #eff6ff;
    color: #1e3a8a;
    border: 1px solid #bfdbfe;
}

/* fallback generic style */
.flash:not(.flash-success):not(.flash-error):not(.flash-warning):not(.flash-info) {
    background: #f8fafc;
    color: #0f172a;
    border: 1px solid #e6eef6;
}

.login-card {
    width: 100%;
    background: var(--card);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 32px;
    box-sizing: border-box;
    text-align: center;
}

.login-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}

.logo-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #111827;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
}

.login-title {
    margin: 8px 0 18px 0;
    font-size: 20px;
    color: var(--accent);
}

.login-form {
    display: block;
    text-align: left
}

.input {
    width: 100%;
    padding: 12px 14px;
    margin: 8px 0 14px 0;
    border: 1px solid #e6e9ee;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    background: #f3f7fb;
}

/* Make the code row spacing match a single input field */
.code-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 8px 0 14px 0;
}

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* left: message, right: forgot-link */
    gap: 12px;
    margin-bottom: 10px;
}

.form-flash-wrapper {
    flex: 1 1 auto;
}

/* inline form flash: no border, red text only */
.form-flash {
    background: transparent;
    border: none;
    color: var(--error);
    padding: 0;
    margin: 0;
    font-size: 13px;
}

.form-flash-error {
    color: var(--error);
}

/* stronger override to ensure inline form flash shows plain red text without border */
.flash.form-flash,
.flash.form-flash-error {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--error) !important;
    padding: 0 !important;
    margin: 0 !important;
}

.link-muted {
    color: var(--muted);
    font-size: 13px;
    text-decoration: none
}

.link-muted:hover {
    text-decoration: underline
}

.btn-primary {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: none;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    margin-top: 4px;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

/* Inline action button inside an input field (for phone code) */
.input-with-action {
    position: relative;
}

.input-with-action .action-target {
    padding-right: 110px;
    /* reserve space for the inline button */
}

.input-action {
    position: absolute;
    right: 11px;
    /* left shift by 5px */
    /* move down 2px and reduce height by 5px (exact using half-pixels) */
    top: 11.5px;
    bottom: 17.5px;
    transform: none;
    box-sizing: border-box;
    padding: 0 10px;
    border-radius: 6px;
    border: 1px solid #e6e9ee;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

/* Improve keyboard focus without the default bright outline that can look offset */
.input-action:focus-visible {
    box-shadow: 0 0 0 2px #bfdbfe;
    border-color: #93c5fd;
}

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0
}

.divider:before,
.divider:after {
    content: '';
    flex: 1;
    height: 1px;
    background: #eceef3
}

.divider span {
    font-size: 13px;
    color: var(--muted)
}

.socials {
    display: flex;
    flex-direction: column;
    gap: 8px
}

.btn-social {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e6e9ee;
    background: #fff;
    cursor: pointer;
    font-size: 14px
}

.btn-google {
    display: block
}

.btn-apple {
    display: block
}

.signup-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
    align-items: center
}

.text-muted {
    color: var(--muted);
    font-size: 13px
}

.link-primary {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none
}

.link-primary:hover {
    text-decoration: underline
}

.passkey-row {
    margin-top: 10px
}

.visually-hidden {
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap
}

/* responsive: stack panels on smaller screens */
@media (max-width: 900px) {
    .auth-container {
        flex-direction: column-reverse;
        align-items: center;
        padding: 28px 18px;
    }

    .intro-panel {
        order: 2;
        max-width: 100%;
        padding-left: 0;
        margin-top: 18px;
        text-align: center;
    }

    .login-panel {
        order: 1;
        width: 100%;
        max-width: 480px;
    }

    .login-card {
        padding: 20px;
    }
}

/* Login method switch */
.login-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 8px 0 12px 0;
}

.switch-btn {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #e6e9ee;
    background: #fff;
    color: #111827;
    font-weight: 600;
    cursor: pointer;
}

.switch-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pane-wrapper {
    position: relative;
    display: flow-root;
    /* 防止内部最后一个元素的 margin 折叠，避免高度被吃掉导致切换高度变化 */
    padding-bottom: 1px;
    /* 轻微内边距，进一步避免 margin 折叠产生的抖动 */
}

/* Ensure any element marked [hidden] is not rendered (extra safety across sections) */
[hidden] {
    display: none !important;
}