#custom-corporate-download-form {
    max-width: 100%;
    margin: 0px auto;
    font-family: sans-serif;
    display: grid;
    grid-template-columns: 552px minmax(0, 1fr);
    gap: 0 40px;
    align-items: start;
}

#custom-corporate-download-form .acf-form-fields {
    display: contents;
}

/* Responsive */
@media (max-width: 768px) {
    #custom-corporate-download-form {
        display: flex;
        flex-direction: column;
        padding-left: 20px;
        padding-right: 20px;
        width: 100%;
        box-sizing: border-box;
        gap: 24px;
    }

    /* All direct children (fields, title, submit) go full width */
    #custom-corporate-download-form .acf-field,
    #custom-corporate-download-form .form-right-title,
    #custom-corporate-download-form .acf-form-submit {
        width: 100%;
        box-sizing: border-box;
    }

    /* Cards and inputs also full width */
    #custom-corporate-download-form .doc-card-list,
    #custom-corporate-download-form .doc-card-item,
    #custom-corporate-download-form .acf-input input[type="text"],
    #custom-corporate-download-form .acf-input input[type="email"],
    #custom-corporate-download-form .acf-input input[type="tel"],
    #custom-corporate-download-form .acf-form-submit .acf-button {
        width: 100% !important;
        box-sizing: border-box;
    }

    /* Reorder items for mobile: document selection first */
    #custom-corporate-download-form .acf-field[data-name="document_selection"] {
        order: -1;
    }
}

/* Left Column */
#custom-corporate-download-form .acf-field[data-name="document_selection"] {
    grid-column: 1;
    grid-row: 1 / span 20;
}

/* Right Column */
#custom-corporate-download-form .form-right-title,
#custom-corporate-download-form .acf-field:not([data-name="document_selection"]),
#custom-corporate-download-form .acf-form-submit {
    grid-column: 2;
    z-index: 30;
}

/* Title styles */
#custom-corporate-download-form .form-right-title,
#custom-corporate-download-form .acf-field[data-name="document_selection"]>.acf-label label {
    font-size: 15px !important;
    line-height: 22px !important;
    color: #005C89 !important;
    font-weight: 900 !important;
    margin-bottom: 18px !important;
    margin-top: 0;
    display: block !important;
    z-index: 30;
}

#custom-corporate-download-form .acf-field {
    border: none !important;
    padding: 0 !important;
    margin-bottom: 18px !important;
    /* gap 18px giữa các group label+input */
}

#custom-corporate-download-form .acf-field:last-child {
    margin-bottom: 0;
}


#custom-corporate-download-form .acf-label {
    margin-bottom: 8px !important;
}

#custom-corporate-download-form .acf-field[data-name="document_selection"] {
    margin-bottom: 0 !important;
    z-index: 30;
}

#custom-corporate-download-form .acf-label label {
    font-weight: 900;
    color: #1E293B;
    font-size: 13px;
    line-height: 22.1px;
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

#custom-corporate-download-form .acf-required {
    color: transparent;
    font-size: 0;
}

/* Badge 必須 - hiện tất cả các field bắt buộc (trừ privacy_policy) */
/* ACF renders: <label>Label<span class="acf-required">*</span></label> */
#custom-corporate-download-form .acf-label label span.acf-required {
    color: transparent !important;
    font-size: 0 !important;
    position: relative;
}

#custom-corporate-download-form .acf-label label span.acf-required::after {
    content: "必須";
    font-size: 10px;
    background-color: #FEEAEA;
    color: #C84444;
    padding: 2px 7px;
    margin-left: 10px;
    border-radius: 4px;
    font-weight: 900;
    display: inline-block;
    position: static;
}

/* Ẩn badge riêng cho field privacy_policy */
#custom-corporate-download-form .acf-field[data-name="privacy_policy"] .acf-label label span.acf-required::after {
    display: none !important;
    content: none !important;
}


#custom-corporate-download-form .acf-input input[type="text"],
#custom-corporate-download-form .acf-input input[type="email"],
#custom-corporate-download-form .acf-input input[type="number"],
#custom-corporate-download-form .acf-input input[type="tel"],
#custom-corporate-download-form .acf-input textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #D5E3F0;
    font-size: 14px;
    color: #1A2A3E;
    font-weight: 400;
    box-sizing: border-box;
    transition: all 0.2s ease;
    background-color: #fff;
    border-radius: 10px !important;
    line-height: 28px;
}

#custom-corporate-download-form .acf-input input[type="text"]::placeholder,
#custom-corporate-download-form .acf-input input[type="email"]::placeholder,
#custom-corporate-download-form .acf-input input[type="number"]::placeholder,
#custom-corporate-download-form .acf-input input[type="tel"]::placeholder,
#custom-corporate-download-form .acf-input textarea::placeholder {
    color: #757575 !important;
    opacity: 1 !important;
}

#custom-corporate-download-form .acf-input textarea {
    min-height: 150px;
}


#custom-corporate-download-form .acf-input input:focus,
#custom-corporate-download-form .acf-input textarea:focus {
    outline: none;
    border-color: #005C89 !important;
}


#custom-corporate-download-form .acf-field-checkbox {
    margin-top: 0px !important;
}

#custom-corporate-download-form .acf-checkbox-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#custom-corporate-download-form .acf-checkbox-list li {
    font-size: 14px;
    line-height: 24px;
    color: #3d5775;
    font-weight: 400;
    align-items: center;
}

