﻿/* ============================================================
   FireAnt Identity — Design System (Light, compact)
   Dùng chung cho các trang IdentityServer (login/consent/logout)
   và các trang MVC (đăng ký, quên mật khẩu, xác thực...)
   Màu chủ đạo lấy từ logo: cyan #05e6fd → blue #157cff.
   CSP: chỉ dùng tài nguyên same-origin, không font/ảnh ngoài.
   ============================================================ */

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

html { background-color: #f4f8fd; }

/* Angular chạy với ng-csp nên không tự tiêm CSS mặc định (ng-cloak/ng-hide) —
   phải khai báo thủ công tại đây, nếu thiếu thì ng-show/ng-hide không ẩn được phần tử. */
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak],
.ng-cloak, .x-ng-cloak,
.ng-hide:not(.ng-hide-animate) { display: none !important; }

ng\:form { display: block; }

.ng-animate-shim { visibility: hidden; }

body {
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: #1e2b3c;
    background-color: #f4f8fd;
    background-image:
        radial-gradient(820px 460px at 8% -6%, rgba(5, 230, 253, 0.10), transparent 60%),
        radial-gradient(760px 480px at 94% 108%, rgba(21, 124, 255, 0.09), transparent 62%),
        linear-gradient(170deg, #f8fbff 0%, #f4f8fd 50%, #f2f7fe 100%);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: #157cff; text-decoration: none; font-weight: 600; }
a:hover { color: #0f5fd0; text-decoration: underline; }

img { max-width: 100%; }
img.img-responsive { display: block; max-width: 100%; height: auto; }

/* ---------- Top bar ---------- */
.auth-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 28px;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none !important;
}

.auth-brand__mark {
    display: flex;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    box-shadow: 0 5px 14px -4px rgba(21, 124, 255, 0.45);
}

.auth-brand__mark svg { display: block; width: 100%; height: 100%; }

.auth-brand__name {
    font-size: 18.5px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #10233f;
}

.auth-brand__name em {
    font-style: normal;
    background: linear-gradient(120deg, #05c2e7, #157cff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #157cff;
}

/* Menu người dùng đã đăng nhập (dropdown thuần CSS) */
.auth-usermenu { position: relative; }

.auth-usermenu__toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #33455e;
    font-size: 13.5px;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 99px;
    border: 1px solid #dce7f5;
    background: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    text-decoration: none !important;
}

.auth-usermenu__toggle:hover { color: #10233f; background: #ffffff; border-color: #c8dbf3; text-decoration: none; }

.auth-usermenu__caret {
    display: inline-block;
    width: 0; height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    opacity: 0.55;
}

.auth-usermenu__panel {
    position: absolute;
    right: 0;
    top: calc(100% + 7px);
    min-width: 230px;
    background: #ffffff;
    border-radius: 13px;
    border: 1px solid #e8eff9;
    box-shadow: 0 16px 40px -12px rgba(16, 44, 84, 0.18);
    padding: 5px;
    display: none;
    z-index: 50;
}

.auth-usermenu:hover .auth-usermenu__panel,
.auth-usermenu:focus-within .auth-usermenu__panel { display: block; }

.auth-usermenu__panel a {
    display: block;
    padding: 9px 13px;
    border-radius: 9px;
    color: #1e2b3c;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.auth-usermenu__panel a:hover { background: #f2f7ff; color: #157cff; text-decoration: none; }

/* ---------- Khung nội dung chính ---------- */
.auth-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 16px 24px;
    width: 100%;
}

/* ---------- Card ---------- */
.auth-card {
    width: 100%;
    max-width: 450px;
    background: #ffffff;
    border: 1px solid #e9f0fa;
    border-radius: 18px;
    box-shadow:
        0 2px 6px rgba(16, 44, 84, 0.03),
        0 16px 40px -14px rgba(16, 44, 84, 0.10);
    padding: 30px 34px 26px;
}

.auth-card--wide  { max-width: 600px; }
.auth-card--xwide { max-width: 920px; }

.auth-card + .auth-card { margin-top: 16px; }

.auth-card__head { margin-bottom: 20px; }

.auth-title {
    margin: 0 0 5px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #10233f;
}

.auth-subtitle {
    margin: 0;
    font-size: 14px;
    color: #66788f;
}

/* ---------- Form ---------- */
.form-group { margin-bottom: 14px; }

label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 600;
    color: #33455e;
}

.form-control {
    display: block;
    width: 100%;
    height: 44px;
    padding: 0 15px;
    font-size: 15px;
    font-family: inherit;
    color: #10233f;
    background: #fafcff;
    border: 1.5px solid #e0e9f5;
    border-radius: 11px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

textarea.form-control { height: auto; padding: 11px 15px; }

.form-control::placeholder { color: #9db0c7; }

.form-control:focus {
    background: #ffffff;
    border-color: #157cff;
    box-shadow: 0 0 0 4px rgba(21, 124, 255, 0.12);
}

select.form-control {
    background-image:
        linear-gradient(45deg, transparent 50%, #66788f 50%),
        linear-gradient(135deg, #66788f 50%, transparent 50%);
    background-position: calc(100% - 20px) 19px, calc(100% - 15px) 19px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 40px;
    cursor: pointer;
}

/* Checkbox */
input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: #157cff;
    cursor: pointer;
    flex: none;
    margin: 1px 0 0;
}

.check-row {
    display: flex;
    align-items: flex-start;
    gap: 9px;
}

.check-row label,
.check-row .check-label {
    margin: 0;
    font-weight: 500;
    font-size: 13.5px;
    color: #52657f;
    cursor: pointer;
    line-height: 1.45;
}

/* Xếp 2 trường cùng một hàng cho gọn chiều cao (mật khẩu + xác nhận mật khẩu) */
.form-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0 12px;
}

.form-grid > .form-group {
    flex: 1 1 calc(50% - 6px);
    min-width: 150px;
}

/* Hàng tiện ích: ghi nhớ đăng nhập + quên mật khẩu */
.form-row-split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 20px;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: 0.01em;
    border-radius: 11px;
    border: 1.5px solid transparent;
    cursor: pointer;
    text-decoration: none !important;
    transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease, filter 0.15s ease;
    -webkit-user-select: none;
    user-select: none;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
    color: #ffffff !important;
    background: linear-gradient(135deg, #1ba8f5 0%, #157cff 65%, #1268e0 100%);
    box-shadow: 0 8px 20px -8px rgba(21, 124, 255, 0.55);
}

.btn-primary:hover {
    filter: brightness(1.06);
    box-shadow: 0 12px 26px -8px rgba(21, 124, 255, 0.65);
    text-decoration: none;
}

.btn-outline,
.btn-default {
    color: #33455e !important;
    background: #ffffff;
    border-color: #dce7f5;
}

.btn-outline:hover,
.btn-default:hover {
    background: #f6faff;
    border-color: #c8dbf3;
    text-decoration: none;
}

.btn-block { width: 100%; }

.btn-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-row .btn { flex: 1; min-width: 140px; }

/* Nút đăng nhập mạng xã hội — xếp 2 cột cho gọn chiều cao */
.btn-social {
    width: 100%;
    color: #33455e !important;
    background: #ffffff;
    border-color: #dce7f5;
    font-weight: 600;
    padding: 0 12px;
}

.btn-social:hover {
    background: #f6faff;
    border-color: #c8dbf3;
    box-shadow: 0 4px 14px -6px rgba(16, 44, 84, 0.14);
    text-decoration: none;
}

.btn-social svg { flex: none; }

.social-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.social-list li {
    flex: 1 1 calc(50% - 5px);
    min-width: 128px;
}

/* Divider "hoặc" */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0 13px;
    color: #9db0c7;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e8eff9;
}

/* Liên kết phụ dưới card */
.auth-alt {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #eef4fb;
    text-align: center;
    font-size: 14px;
    color: #66788f;
}

.auth-links {
    list-style: none;
    margin: 16px 0 0;
    padding: 14px 0 0;
    border-top: 1px solid #eef4fb;
    display: flex;
    justify-content: center;
    gap: 8px 26px;
    flex-wrap: wrap;
    font-size: 14px;
}

.auth-links li { margin: 0; }

/* ---------- Xác nhận đồng ý xử lý dữ liệu cá nhân ---------- */

/* Dòng tích chọn trên form — bấm vào sẽ mở hộp thoại chi tiết */
.consent-trigger { margin-bottom: 16px; }

.consent-trigger__link {
    color: #157cff;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.consent-trigger__link:hover { color: #0f5fd0; text-decoration: underline; }

.consent-trigger__state {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #7d8fa6;
    margin-top: 3px;
}

.consent-trigger__state--done { color: #0eaf72; }

/* Hộp thoại */
.fa-modal {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    background: rgba(10, 26, 51, 0.45);
}

.fa-modal.is-open { display: flex; }

.fa-modal__panel {
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 30px 70px -20px rgba(16, 44, 84, 0.45);
    overflow: hidden;
}

.fa-modal__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 24px 14px;
    border-bottom: 1px solid #eef4fb;
}

.fa-modal__head svg { color: #157cff; flex: none; }

.fa-modal__title {
    flex: 1;
    margin: 0;
    font-size: 16.5px;
    font-weight: 700;
    color: #10233f;
    letter-spacing: -0.01em;
}

.fa-modal__close {
    flex: none;
    width: 30px;
    height: 30px;
    border: 0;
    background: transparent;
    color: #93a7c2;
    font-size: 22px;
    line-height: 1;
    border-radius: 9px;
    cursor: pointer;
    padding: 0;
}

.fa-modal__close:hover { background: #f2f7ff; color: #52657f; }

.fa-modal__body {
    padding: 16px 24px 18px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.fa-modal__foot {
    padding: 14px 24px 18px;
    border-top: 1px solid #eef4fb;
}

/* Lỗi trong hộp thoại: chỉ hiện khi JS bật lên */
.consent-dialog-error { display: none; margin: 14px 0 0; }

.consent-box__lead {
    margin: 0 0 12px;
    font-size: 12.5px;
    line-height: 1.5;
    color: #66788f;
}

.consent-purposes {
    list-style: none;
    margin: 0;
    padding: 0;
}

.consent-purpose {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid #eef4fb;
}

.consent-purpose:first-child { border-top: 0; padding-top: 0; }

.consent-purpose__no {
    flex: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e8f1ff;
    color: #157cff;
    font-size: 11.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.consent-purpose--info .consent-purpose__no { background: #eef2f7; color: #8496ad; }

/* Mục đích luôn áp dụng: ô tích được đánh dấu sẵn và khoá lại.
   Trình duyệt tô xám ô disabled và bỏ qua accent-color, nên vẽ lại
   bằng CSS thuần để ra màu xanh nhạt — vẫn thấy rõ là đã bật. */
.consent-purpose input[type="checkbox"]:disabled {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    width: 17px;
    height: 17px;
    border-radius: 5px;
    border: 1.5px solid #a9cdfa;
    background: #d9e9ff;
    cursor: not-allowed;
    opacity: 1;
}

.consent-purpose input[type="checkbox"]:disabled::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid #4a90e2;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.consent-purpose--info .consent-purpose__title { color: #52657f; }

.consent-purpose__body { flex: 1; min-width: 0; }

.consent-purpose__title {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: #1e2b3c;
    line-height: 1.45;
}

/* Nhãn ở đây chỉ bọc tiêu đề mục đích nên để tiêu đề tự quyết định kiểu chữ */
.consent-purpose .check-row .check-label {
    font-size: inherit;
    color: inherit;
    line-height: inherit;
}

.consent-tag {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #52657f;
    background: #eef2f7;
    border-radius: 99px;
    padding: 2px 8px;
    margin-left: 6px;
    vertical-align: 1px;
    white-space: nowrap;
}

.consent-tag--required { color: #b45309; background: #fff2dc; }

.consent-notes {
    margin-top: 10px;
    border-top: 1px solid #eef4fb;
    padding-top: 10px;
}

.consent-notes > summary {
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 600;
    color: #157cff;
    list-style: none;
    outline: none;
}

.consent-notes > summary::-webkit-details-marker { display: none; }

.consent-notes > summary::before {
    content: "";
    display: inline-block;
    width: 0; height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 5px solid currentColor;
    margin-right: 7px;
    transition: transform 0.15s ease;
}

.consent-notes[open] > summary::before { transform: rotate(90deg); }

.consent-notes ul {
    margin: 9px 0 0;
    padding-left: 18px;
    font-size: 12px;
    line-height: 1.55;
    color: #7d8fa6;
}

.consent-notes li + li { margin-top: 6px; }

/* Không có JavaScript: hộp thoại hiển thị thẳng trong form thay vì dạng modal,
   để người dùng vẫn đồng ý và đăng ký được. */
.no-js .fa-modal {
    display: block;
    position: static;
    padding: 0;
    background: none;
    margin-bottom: 16px;
}

.no-js .fa-modal__panel {
    max-width: none;
    max-height: none;
    border: 1px solid #e0e9f5;
    border-radius: 13px;
    box-shadow: none;
}

.no-js .fa-modal__close,
.no-js .fa-modal__foot,
.no-js .consent-trigger { display: none; }

@media (max-width: 520px) {
    .fa-modal { padding: 12px 10px; }
    .fa-modal__panel { max-height: calc(100vh - 24px); }
    .fa-modal__head { padding: 15px 18px 12px; }
    .fa-modal__body { padding: 14px 18px 16px; }
    .fa-modal__foot { padding: 12px 18px 16px; }
}

/* ---------- Alerts & validation ---------- */
.alert {
    padding: 11px 15px;
    border-radius: 11px;
    font-size: 13.5px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.alert-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.alert-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #15803d;
}

.text-danger,
.field-validation-error {
    display: block;
    color: #dc2626;
    font-size: 12.5px;
    font-weight: 600;
    margin-top: 5px;
}

.field-validation-valid { display: none; }

.validation-summary-errors {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    border-radius: 11px;
    padding: 11px 15px;
    font-size: 13.5px;
    margin-bottom: 16px;
}

.validation-summary-errors ul { margin: 0; padding-left: 18px; }
.validation-summary-valid { display: none; }

input.input-validation-error {
    border-color: #f87171;
    background: #fffafa;
}

input.input-validation-error:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.10);
}

/* ---------- Trang thông báo (confirmation) ---------- */
.auth-notice { text-align: center; }

.auth-notice .auth-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-icon--success { background: #e9fbf2; color: #0eaf72; }
.auth-icon--mail    { background: #eaf3ff; color: #157cff; }
.auth-icon--error   { background: #fef2f2; color: #ef4444; }

.auth-notice p {
    color: #52657f;
    font-size: 14.5px;
    margin: 0 0 12px;
}

.auth-notice p:last-child { margin-bottom: 0; }

.request-id {
    margin-top: 12px;
    font-size: 12.5px;
    color: #9db0c7;
}

/* ---------- Trang consent (cấp quyền) ---------- */
.consent-client {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 18px;
}

.consent-client img {
    width: 46px;
    height: 46px;
    border-radius: 11px;
    object-fit: cover;
    border: 1px solid #e8eff9;
}

.consent-lead {
    font-size: 13.5px;
    color: #66788f;
    margin: 0 0 14px;
}

.scope-group {
    border: 1px solid #e8eff9;
    border-radius: 13px;
    overflow: hidden;
    margin-bottom: 14px;
}

.scope-group__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: #f7faff;
    border-bottom: 1px solid #eef4fb;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #52657f;
}

.scope-group__head svg { color: #157cff; }

.scope-group ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.scope-item {
    padding: 11px 15px;
    border-bottom: 1px solid #f2f7fd;
}

.scope-item:last-child { border-bottom: none; }

.scope-item label {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #10233f;
    cursor: pointer;
}

.scope-item .consent-description {
    margin: 3px 0 0 26px;
}

.scope-item .consent-description label {
    font-size: 13px;
    font-weight: 500;
    color: #66788f;
}

.tag-required {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #0f5fd0;
    background: #e4f0ff;
    border-radius: 99px;
    padding: 2px 8px;
    margin-left: 7px;
}

.consent-remember { margin: 2px 0 16px; }

/* ---------- Trang điều khoản ---------- */
.terms-body { color: #33455e; font-size: 14px; }
.terms-body p { margin: 0 0 10px; }
.terms-body .terms-h {
    font-weight: 700;
    color: #10233f;
    margin: 18px 0 9px;
    font-size: 15px;
}

/* ---------- Trang xử lý trung gian (authorize response) ---------- */
.auth-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border-radius: 50%;
    border: 4px solid #dcedff;
    border-top-color: #157cff;
    animation: fa-spin 0.8s linear infinite;
}

@keyframes fa-spin { to { transform: rotate(360deg); } }

/* ---------- Footer ---------- */
.auth-footer {
    text-align: center;
    padding: 10px 16px 16px;
    font-size: 12px;
    color: #93a7c2;
}

.auth-footer a { color: #66788f; }
.auth-footer a:hover { color: #157cff; }

/* ---------- Iframe đăng xuất (ẩn) ---------- */
iframe.signout {
    display: none;
    width: 0;
    height: 0;
    border: 0;
}

/* ---------- Màn hình thấp: siết thêm khoảng cách dọc ---------- */
@media (max-height: 740px) {
    .auth-topbar { padding: 9px 24px; }
    .auth-main { padding: 8px 16px 14px; }
    .auth-card { padding: 22px 30px 20px; }
    .auth-card__head { margin-bottom: 15px; }
    .auth-title { font-size: 20px; }
    .form-group { margin-bottom: 10px; }
    .form-row-split { margin-bottom: 13px; }
    .form-control, .btn { height: 42px; }
    .auth-divider { margin: 13px 0 10px; }
    .auth-links { margin-top: 12px; padding-top: 11px; }
    .auth-alt { margin-top: 13px; padding-top: 11px; }
    .auth-footer { padding: 6px 16px 11px; }

    .auth-notice .auth-icon { width: 50px; height: 50px; margin-bottom: 13px; }
    .consent-client { margin-bottom: 11px; }
    .consent-lead { margin-bottom: 9px; }
    .scope-group { margin-bottom: 10px; }
    .scope-item { padding: 8px 14px; }
    .scope-item .consent-description { margin-top: 2px; }
    .scope-group__head { padding: 7px 14px; }
    .consent-remember { margin-bottom: 11px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 520px) {
    .auth-topbar { padding: 12px 18px; }
    .auth-main { padding: 12px 12px 24px; }
    .auth-card { padding: 26px 20px 22px; border-radius: 16px; }
    .auth-title { font-size: 21px; }
    .btn-row .btn { flex: 1 1 100%; }
}
