/* Recent active markets */
.recent-markets-section {
    padding: 20px;
    background: linear-gradient(135deg,#ffffff 0%,#fffdf5 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 5px 18px rgba(15, 23, 42, 0.045);
}

.recent-markets-header {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 15px;
}

.recent-markets-header__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 29px;
    height: 29px;
    flex: 0 0 29px;
    color: #e11d48;
    background-color: #fff1f2;
    border: 1px solid #fecdd3;
    border-radius: 8px;
    font-size: 14px;
}

.recent-markets-title {
    margin: 0;
    color: #475569;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}

.recent-countries-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.recent-country-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 8px 12px;
    color: #334155;
    background-color: #ffffff;
    border: 1px solid #dbe3ec;
    border-radius: 999px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 650;
    line-height: 1;
    text-decoration: none !important;
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.035);
    transition:color 0.2s ease,background-color 0.2s ease,border-color 0.2s ease,box-shadow 0.2s ease,transform 0.2s ease;
}

.recent-country-pill__flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.recent-country-pill__flag .flag-icon {
    width: 20px;
    height: 14px;
    margin: 0;
    background-position: center;
    background-size: cover;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.1);
}

.recent-country-pill__name {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.recent-country-pill__arrow {
    flex: 0 0 auto;
    color: #cbd5e1;
    font-size: 10px;
    transition:
        color 0.2s ease,
        transform 0.2s ease;
}

.recent-country-pill:hover {
    color: #be123c;
    background-color: #fff7d6;
    border-color: #f3d577;
    box-shadow: 0 5px 12px rgba(180, 130, 20, 0.1);
    transform: translateY(-2px);
}
.recent-country-pill:hover .recent-country-pill__arrow {
    color: #e11d48;
    transform: translateX(2px);
}
.recent-country-pill:focus-visible {
    outline: 3px solid rgba(225, 29, 72, 0.16);
    outline-offset: 2px;
}

/* Keyword Detail Container */
.keyword-detail-container {
    padding-top: 130px !important;
    padding-bottom: 80px;
}

.btn-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #64748b;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none !important;
    transition:color 0.2s ease,transform 0.2s ease;
}

.btn-back-link:hover {
    color: #0f172a;
    transform: translateX(-2px);
}

.btn-back-link:focus-visible {
    outline: 3px solid rgba(225, 29, 72, 0.18);
    outline-offset: 4px;
    border-radius: 5px;
}

.region-detail-title {
    color: #0f172a;
    font-family: 'Inter', sans-serif;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
}

.text-rose {
    color: #e11d48 !important;
}

.documents-grid {
    --bs-gutter-x: 16px;
    --bs-gutter-y: 16px;
}

.document-card-link {
    display: block;
    width: 100%;
    height: 100%;
    color: inherit;
    text-decoration: none !important;
    border-radius: 14px;
}

.document-card-link:focus-visible {
    outline: none;
}

.document-card {
    width: 100%;
    height: 100%;
    min-height: 130px;
    padding: 1px;
    position: relative;
    background: #dfe6ee;
    border-radius: 14px 4px 14px 14px;
    clip-path: polygon(0 0,calc(100% - 28px) 0,100% 28px,100% 100%,0 100%);
    filter: drop-shadow(0 2px 3px rgba(15, 23, 42, 0.06));
    transition:transform 0.25s ease,filter 0.25s ease,background-color 0.25s ease;
}

.document-card__surface {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 64px;
    width: 100%;
    height: 100%;
    min-height: 132px;
    overflow: hidden;
    background: #fffbea;
    border-radius: 13px 3px 13px 13px;
    clip-path: polygon(0 0,calc(100% - 27px) 0,100% 27px,100% 100%,0 100%);
    transition: background-color 0.25s ease;
}

.document-card__surface::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    z-index: 4;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg,#e2e8f0 0%,#f1f5f9 55%,#ffffff 100%);
    clip-path: polygon(0 0,100% 100%,0 100%);
    pointer-events: none;
    transition: background 0.25s ease;
}

.document-card__content {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 20px 18px 18px 20px;
}

.document-card__title {
    width: 100%;
    margin: 0;
    color: #0f172a;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: -0.01em;
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
    overflow-wrap: anywhere;
    word-break: normal;
    hyphens: auto;
    transition: color 0.2s ease;
}

.document-card__free-badge {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 5px;
    margin-top: 10px;
    padding: 4px 8px;
    color: #15803d;
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.06em;
}

.document-card__free-badge i {
    font-size: 11px;
}

.document-card__metadata {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    width: 100%;
    margin-top: auto;
    padding-top: 16px;
}


.document-card__meta-item {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    flex-shrink: 0;
    color: #64748b;
    font-family: 'Inter', sans-serif;
    font-size: 12.5px;
    line-height: 1.3;
}

.document-card__meta-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    flex: 0 0 auto;
    color: #e11d48;
    background: transparent;
    border: none;
    border-radius: 0;
    font-size: 15px;
    line-height: 1;
}

.document-card__meta-icon--flag {
    background: transparent;
    border: none;
}