#custom-corporate-download-form .acf-checkbox-list input[type="checkbox"] {
    appearance: none !important;
    -webkit-appearance: none !important;
    width: 16px !important;
    height: 16px !important;
    border-radius: 2.5px !important;
    border: 1px solid #767676 !important;
    background: #fff !important;
    cursor: pointer !important;
    position: relative !important;
    margin-right: 12px !important;
    display: inline-block !important;
}

#custom-corporate-download-form .acf-checkbox-list input[type="checkbox"]:checked {
    border-color: #005C89 !important;
    background-color: #005C89 !important;
}

#custom-corporate-download-form .acf-checkbox-list li label {
    display: flex;
    align-items: center;
}

#custom-corporate-download-form .acf-field[data-name="privacy_policy"]>.acf-label {
    display: none !important;
}

#custom-corporate-download-form .acf-field[data-name="privacy_policy"] .acf-checkbox-list li label a {
    color: #005C89;
    margin-right: 4px;
}



#custom-corporate-download-form .acf-form-submit {
    text-align: left;
    margin-top: 0px;
    position: relative;
}

#custom-corporate-download-form .acf-form-submit .acf-spinner {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
}

#custom-corporate-download-form .acf-form-submit .acf-button {
    background-color: #EA4044;
    color: #fff;
    padding: 16px 40px;
    border-radius: 8px;
    border: none;
    font-size: 16px;
    line-height: 100%;
    font-weight: 900;
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0px 8px 22px 0px rgba(234, 64, 68, 0.32);
    transition: all 0.2s ease;
}

#custom-corporate-download-form .acf-form-submit .acf-button svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    fill: currentColor;
}

#custom-corporate-download-form .acf-form-submit .acf-button:hover:not(:disabled) {
    background-color: #EA4044;
}

#custom-corporate-download-form .acf-form-submit .acf-button:disabled {
    background-color: #E2E8F0;
    color: #94A3B8;
    cursor: not-allowed;
    border: 1px solid #CBD5E1;
    box-shadow: none;
}

@media (max-width: 768px) {
    #custom-corporate-download-form .acf-form-submit .acf-button {
        min-width: 100%;
    }
}

/* Hide native ACF dismiss notices (we inject our own) */
.acf-notice.-error.acf-error-message.-dismiss {
    display: none !important;
}

/* Our injected ACF-style notices should show (they have acf-field-error-msg, not -dismiss) */
#custom-corporate-download-form .acf-notice.-error.acf-field-error-msg {
    display: block !important;
    margin-bottom: 8px;
}

/* ========================================
   Document Selection — Card UI
   (replaces ACF Post Object select2)
======================================== */

#custom-corporate-download-form .acf-field[data-name="document_selection"]>.acf-label {
    text-align: left;
}

#custom-corporate-download-form .acf-field[data-name="document_selection"]>.acf-label label {
    justify-content: flex-start;
}

#custom-corporate-download-form .acf-field[data-name="document_selection"] .acf-input>*:not(.doc-card-list):not(.acf-field-error-msg):not(script) {
    display: none !important;
}

/* Ẩn select2 container span (tất cả state: focus, below, above, open...) */
#custom-corporate-download-form .acf-field[data-name="document_selection"] .select2-container,
#custom-corporate-download-form .acf-field[data-name="document_selection"] span.select2,
#custom-corporate-download-form .acf-field[data-name="document_selection"] .select2.select2-container,
#custom-corporate-download-form .acf-field[data-name="document_selection"] .select2-container--default {
    display: none !important;
}

/* Ẩn select về mặt visual nhưng VẪN submit được (display:none sẽ làm mất value khi POST) */
#custom-corporate-download-form .acf-field[data-name="document_selection"] select {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
}

/* Card list wrapper */
.doc-card-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Single card */
.doc-card-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 20px 16px;
    border: 1px solid #D7E8F2;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

/* Selected state */
.doc-card-item.is-selected {
    border-color: #005C89;
    background: #F4FAFD;
}

/* Hide native checkbox — replaced by custom box */
.doc-card-item .doc-card-check {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    min-width: 16px;
    border: 1px solid #767676;
    border-radius: 2.5px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    position: relative;
    flex-shrink: 0;
    margin-top: 2px !important;
}

.doc-card-item .doc-card-check:checked {
    background: #005C89;
    border-color: #005C89;
}

.doc-card-item .doc-card-check:hover {
    background: #005C89 !important;
    border-color: #005C89 !important;
}

/* Document icon */
.doc-card-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.doc-card-icon svg {
    width: 24px;
    height: 24px;
}

.doc-icon-selected {
    display: none;
}

.doc-icon-selected svg {
    width: 24px !important;
}

.doc-icon-unselected {
    display: flex;
    align-items: center;
    justify-content: center;
}

.doc-icon-unselected svg {
    width: 24px;
}

.doc-card-item.is-selected .doc-icon-selected {
    display: flex;
    align-items: center;
    justify-content: center;
}

.doc-card-item.is-selected .doc-icon-unselected {
    display: none;
}

/* Document text area */
.doc-card-text {
    display: flex;
    flex-direction: column;
}

/* Document title text */
.doc-card-title {
    font-size: 14px;
    font-weight: 900;
    color: #1A2A3E;
    line-height: 25px;
}

.doc-card-subtitle {
    font-size: 12px;
    font-weight: 400;
    color: #6B8299;
    line-height: 21px;
}

.doc-card-empty {
    font-size: 13px;
    color: #94a3b8;
    padding: 10px 0;
}

input[type="checkbox"]:checked {
    background-color: #005C89 !important;
    border-color: #005C89 !important;
}