#custom-corporate-download-form {
    max-width: 1161px;
    width: 100%;
    margin: 0px auto;
    font-family: sans-serif;
    display: grid;
    grid-template-columns: 736px 393px;
    grid-template-rows: repeat(15, max-content) 1fr;
    gap: 28px 32px;
    align-items: start;
    justify-content: center;
}

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

/* Left Column */
#custom-corporate-download-form .acf-field[data-name="document_selection"] {
    grid-column: 1;
    grid-row: 1 / 17;
    /* Spans 16 rows to match template-rows */
    width: 100%;
    margin-bottom: 0 !important;
    z-index: 30;
}

/* 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;
    margin-left: 0 !important;
    width: 100%;
    z-index: 30;
    box-sizing: border-box;
}

@media (max-width: 1224px) {
    #custom-corporate-download-form {
        grid-template-columns: 50% 50%;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    #custom-corporate-download-form {
        display: flex;
        flex-direction: column;
        width: 100%;
        box-sizing: border-box;
        gap: 18px;
    }

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

    /* 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% !important;
        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;
    }
}

/* 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: 30px !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: 7.5px !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: 0px;
    height: 23.25px;
}

#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: 1.25px 7px;
    margin-left: 6px;
    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: 14px 14px;
    border: 1px solid #D5E3F0;
    font-size: 14px;
    color: #1A2A3E;
    font-weight: 400;
    background-color: #fff;
    border-radius: 10px !important;
    line-height: 100%;
    height: 44px !important;
}

#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;
    /* margin-bottom: 48px; */
}

@media (max-width: 768px) {
    #custom-corporate-download-form .acf-field-checkbox {
        margin-top: 0px !important;
        margin-bottom: 0px;
    }

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

#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;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg width='16' height='12' viewBox='0 0 16 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6.25565 11.7096C6.03057 11.7095 5.81475 11.6039 5.65565 11.4162L0.262471 5.09814C0.180806 5.00584 0.115545 4.8953 0.0704938 4.77295C0.0254422 4.65061 0.0015017 4.51892 6.84097e-05 4.38555C-0.00136488 4.25219 0.0197372 4.11982 0.062145 3.99617C0.104553 3.87252 0.167417 3.76006 0.247073 3.66535C0.326728 3.57064 0.42158 3.49558 0.526098 3.44453C0.630616 3.39349 0.742708 3.36749 0.855837 3.36805C0.968967 3.3686 1.08087 3.39571 1.18502 3.44778C1.28918 3.49986 1.38349 3.57586 1.46247 3.67135L6.25565 9.29814L13.9193 0.30331C13.9983 0.207817 14.0926 0.131819 14.1967 0.0797454C14.3009 0.0276721 14.4128 0.000566721 14.5259 8.79226e-06C14.6391 -0.000549137 14.7511 0.0254515 14.8557 0.0764957C14.9602 0.12754 15.055 0.202605 15.1347 0.297315C15.2143 0.392025 15.2772 0.504483 15.3196 0.628133C15.362 0.751783 15.3831 0.884149 15.3817 1.01751C15.3803 1.15088 15.3563 1.28257 15.3113 1.40492C15.2662 1.52726 15.201 1.6378 15.1193 1.7301L6.84202 11.4162C6.68628 11.6001 6.476 11.7053 6.25565 11.7096Z' fill='white'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 10px auto !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::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;
}

#custom-corporate-download-form .acf-field[data-name="privacy_policy"] .acf-checkbox-list li label {
    color: #5A7490 !important;
}

#custom-corporate-download-form .acf-field[data-name="privacy_policy"] .acf-checkbox-list li label a {
    color: #1585C9;
    margin-right: 4px;
    text-decoration: underline !important;
    font-size: 13px;
}

/* Hide label for specific field */
#custom-corporate-download-form .acf-field[data-key="field_6a0ef3f223acb"]>.acf-label,
#custom-corporate-download-form .acf-field.acf-field-6a0ef3f223acb>.acf-label,
#custom-corporate-download-form #acf-field_6a0ef3f223acb-field>.acf-label,
#custom-corporate-download-form .acf-field[data-name="document_selection"]>.acf-label {
    /* (document_selection label is handled elsewhere but kept safe) */
}

#custom-corporate-download-form .acf-field.acf-field-6a0ef3f223acb>.acf-label,
#custom-corporate-download-form .acf-field[data-key="field_6a0ef3f223acb"]>.acf-label {
    display: none !important;
}



#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: 16px;
}

/* Single card */
.doc-card-item {
    display: flex;
    align-items: stretch;
    gap: 0px;
    padding: 0;
    border-radius: 8px;
    background: #FAFCFE;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    box-shadow: 0px 3px 16px 0px #90A4AE4D;
}

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