.document-card__meta-icon--flag .flag-icon {
    width: 20px;
    height: 14px;
    background-size: cover;
    background-position: center;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.document-card__meta-text {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
}

.document-card__meta-text strong {
    color: #334155;
    font-weight: 700;
}

.document-card__region {
    display: block;
    min-width: 0;
    max-width: 105px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.document-card__rail {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 40px 10px 14px;
    background: linear-gradient(180deg,#f8fafc 0%,#ffffff 58%,#f8fafc 100%);
    border-left: 1px dashed #d8e0e9;
    transition:background 0.25s ease,border-color 0.25s ease;
}

.document-card__file-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 34px;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    box-shadow:0 4px 10px rgba(15, 23, 42, 0.07),inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition:transform 0.25s ease,border-color 0.25s ease,box-shadow 0.25s ease;
}

.document-card__file-icon i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    line-height: 1;
}

.document-card__open-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    color: #94a3b8;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    font-size: 14px;
    transition:color 0.25s ease,background-color 0.25s ease,border-color 0.25s ease,transform 0.25s ease;
}

.document-card-link:hover .document-card {
    background-color: #fda4af;
    transform: translateY(-4px);
    filter: drop-shadow(0 12px 15px rgba(225, 29, 72, 0.13));
}

.document-card-link:hover .document-card__surface {
    background-color: #fff7d6;
}

.document-card-link:hover .document-card__surface::before {
    background: linear-gradient(135deg,#fecdd3 0%,#ffe4e6 58%,#ffffff 100%);
}

.document-card-link:hover .document-card__title {
    color: #be123c;
}

.document-card-link:hover .document-card__rail {
    background: linear-gradient(180deg,#fff1f2 0%,#ffffff 58%,#fff7f8 100%);
    border-left-color: #fecdd3;
}

.document-card-link:hover .document-card__file-icon {
    border-color: #fecdd3;
    box-shadow:0 7px 14px rgba(225, 29, 72, 0.11),inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
}

.document-card-link:hover .document-card__open-icon {
    color: #ffffff;
    background-color: #e11d48;
    border-color: #e11d48;
    transform: translateX(3px);
}

.document-card-link:focus-visible .document-card {
    background-color: #fb7185;
    filter:drop-shadow(0 0 0 rgba(0, 0, 0, 0))drop-shadow(0 0 6px rgba(225, 29, 72, 0.25));
}

.document-card-link:focus-visible .document-card__open-icon {
    color: #ffffff;
    background-color: #e11d48;
    border-color: #e11d48;
}

.documents-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 270px;
    padding: 45px 24px;
    text-align: center;
    background-color: #ffffff;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
}

.documents-empty-state__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 66px;
    height: 66px;
    margin-bottom: 18px;
    color: #94a3b8;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    font-size: 30px;
}

.documents-empty-state h4 {
    color: #475569;
    font-family: 'Inter', sans-serif;
    font-size: 17px;
    font-weight: 700;
}

.documents-empty-state p {
    max-width: 470px;
    margin: 8px 0 0;
    color: #94a3b8;
    font-family: 'Inter', sans-serif;
    font-size: 13.5px;
    line-height: 1.6;
}

.custom-library-pagination {
    overflow: hidden;
    border-radius: 30px;
}

.custom-library-pagination .page-link {
    padding: 8px 16px;
    color: #475569;
    background-color: #ffffff;
    border-color: #e2e8f0;
    font-family: 'Inter', sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: none !important;
    transition:color 0.2s ease,background-color 0.2s ease,border-color 0.2s ease;
}

.custom-library-pagination .page-link:hover {
    color: #e11d48;
    background-color: #fff1f2;
    border-color: #fecdd3;
}

.custom-library-pagination .page-link:focus {
    color: #e11d48;
    background-color: #fff1f2;
    border-color: #fda4af;
    box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.12) !important;
}

.custom-library-pagination .page-item.active .page-link {
    color: #ffffff !important;
    background-color: #e11d48 !important;
    border-color: #e11d48 !important;
}

.custom-library-pagination .page-item.disabled .page-link {
    color: #cbd5e1;
    background-color: #f8fafc;
    border-color: #e2e8f0;
}

@media (max-width: 991.98px) {
    .keyword-detail-container {
        padding-top: 110px !important;
        padding-bottom: 60px;
    }

    .document-card {
        min-height: 150px;
    }

    .document-card__surface {
        min-height: 150px;
    }
}

@media (max-width: 575.98px) {
    .recent-markets-section {
    padding: 16px;
    border-radius: 13px;
    }
    .recent-countries-list {
        gap: 8px;
    }
    .recent-country-pill {
        padding: 8px 10px;
        font-size: 12px;
    }
    .recent-country-pill__flag .flag-icon {
        width: 18px;
        height: 13px;
    }

    .keyword-detail-container {
        padding-top: 95px !important;
        padding-bottom: 45px;
    }
    .region-detail-title {
        font-size: 21px;
    }
    .document-card {
        min-height: 120px;
    }
    .document-card__surface {
        grid-template-columns: minmax(0, 1fr) 58px;
        min-height: 120px;
    }
    .document-card__content {
        padding: 18px 15px 16px 17px;
    }
    .document-card__title {
        font-size: 14.5px;
    }
    .document-card__rail {
        padding-right: 8px;
        padding-left: 8px;
    }
    .document-card__file-icon {
        width: 38px;
        height: 38px;
        border-radius: 9px;
    }
    .document-card__file-icon i {
        font-size: 23px;
    }
    .document-card__metadata {
    gap: 8px;
    }
    .document-card__meta-item {
        gap: 5px;
        font-size: 11.5px;
    }
    .document-card__region {
        max-width: 75px;
    }
}

@supports not (
    clip-path: polygon(0 0,calc(100% - 28px) 0,100% 28px,100% 100%,0 100%)) {
    .document-card,
    .document-card__surface {
        clip-path: none;
        border-radius: 14px;
    }
    .document-card__surface::before {
        display: none;
    }
}