/* Wiki Article Tables - New Design from Figma */

/* Table Wrapper */
.article-text .table-wrapper-content {
    margin-top: 2vw !important;
    margin-bottom: 1.5vw !important;
    position: relative !important;
    width: 100% !important;
}

/* Hide ALL editor controls - aggressive removal */
.article-text .table-wrapper-content .table-side-controls,
.article-text .table-wrapper-content .table-control-btn,
.article-text .table-wrapper-content .table-add-row-btn,
.article-text .table-wrapper-content .table-add-col-btn,
.article-text .table-wrapper-content .table-delete-btn,
.article-text .table-wrapper-content .wrapper-controls,
.article-text .table-wrapper-content .wrapper-overlay,
.article-text .table-wrapper-content button,
.article-text .table-wrapper-content .button,
.article-text .table-wrapper-content [class*="control"],
.article-text .table-wrapper-content [class*="btn"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Scroll Container with custom scrollbar */
.article-text .table-wrapper-content .wiki-table-scroll-container {
    max-height: 40vw !important;
    overflow-y: auto !important;
    overflow-x: auto !important;
    border-radius: 0.4vw !important;
    border: 0.1vw solid rgba(255, 255, 255, 0.15) !important;
}

[data-theme="light"] .article-text .table-wrapper-content .wiki-table-scroll-container {
    border-color: rgba(0, 0, 0, 0.15) !important;
}

/* Custom Scrollbar Styles */
.article-text .table-wrapper-content .wiki-table-scroll-container::-webkit-scrollbar {
    width: 0.4vw !important;
    height: 0.4vw !important;
}

.article-text .table-wrapper-content .wiki-table-scroll-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02) !important;
    border-radius: 0.2vw !important;
}

[data-theme="light"] .article-text .table-wrapper-content .wiki-table-scroll-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02) !important;
}

.article-text .table-wrapper-content .wiki-table-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.25) !important;
    border-radius: 0.2vw !important;
}

[data-theme="light"] .article-text .table-wrapper-content .wiki-table-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.2) !important;
}

.article-text .table-wrapper-content .wiki-table-scroll-container::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.4) !important;
}

[data-theme="light"] .article-text .table-wrapper-content .wiki-table-scroll-container::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.35) !important;
}

/* Table Styles */
.article-text .table-wrapper-content .wiki-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 0.9vw !important;
    margin: 0 !important;
}

/* Table Title Row - First row in table, above column headers */
.article-text .table-wrapper-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
}

/* Table title row - inside table, first row above thead (column headers) — непрозрачный фон, фиксирован */
.article-text .table-wrapper-content .wiki-table .table-title-row {
    display: table-row !important;
}

.article-text .table-wrapper-content .wiki-table .table-title-row th {
    display: table-cell !important;
    padding: 1vw 1.5vw !important;
    font-size: 1.1vw !important;
    font-weight: 600 !important;
    font-family: inherit !important;
    letter-spacing: -0.02vw !important;
    line-height: 1.4 !important;
    color: rgba(255, 255, 255, 1) !important;
    text-align: center !important;
    background-color: #ffffff !important;
    border: none !important;
    border-bottom: 0.1vw solid rgba(0, 0, 0, 0.1) !important;
    cursor: default !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 11 !important;
}

[data-theme="light"] .article-text .table-wrapper-content .wiki-table .table-title-row th {
    color: rgba(0, 0, 0, 1) !important;
    background-color: #ffffff !important;
    border-bottom-color: rgba(0, 0, 0, 0.1) !important;
}

/* Ensure scroll container is full width */
.article-text .table-wrapper-content .wiki-table-scroll-container {
    width: 100% !important;
    flex: 0 0 auto !important;
}

/* Hide original caption in table */
.article-text .table-wrapper-content .wiki-table caption {
    display: none !important;
}

/* Table Header — фиксирован, непрозрачный белый фон */
.article-text .table-wrapper-content .wiki-table thead {
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
}

