/* ==========================================================================
   VDC Document Library — Style
   ========================================================================== */

:root {
    --vdc-primary: #13803f;
    --vdc-primary-hover: #083e1e;
    --vdc-accent: #ffffff;
    --vdc-border: #e0e0e0;
    --vdc-text: #333333;
    --vdc-text-light: #666666;
    --vdc-radius: 8px;
    --vdc-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ---------- Wrapper ---------- */
.vdc-doclib-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    font-family: inherit;
}

/* ---------- Search bar ---------- */
.vdc-doclib-search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    justify-content: center;
}

.vdc-doclib-search-bar input {
    width: 100%;
    max-width: 580px;
    padding: 10px 16px;
    border: 1px solid var(--vdc-border);
    border-radius: var(--vdc-radius);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
    margin-bottom: 0;
}

.vdc-doclib-search-bar input:focus {
    border-color: var(--vdc-primary);
}

.vdc-doclib-search-bar button {
    background: var(--vdc-primary);
    color: var(--vdc-accent);
    border: none;
    border-radius: var(--vdc-radius);
    font-size: 15px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
    margin: 0;
}

.vdc-doclib-search-bar button:hover {
    background: var(--vdc-primary-hover);
}

/* ---------- Filter pills ---------- */
.vdc-doclib-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    justify-content: center;
}

.vdc-filter-pill {
    border: 1px solid #ddd;
    border-radius: 20px;
    background: transparent;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    margin: 0;
    font-weight: 400;
}

.vdc-filter-pill:hover,
.vdc-filter-pill.active {
    background: var(--vdc-primary);
    color: var(--vdc-accent);
}

/* ---------- Toolbar (sort) ---------- */
.vdc-doclib-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 20px;
    gap: 8px;
}

.vdc-doclib-toolbar span {
    font-size: 14px;
    color: var(--vdc-text-light);
}

.vdc-sort-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.vdc-sort-dropdown {
    position: relative;
}

.vdc-sort-toggle {
    margin: 0;
    background: #333;
    color: var(--vdc-accent);
    border: none;
    border-radius: var(--vdc-radius);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.vdc-sort-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: #fff;
    border: 1px solid var(--vdc-border);
    border-radius: var(--vdc-radius);
    box-shadow: var(--vdc-shadow);
    list-style: none;
    padding: 4px 0;
    margin: 0;
    min-width: 160px;
    z-index: 100;

    li {
        margin: 0 !important;
    }
}

.vdc-sort-menu.open {
    display: block;
}

.vdc-sort-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin: 0;
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    color: var(--vdc-text);
    gap: 12px;
}

.vdc-sort-option:hover {
    background: #f5f5f5;
}

.vdc-sort-option .fa-check {
    opacity: 0;
}

.vdc-sort-option.active .fa-check {
    opacity: 1;
    color: var(--vdc-primary);
}

/* ---------- Grid ---------- */
.vdc-doclib-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

/* ---------- Card ---------- */
.vdc-doc-card {
    border: 1px solid var(--vdc-border);
    border-radius: var(--vdc-radius);
    overflow: hidden;
    transition: box-shadow 0.2s;
    background: #fff;
}

.vdc-doc-card:hover {
    box-shadow: var(--vdc-shadow);
}

.vdc-doc-thumb {
    width: 100%;
    aspect-ratio: 1/1;
    overflow: hidden;
    background: #f0f0f0;
}

.vdc-doc-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.vdc-doc-thumb-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a2b4a 0%, #2c4a7c 100%);
}

.vdc-doc-info {
    padding: 12px 16px 16px;
    text-align: center;
}

.vdc-doc-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--vdc-text);
    margin: 0 0 12px;
    line-height: 1.4;
    text-transform: uppercase;
}

.vdc-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    background: var(--vdc-primary);
    color: var(--vdc-accent);
    border: none;
    border-radius: var(--vdc-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.vdc-download-btn:hover {
    background: var(--vdc-primary-hover);
}

/* ---------- No results ---------- */
.vdc-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--vdc-text-light);
    font-size: 16px;
}

/* ---------- Pagination ---------- */
.vdc-pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
}

.vdc-page-btn {
    padding: 8px 14px;
    border: 1px solid var(--vdc-border);
    border-radius: var(--vdc-radius);
    background: #fff;
    color: var(--vdc-text);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    line-height: 1;
    margin: 0;
}

.vdc-page-btn:hover {
    background: #f0f0f0;
}

.vdc-page-btn.active {
    background: var(--vdc-primary);
    color: var(--vdc-accent);
    border-color: var(--vdc-primary);
}

/* ---------- Popup overlay ---------- */
.vdc-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
    /* Thoát khỏi stacking context của Flatsome */
    transform: translateZ(0);
}

.vdc-popup-overlay.open {
    opacity: 1;
    visibility: visible;
}

.vdc-popup-modal {
    position: relative;
    background: #fff;
    border-radius: var(--vdc-radius);
    padding: 36px 32px 28px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

.vdc-popup-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--vdc-text-light);
    transition: color 0.2s;
    padding: 0;
    margin: 0;
    min-height: unset;
    line-height: 1;
}

.vdc-popup-close:hover {
    color: var(--vdc-text);
}

#vdc-popup-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--vdc-primary);
    margin: 0 0 20px;
    text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
    .vdc-doclib-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .vdc-doclib-grid {
        grid-template-columns: 1fr;
    }

    .vdc-doclib-search-bar {
        flex-direction: column;
    }

    .vdc-doclib-search-bar input {
        max-width: 100%;
    }

    .vdc-popup-modal {
        margin: 0px 20px;
    }
}