.doc-card-item.is-selected .doc-card-check,
.doc-card-item .doc-card-check:checked,
.doc-card-item .doc-card-check:focus:checked,
.doc-card-item .doc-card-check:hover:checked {
    background-color: #005C89 !important;
    border-color: #005C89 !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg width='16' height='12' viewBox='0 0 16 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6.25565 11.7096C6.03057 11.7095 5.81475 11.6039 5.65565 11.4162L0.262471 5.09814C0.180806 5.00584 0.115545 4.8953 0.0704938 4.77295C0.0254422 4.65061 0.0015017 4.51892 6.84097e-05 4.38555C-0.00136488 4.25219 0.0197372 4.11982 0.062145 3.99617C0.104553 3.87252 0.167417 3.76006 0.247073 3.66535C0.326728 3.57064 0.42158 3.49558 0.526098 3.44453C0.630616 3.39349 0.742708 3.36749 0.855837 3.36805C0.968967 3.3686 1.08087 3.39571 1.18502 3.44778C1.28918 3.49986 1.38349 3.57586 1.46247 3.67135L6.25565 9.29814L13.9193 0.30331C13.9983 0.207817 14.0926 0.131819 14.1967 0.0797454C14.3009 0.0276721 14.4128 0.000566721 14.5259 8.79226e-06C14.6391 -0.000549137 14.7511 0.0254515 14.8557 0.0764957C14.9602 0.12754 15.055 0.202605 15.1347 0.297315C15.2143 0.392025 15.2772 0.504483 15.3196 0.628133C15.362 0.751783 15.3831 0.884149 15.3817 1.01751C15.3803 1.15088 15.3563 1.28257 15.3113 1.40492C15.2662 1.52726 15.201 1.6378 15.1193 1.7301L6.84202 11.4162C6.68628 11.6001 6.476 11.7053 6.25565 11.7096Z' fill='white'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 10px auto !important;
}

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

.doc-card-item .doc-card-check:hover,
.doc-card-item .doc-card-check:focus,
.doc-card-item .doc-card-check:focus-visible,
.doc-card-item .doc-card-check:active {
    border-color: #005C89 !important;
    outline: none !important;
    box-shadow: none !important;
    border-color: #005C89 !important;
}

/* Thumbnail */
.doc-card-thumbnail {
    flex-shrink: 0;
    width: 356px;
    height: 200px;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
}

@media (max-width: 1224px) {
    .doc-card-thumbnail {
        width: 250px;
    }
}

.doc-card-thumbnail img {
    width: 100%;
    height: 100%;
    /* object-fit: cover; */
    border-radius: 4px;
}

/* Content area */
.doc-card-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-width: 0;
    padding: 20px 16px;
}

/* Top: Title & Checkbox */
.doc-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

/* Document title text */
.doc-card-title {
    font-size: 18px;
    font-weight: 900;
    color: #333333;
    line-height: 20px;
    margin: 0;
}

/* Audience */
.doc-card-audience {
    font-size: 14px;
    color: #3D5775;
    line-height: 160%;
    font-weight: 400;
    margin-bottom: 10px;
}

/* Divider */
.doc-card-divider {
    border: none;
    margin: 0 0 8px 0;
}

hr.doc-card-divider {
    background-color: #C5DFF0 !important;
}

/* Highlights */
.doc-card-highlights {
    font-size: 14px;
    color: #333333;
    line-height: 17px;
    font-weight: 400;
}

.doc-card-highlights p {
    margin: 0 0 4px 0;
    font-size: 14px;
    color: #333333;
    line-height: 17px;
    font-weight: 400;
}

.doc-card-highlights ul {
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.doc-card-highlights ul li {
    position: relative;
    padding-left: 14px;
    margin-bottom: 4px;
    font-size: 14px;
    color: #333333;
    line-height: 17px;
    font-weight: 400;
}

.doc-card-highlights ul li::before {
    content: "・";
    position: absolute;
    left: 0;
    top: 0;
    color: #005C89;
    font-weight: bold;
}

.doc-card-empty {
    font-size: 14px;
    color: #333333;
    padding: 10px 0;
}

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

    .doc-card-item {
        flex-direction: column;
        align-items: center;
    }

    .doc-card-thumbnail {
        width: 100%;
        height: auto;
    }

    .doc-card-content {
        width: 100%;
    }

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

/* --- Lightbox feature for Document thumbnails --- */
.doc-card-thumbnail {
    cursor: pointer;
}

.doc-card-thumbnail img {
    cursor: zoom-in;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.doc-card-thumbnail img:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.custom-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

.custom-lightbox-overlay.active {
    opacity: 1;
}

.custom-lightbox-container {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.custom-lightbox-overlay.active .custom-lightbox-container {
    transform: scale(1);
}

.custom-lightbox-img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    background-color: #000;
}

.custom-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: #ffffff;
    font-size: 24px;
    line-height: 44px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s, transform 0.2s;
    z-index: 100000;
    padding: 0px;
}

.custom-lightbox-close:hover {
    transform: scale(1.05);
}

body.lightbox-open {
    overflow: hidden;
}

@media (max-width: 768px) {
    .custom-lightbox-close {
        right: 0px !important;
    }

    .doc-card-thumbnail {
        max-width: 350px;
    }
    .doc-card-thumbnail img {
        height: 196px;
    }
}