.table-wrapper .btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 5;
    white-space: nowrap;
}

.category-tables {
    gap: 18px;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    justify-content: center;
    padding-bottom: var(--padding-large);
}

.category-table {
    position: relative;
    border: 1px solid rgba(201, 164, 96, 0.42);
    border-radius: 8px;
    background: #24231f;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    background-clip: padding-box;
    box-shadow:
        0 10px 24px rgba(0, 0, 0, 0.32),
        inset 0 1px rgba(255, 255, 255, 0.025);
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
}

.category-table th {
    border: none;
    height: 58px;
    padding: 10px 14px;
    color: #d7d3ca;
    border-bottom: 1px solid rgba(229, 184, 94, 0.3);
    background-clip: padding-box;
    font-weight: 400;
    letter-spacing: 0.035em;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.75);
}

.category-table .thead-alliance {
    background:
        linear-gradient(90deg, rgba(78, 123, 158, 0.18), transparent 52%),
        linear-gradient(180deg, #21394b 0%, #172832 100%);
}

.category-table .thead-neutre {
    background:
        linear-gradient(90deg, rgba(91, 126, 68, 0.18), transparent 52%),
        linear-gradient(180deg, #2b3b27 0%, #1d2b20 100%);
}

.category-table .thead-horde {
    background:
        linear-gradient(90deg, rgba(145, 72, 68, 0.17), transparent 52%),
        linear-gradient(180deg, #45282a 0%, #301d20 100%);
}

.category-table tbody,
.category-table tbody tr,
.category-table td {
    background: #24231f !important;
}

.category-table td {
    border: none;
    border-bottom: 1px solid rgba(229, 184, 94, 0.1);
    vertical-align: middle;
    padding: 13px 14px;
    background-clip: padding-box;
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
}

.category-table tbody tr:last-child td {
    border-bottom: 0;
}

.category-table tbody tr {
    transition: background-color 160ms ease;
}

.category-table tbody tr:hover td {
    background: #302d27 !important;
}

.category-table .category-table-name {
    padding-left: 18px;
    width: 50%;
    font-size: 1.18rem;
    color: var(--golden-light);
    font-family: var(--font-secondary), sans-serif;
    font-weight: 600;
    letter-spacing: 0.045em;
}


.category-table .category-table-name-value div {
    display: flex;
    align-items: center; /* centre image + texte verticalement */
    gap: 16px;
    vertical-align: middle; /* utile si le conteneur est inline */
    max-width: 100%;
    min-width: 0;
}

/* s'assurer que l'image garde sa hauteur et ne crée pas d'offset */
.category-table .category-table-name-value div img {
    width: 52px;
    height: 52px;
    display: block;
    object-fit: cover;
    flex: 0 0 52px;
}

.topic-list-table .category-table-name-value div img {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
    object-fit: contain;
    object-position: center;
    border-radius: 0 !important;
}

/* Alternative minimaliste : vertical-align */
.category-table .category-table-name-value div img,
.category-table .category-table-name-value div span {
    vertical-align: middle;
}

.category-table .category-table-name-value div span {
    font-size: 1.1rem;
    line-height: 1.25;
    color: #dfc88f;
    font-family: var(--font-secondary), sans-serif;
    font-optical-sizing: auto;
    font-style: normal;
    font-weight: var(--font-weight-bold);
    max-width: 100%; /* réserve de l'espace pour l'image */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    word-break: break-word;
    transition: color 160ms ease;
}

.category-table tbody tr:hover .category-table-name-value div span {
    color: var(--golden-light);
}

.category-table td:not(.category-table-name-value) {
    color: #aeb3b2;
    font-size: 0.9rem;
}

.category-table .forum-count-header h6 {
    margin: 0.2rem 0;
    font-size: 1rem;
}

.category-table td.forum-count-value {
    font-size: 1.05rem;
    font-weight: 600;
    color: #d8d3c7;
    text-align: center;
}

.category-table td.last-post-cell .last-post-title {
    margin: 0;
    font-size: 0.96rem;
    line-height: 1.22;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    word-break: break-word;
}

.category-table td.last-post-cell .last-post-author {
    margin-top: 2px;
    font-size: 0.86rem;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
}

.category-table td.last-post-cell .last-post-date {
    margin-top: 2px;
    font-size: 0.84rem;
    line-height: 1.2;
}

.category-forum-title {
    margin: 18px 0 14px;
    color: var(--golden-light);
    font-size: 1.55rem;
    letter-spacing: 0.055em;
    text-shadow: 0 3px 9px rgba(0, 0, 0, 0.72);
}

td, th{
    border-radius: 0 !important;
}

.topic-title-truncate {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

.forum-overview-panels {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 10px 12px 12px;
}

.forum-overview-card {
    margin: 0 0 14px;
}

.forum-overview-card details {
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(36, 35, 31, 0.95), rgba(26, 25, 22, 0.95));
    border: 1px solid rgba(201, 164, 96, 0.35);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.forum-overview-card summary {
    cursor: pointer;
    font-family: var(--font-secondary), sans-serif;
    color: var(--golden-light);
    padding: 12px 14px;
    list-style: none;
    user-select: none;
    border-bottom: 1px solid rgba(229, 184, 94, 0.2);
    background:
        linear-gradient(90deg, rgba(229, 184, 94, 0.1), rgba(229, 184, 94, 0.01) 55%);
}

.forum-overview-card summary::-webkit-details-marker {
    display: none;
}

.forum-overview-card summary::after {
    content: "▾";
    float: right;
    transition: transform 130ms ease;
}

.forum-overview-card details:not([open]) summary::after {
    transform: rotate(-90deg);
}

.forum-overview-list {
    margin: 0;
    border: none;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(12, 17, 22, 0.45);
}

.forum-overview-list .collection-item {
    background: transparent !important;
    border-bottom-color: rgba(229, 184, 94, 0.1);
}

.forum-overview-column-title {
    margin: 2px 0 8px;
    color: #d7d3ca;
    text-align: left;
    padding-left: 2px;
}

.forum-overview-column .collection {
    margin-top: 0;
}

.forum-overview-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px !important;
    transition: background-color 140ms ease, transform 140ms ease;
}

.forum-overview-item:hover {
    background: rgba(229, 184, 94, 0.08) !important;
    transform: translateX(2px);
}

.forum-overview-avatar {
    width: 42px !important;
    height: 42px !important;
    object-fit: cover;
    flex: 0 0 42px;
    border: 1px solid rgba(229, 184, 94, 0.3);
}

.forum-overview-content {
    min-width: 0;
    width: 100%;
}

.forum-overview-post-title {
    margin: 0 0 3px !important;
    color: #e9d7aa;
    font-size: 0.95rem;
    text-align: left;
}

.forum-overview-meta {
    font-size: 0.82rem;
    color: #b9b3a7;
    line-height: 1.25;
}

.forum-overview-empty {
    color: #aeb3b2;
    padding: 12px !important;
}

/* MOBILE OPTIMIZATION */
@media only screen and (max-width: 1100px) {

    /* Cacher les colonnes Sujets et Posts sur mobile */
    .hide-on-mobile {
        display: none !important;
    }

    /* Réduire la taille des titres de catégories */
    .category-table .category-table-name {
        font-size: 1.25rem;
    }

    /* Réduire la taille des noms de sous-catégories */
    .category-table .category-table-name-value div span {
        font-size: 1.02rem;
    }

    .category-table .category-table-name-value div img{
        width: 44px;
        height: 44px;
        flex-basis: 44px;
    }

    .topic-list-table .category-table-name-value div img{
        width: 48px;
        height: 48px;
        flex-basis: 48px;
        object-fit: contain;
    }

    /* Réduire la taille des headers de table */
    .category-table th h6 {
        font-size: 0.92rem;
        margin: 0.3rem 0;
    }

    .category-table td.forum-count-value {
        font-size: 1rem;
    }

    .category-table td.last-post-cell .last-post-title {
        font-size: 0.9rem;
    }

    .category-table td.last-post-cell .last-post-author {
        font-size: 0.8rem;
    }

    .category-table td.last-post-cell .last-post-date {
        font-size: 0.78rem;
    }

    .forum-overview-panels {
        grid-template-columns: 1fr;
    }

    .forum-overview-item {
        padding: 9px 10px !important;
        gap: 10px;
    }

    .forum-overview-avatar {
        width: 36px !important;
        height: 36px !important;
        flex-basis: 36px;
    }
}
