/* Trang đăng nhập: một trang độc lập, không dùng _Layout nên style gói gọn ở đây. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Thuoc tinh hidden phai thang moi rule display (vd .qr-expired display:flex),
   neu khong lop phu "het han" se che ma QR ngay tu dau. */
[hidden] { display: none !important; }

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    /* svh: chiều cao thật trên mobile (trừ thanh địa chỉ); vh là fallback. */
    min-height: 100vh;
    min-height: 100svh;
    background: linear-gradient(135deg, #c7d9f5 0%, #dce8fb 40%, #e8eeff 70%, #c8d6f0 100%);
    display: flex;
    position: relative;
    /* Không khoá overflow dọc: bản mobile gập dọc cao hơn màn hình, khoá là hết cuộn. */
    overflow-x: hidden;
    overflow-y: auto;
}

body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
}

body::before {
    top: -120px;
    left: -120px;
    width: 480px;
    height: 480px;
    background: radial-gradient(circle, rgba(99, 156, 246, .35) 0%, transparent 70%);
}

body::after {
    bottom: -100px;
    right: -100px;
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, rgba(148, 181, 255, .3) 0%, transparent 70%);
}

.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    width: 100%;
    padding: 40px 16px;
    z-index: 1;
    /* margin:auto thay cho căn giữa ở body: nội dung thấp hơn màn hình thì vẫn giữa,
       cao hơn thì cuộn tới được cả đầu lẫn cuối. */
    margin: auto;
}

/* ── Thương hiệu ── */
.brand-header { text-align: center; }

.brand-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    box-shadow: 0 8px 24px rgba(37, 99, 235, .32);
}

.brand-icon i { font-size: 34px; color: #fff; }
.brand-title { font-size: 24px; font-weight: 700; color: #1e293b; margin-bottom: 4px; }
.brand-sub { font-size: 14px; color: #64748b; }

/* ── Thẻ ── */
.login-card {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 720px;
    box-shadow: 0 12px 48px rgba(30, 60, 120, .12);
    overflow: hidden;
}

.card-cols { display: flex; align-items: stretch; }
.panel { padding: 36px 34px 30px; }

.panel-qr {
    flex: 0 0 44%;
    background: linear-gradient(160deg, #f8fbff 0%, #eef4ff 100%);
    border-right: 1px solid #eef2f7;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.panel-form { flex: 1; }

.card-title { font-size: 22px; font-weight: 700; color: #1e293b; margin-bottom: 4px; }
.card-title.sm { font-size: 18px; }
.card-sub { font-size: 13px; color: #64748b; margin-bottom: 26px; }
.card-sub.tight { margin-bottom: 16px; }

/* ── Ô nhập ── */
.field-group { margin-bottom: 18px; }

.field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 7px;
}

.field-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    transition: border-color .18s, box-shadow .18s;
}

.field-wrap:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .12);
    background: #fff;
}

.field-icon { padding: 0 12px; color: #94a3b8; font-size: 15px; flex-shrink: 0; }

.field-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 8px 10px 0;
    font-size: 14px;
    color: #1e293b;
    outline: none;
}

.field-input::placeholder { color: #94a3b8; }

.toggle-pw {
    padding: 0 12px;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
}

.toggle-pw:hover { color: #3b82f6; }

.field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.checkbox-wrap { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-wrap input[type=checkbox] { width: 16px; height: 16px; accent-color: #2563eb; cursor: pointer; }
.checkbox-label { font-size: 13px; color: #475569; }

/* ── Báo lỗi ── */
.error-box {
    display: none;
    align-items: center;
    gap: 8px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 10px 14px;
    color: #dc2626;
    font-size: 13px;
    margin-bottom: 16px;
}

.error-box.visible { display: flex; }

/* ── Nút ── */
.btn-login {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(37, 99, 235, .35);
    transition: opacity .2s, transform .1s;
}

.btn-login:hover { opacity: .92; }
.btn-login:active { transform: scale(.98); }
.btn-login:disabled { opacity: .7; cursor: default; }

#btnContent { display: flex; align-items: center; justify-content: center; gap: 8px; }

.spinner-sm {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.spinner-sm.blue { border-color: #cbd5e1; border-top-color: #2563eb; }

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

/* ── Mã QR ── */
.qr-wrap { position: relative; display: inline-block; }

.qr-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    min-width: 192px;
    min-height: 192px;
    margin: 4px auto 14px;
}

.qr-expired {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, .93);
    backdrop-filter: blur(2px);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    padding: 10px;
}

.qr-expired i { font-size: 26px; color: #dc2626; }
.qr-expired .exp-title { font-size: 13px; color: #dc2626; font-weight: 600; }

.btn-newqr {
    padding: 8px 16px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-newqr:hover { opacity: .92; }

.qr-status {
    font-size: 13px;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.qr-status.err { color: #dc2626; }
.qr-status.ok { color: #166534; }

@media (max-width: 640px) {
    .card-cols { flex-direction: column; }
    .panel-qr { flex: none; border-right: none; border-bottom: 1px solid #eef2f7; }
    /* Mobile gập dọc rất dài, bóp khoảng trống cho đỡ phải cuộn. */
    .login-page { padding: 20px 12px; gap: 18px; }
    .panel { padding: 24px 20px 22px; }
}