.article-text .table-wrapper-content .wiki-table thead tr {
    background-color: #ffffff !important;
}

[data-theme="light"] .article-text .table-wrapper-content .wiki-table thead tr {
    background-color: #ffffff !important;
}

.article-text .table-wrapper-content .wiki-table thead th {
    padding: 1vw !important;
    text-align: center !important;
    vertical-align: middle !important;
    font-weight: 600 !important;
    color: rgba(0, 0, 0, 0.9) !important;
    background-color: #ffffff !important;
    border-bottom: 0.15vw solid rgba(0, 0, 0, 0.15) !important;
    border-right: 0.08vw solid rgba(0, 0, 0, 0.1) !important;
    min-width: 8vw !important;
    max-width: 20vw !important;
    white-space: nowrap !important;
}

[data-theme="light"] .article-text .table-wrapper-content .wiki-table thead th {
    color: rgba(0, 0, 0, 0.9) !important;
    background-color: #ffffff !important;
    border-bottom-color: rgba(0, 0, 0, 0.15) !important;
    border-right-color: rgba(0, 0, 0, 0.1) !important;
}

.article-text .table-wrapper-content .wiki-table thead th:last-child {
    border-right: none !important;
}

/* Table Body */
.article-text .table-wrapper-content .wiki-table tbody tr {
    background-color: transparent !important;
    transition: background-color 0.2s ease !important;
}

.article-text .table-wrapper-content .wiki-table tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02) !important;
}

[data-theme="light"] .article-text .table-wrapper-content .wiki-table tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.01) !important;
}

.article-text .table-wrapper-content .wiki-table tbody tr:hover {
    background-color: rgba(139, 92, 246, 0.08) !important;
}

[data-theme="light"] .article-text .table-wrapper-content .wiki-table tbody tr:hover {
    background-color: rgba(139, 92, 246, 0.05) !important;
}

/* Table Cells */
.article-text .table-wrapper-content .wiki-table tbody td,
.article-text .table-wrapper-content .wiki-table tbody th {
    padding: 1vw !important;
    color: rgba(255, 255, 255, 0.8) !important;
    border-bottom: 0.05vw solid rgba(255, 255, 255, 0.08) !important;
    border-right: 0.08vw solid rgba(255, 255, 255, 0.08) !important;
    min-width: 8vw !important;
    max-width: 20vw !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    text-align: center !important;
    vertical-align: middle !important;
}

[data-theme="light"] .article-text .table-wrapper-content .wiki-table tbody td,
[data-theme="light"] .article-text .table-wrapper-content .wiki-table tbody th {
    color: rgba(0, 0, 0, 0.8) !important;
    border-bottom-color: rgba(0, 0, 0, 0.08) !important;
    border-right-color: rgba(0, 0, 0, 0.08) !important;
}

.article-text .table-wrapper-content .wiki-table tbody td:last-child,
.article-text .table-wrapper-content .wiki-table tbody th:last-child {
    border-right: none !important;
}

.article-text .table-wrapper-content .wiki-table tbody tr:last-child td,
.article-text .table-wrapper-content .wiki-table tbody tr:last-child th {
    border-bottom: none !important;
}

/* Row Headers (first column) */
.article-text .table-wrapper-content .wiki-table tbody th {
    font-weight: 600 !important;
    color: rgba(255, 255, 255, 0.9) !important;
}

[data-theme="light"] .article-text .table-wrapper-content .wiki-table tbody th {
    color: rgba(0, 0, 0, 0.9) !important;
}

/* Disable editing - contenteditable is removed via JS */
.article-text .table-wrapper-content .wiki-table *[contenteditable="true"] {
    -webkit-user-select: text !important;
    user-select: text !important;
    cursor: default !important;
    outline: none !important;
}

/* Remove all hover lines and editor indicators */
.article-text .table-wrapper-content .table-hover-line,
.article-text .table-wrapper-content .hover-line,
.article-text .table-wrapper-content .resize-handle {
    display: none !important;
}

