﻿/* container & headings */
.form-card {
    max-width: 760px;
    margin: 32px auto;
    padding: 24px;
    background: #fff;
    border: 1px solid #e9eef5;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(10, 30, 66, .06);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 15px;
}

.form-title, .section-title {
    font-weight: 650;
    color: #1f2a44;
    margin: 0 0 18px;
    text-align: center;
}

.section-title {
    margin-top: 28px;
}

.hr-soft {
    border: 0;
    border-top: 1px solid #eef2f7;
    margin: 24px 0;
}

/* Controls */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #27324a;
    margin-bottom: 6px;
}

.form-control, select,
input[type="text"], input[type="email"], input[type="tel"],
input[type="number"], input[type="date"] {
    display: block;
    width: 100%;
    height: 44px;
    padding: 10px 12px;
    border: 1px solid #cfd7e6;
    border-radius: 8px;
    background: #fff;
    line-height: 1.2;
    box-sizing: border-box;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.form-control:focus, select:focus, input[type="date"]:focus {
    outline: none;
    border-color: #4d79c7;
    box-shadow: 0 0 0 3px rgba(77, 121, 199, .15);
}

/* MVC unobtrusive errors */
.field-validation-error, .text-danger {
    color: #c0392b;
    font-size: 13px;
}

/* Choice groups */
.choice-group {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.choice-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.radio-solid {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    transition: background-color .2s, border-color .2s;
}

.radio-solid:checked {
    background-color: #1e87f0;
    border-color: #1e87f0;
}

.radio-solid::before, .radio-solid::after {
    display: none !important;
    content: none !important;
}

/* Group Văn bằng */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1.5px solid #ccc;
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all .2s;
    user-select: none;
}

.checkbox-item:hover {
    border-color: #888;
    background: #f5f5f5;
}

.checkbox-item input[type="checkbox"] {
    appearance: none;
    width: 20px;
    height: 20px;
    margin-right: 14px;
    border: 2px solid #ccc;
    border-radius: 50%;
    transition: .2s;
}

.checkbox-item input[type="checkbox"]:checked {
    background: #1e87f0;
    border-color: #1e87f0;
}

/* Văn bằng block*/
.vanbang-container {
    margin-top: 18px;
}

.vanbang-block {
    border: 1px solid #e6ebf4;
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 16px;
    background: #fff;
}

.vanbang-block h5 {
    margin: 0 0 14px;
    font-size: 15px;
    font-weight: 700;
    color: #2b5fb8;
    background: #f3f7ff;
    padding: 8px 12px;
    border-radius: 8px;
}

/*button*/
.btn {
    display: inline-block;
    padding: 11px 22px;
    border-radius: 10px;
    border: 0;
    font-weight: 650;
    cursor: pointer;
    transition: transform .05s ease, opacity .15s ease, box-shadow .15s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: #316bd6;
    color: #fff;
    box-shadow: 0 6px 12px rgba(49,107,214,.18);
}

.btn-primary:hover {
    opacity: .92;
}

.btn-success {
    background: #1aa06d;
    color: #fff;
    box-shadow: 0 6px 12px rgba(26,160,109,.18);
}

.btn-success:hover {
    opacity: .92;
}

.mt-2 {
    margin-top: .5rem;
}

.d-none {
    display: none !important;
}

/* utilities */
.inline-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.choice-vertical {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fw-bold {
    font-weight: 700;
}

/* nút phụ cho "Kiểm tra" */
.btn-secondary {
    background: #e9edf5;
    color: #222;
    box-shadow: 0 3px 8px rgba(0,0,0,.06);
}

.btn-secondary:hover {
    opacity: .92;
}

.apply-form .choice-vertical {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.apply-form .choice-vertical .choice-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Tăng cỡ chữ tổng thể (đỡ cảm giác "nhỏ") */
.flatpickr-calendar {
    font-size: 14px;
}

/* Header của lịch: luôn hiện tháng + năm trên một dòng đẹp */
.flatpickr-months {
    justify-content: space-between;
}

.flatpickr-current-month {
    display: flex;
    align-items: center;
    gap: .5rem; /* khoảng cách giữa tháng & năm */
}

/* BẮT BUỘC: không cho phần năm bị ẩn/thu nhỏ */
.flatpickr-current-month .numInputWrapper {
    display: inline-flex !important;
    visibility: visible !important;
}

/* Chiều rộng input năm (4 chữ số) */
.flatpickr-current-month .numInputWrapper input.cur-year {
    width: 5.4ch; /* đủ cho "2025" */
    min-width: 5ch;
}

/* Ẩn mũi tên tăng/giảm năm nếu bạn không thích */
.flatpickr-current-month .numInputWrapper span.arrowUp,
.flatpickr-current-month .numInputWrapper span.arrowDown {
    display: none; /* tùy chọn */
}

/* Dropdown tháng rộng hơn để không đè vào năm */
.flatpickr-monthDropdown-months {
    min-width: 9rem;
}

/* Nếu popup bị chèn dưới các phần tử khác */
.flatpickr-calendar {
    z-index: 10000;
}

/* Responsive */
@media (max-width: 640px) {
    .form-card {
        margin: 16px;
        padding: 18px;
    }
}

/* Checkbox văn bằng đã có */
.checkbox-item.is-locked {
    opacity: 0.6;
    pointer-events: none; /* chặn click */
}

/* Card hiển thị văn bằng đã có */
.vb-card {
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
}

.vb-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.vb-card__title {
    font-weight: 600;
}

.vb-card__tag {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eee;
}

.vb-card__tag--new {
    background: #eaf7ea;
}

.vb-card--readonly {
    background: #fafafa;
}

.vb-card__grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 12px;
}

.vb-field label {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
    display: block;
}

.vb-field input[disabled], .vb-field input[readonly] {
    background: #f5f5f5;
}

@media (max-width: 640px) {
    .vb-card__grid {
        grid-template-columns: 1fr;
    }
}

.form-control[readonly],
input[readonly],
select:disabled,
.radio-solid:disabled {
    background: #f5f5f5;
    color: #666;
    cursor: not-allowed;
    opacity: .95;
}

/* Read-only look */
.is-readonly {
    background: #f5f7fb !important;
    color: #4b5563;
}

/* Khóa select nhưng vẫn submit được giá trị (không dùng disabled) */
.pe-none {
    pointer-events: none !important;
}

/* Radio đã chọn nhưng bị khóa vẫn giữ màu xanh */
.radio-solid.locked {
    pointer-events: none;
    background-color: #1e87f0 !important;
    border-color: #1e87f0 !important;
    opacity: 1;
    cursor: not-allowed;
}

/* Input "Khác" khi bị khóa */
#txtSkKhac.is-readonly {
    background: #f5f7fb !important;
}

/* Ẩn spin button cho number input (Chrome/Safari/Edge/Opera) */
input[type="number"].no-spin::-webkit-outer-spin-button,
input[type="number"].no-spin::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Ẩn spin button cho Firefox + chuẩn */
input[type="number"].no-spin {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* ===================== IMPROVE / ADDITIONS ===================== */

/* 0) Biến màu dùng chung (dễ chỉnh theme sau này) */
:root {
    --c-primary: #316bd6;
    --c-primary-600: #2a59bb;
    --c-ring: rgba(49,107,214,.25);
    --c-border: #cfd7e6;
    --c-border-soft: #e6eaf5;
    --radius-8: 8px;
    --radius-10: 10px;
}

/* 1) Focus ring đồng bộ cho control & nút (dùng :focus-visible để đỡ chói) */
.form-control:focus-visible, select:focus-visible, input[type="date"]:focus-visible,
.btn:focus-visible,
.checkbox-item:has(input:focus-visible),
.choice-item:has(input:focus-visible) {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px var(--c-ring);
}

/* 2) Văn bằng: hiển thị dạng ma trận 4 cột, tự co giãn */
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 12px 16px;
    margin-bottom: 18px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--c-border-soft);
    border-radius: var(--radius-10);
    background: #fff;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

    .checkbox-item:hover {
        background: #f6f8ff;
        border-color: #cfe0ff;
    }

    /* accent màu xanh cho input trong label */
    .checkbox-item input[type="checkbox"] {
        width: 18px;
        height: 18px;
        accent-color: var(--c-primary);
        margin: 0;
    }

/* Responsive: thu dần số cột */
@media (max-width: 920px) {
    .checkbox-group {
        grid-template-columns: repeat(3,1fr);
    }
}

@media (max-width: 680px) {
    .checkbox-group {
        grid-template-columns: repeat(2,1fr);
    }
}

@media (max-width: 420px) {
    .checkbox-group {
        grid-template-columns: 1fr;
    }
}

/* 3) Radio “solid” có vòng tròn trong (đỡ cảm giác bị tô kín) */
.radio-solid {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #bbb;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    display: inline-grid;
    place-items: center;
    transition: border-color .15s ease, box-shadow .15s ease;
}

    .radio-solid:checked {
        border-color: var(--c-primary);
        box-shadow: 0 0 0 3px var(--c-ring);
    }

        .radio-solid:checked::after {
            content: "";
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: var(--c-primary);
        }

/* 4) Nút: đảm bảo tap-target >= 44px, hover/focus đồng bộ */
.btn {
    min-height: 44px;
}

.btn-primary {
    background: var(--c-primary);
    box-shadow: 0 6px 12px rgba(49,107,214,.18);
}

    .btn-primary:hover {
        background: var(--c-primary-600);
        opacity: 1;
    }

/* 5) Tiện ích bố cục 2 cột cho các nhóm field (tuỳ dùng) */
.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 12px;
}

@media (max-width: 720px) {
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* 6) Sửa nhẹ .form-control viền & radius theo biến */
.form-control, select,
input[type="text"], input[type="email"], input[type="tel"],
input[type="number"], input[type="date"] {
    border: 1px solid var(--c-border);
    border-radius: var(--radius-8);
}

/* 7) Card văn bằng “đã có” – hover nhẹ cho cảm giác clickable */
.vb-card {
    transition: box-shadow .15s ease, border-color .15s ease;
}

    .vb-card:hover {
        border-color: #dfe6ff;
        box-shadow: 0 8px 24px rgba(31,42,68,.06);
    }

.form-card > button[type="submit"].btn-primary {
    display: block;
    margin-left: auto; /* chìa sang phải */
    margin-top: 12px;
}

.form-actions {
    text-align: right;
    margin-top: 20px; /* khoảng cách phía trên */
}

.checkbox-group .checkbox-item:has(input[value="Chứng chỉ bồi dưỡng nghiệp vụ công tác xã hội"]) {
    grid-column: auto; /* không span hết */
    width: max-content; /* dài vừa chữ */
    white-space: nowrap; /* không tự xuống dòng */
    padding-right: 18px;
}