/* Light Mode Styles (Default) */

/* Header row styling (first row) */
.wp-block-table.has-custom-header-row-style tr:first-child td,
.wp-block-table.has-custom-header-row-style tr:first-child th {
    background-color: var(--header-row-bg-color, inherit) !important;
    color: var(--header-row-text-color, inherit) !important;
}

/* Header column styling (first column) */
.wp-block-table.has-custom-header-column-style tr td:first-child,
.wp-block-table.has-custom-header-column-style tr th:first-child {
    background-color: var(--header-column-bg-color, inherit) !important;
    color: var(--header-column-text-color, inherit) !important;
}

/* Alternating row styling */
.wp-block-table.has-custom-row-styles tr:nth-child(odd):not(:first-child) {
    background-color: var(--odd-row-bg-color, inherit) !important;
    color: var(--odd-row-text-color, inherit) !important;
}

.wp-block-table.has-custom-row-styles tr:nth-child(even):not(:first-child) {
    background-color: var(--even-row-bg-color, inherit) !important;
    color: var(--even-row-text-color, inherit) !important;
}

/* Override for cells where header row and header column intersect */
.wp-block-table.has-custom-header-row-style.has-custom-header-column-style tr:first-child td:first-child,
.wp-block-table.has-custom-header-row-style.has-custom-header-column-style tr:first-child th:first-child {
    background-color: var(--header-row-bg-color, inherit) !important;
    color: var(--header-row-text-color, inherit) !important;
}

/* Dark Mode Styles - ONLY apply when dark-on class is present */
html.dark-on .wp-block-table.has-custom-header-row-style tr:first-child td,
html.dark-on .wp-block-table.has-custom-header-row-style tr:first-child th,
body.dark-on .wp-block-table.has-custom-header-row-style tr:first-child td,
body.dark-on .wp-block-table.has-custom-header-row-style tr:first-child th {
    background-color: var(--dark-header-row-bg-color, var(--header-row-bg-color, inherit)) !important;
    color: var(--dark-header-row-text-color, var(--header-row-text-color, inherit)) !important;
}

html.dark-on .wp-block-table.has-custom-header-column-style tr td:first-child,
html.dark-on .wp-block-table.has-custom-header-column-style tr th:first-child,
body.dark-on .wp-block-table.has-custom-header-column-style tr td:first-child,
body.dark-on .wp-block-table.has-custom-header-column-style tr th:first-child {
    background-color: var(--dark-header-column-bg-color, var(--header-column-bg-color, inherit)) !important;
    color: var(--dark-header-column-text-color, var(--header-column-text-color, inherit)) !important;
}

html.dark-on .wp-block-table.has-custom-row-styles tr:nth-child(odd):not(:first-child),
body.dark-on .wp-block-table.has-custom-row-styles tr:nth-child(odd):not(:first-child) {
    background-color: var(--dark-odd-row-bg-color, var(--odd-row-bg-color, inherit)) !important;
    color: var(--dark-odd-row-text-color, var(--odd-row-text-color, inherit)) !important;
}

html.dark-on .wp-block-table.has-custom-row-styles tr:nth-child(even):not(:first-child),
body.dark-on .wp-block-table.has-custom-row-styles tr:nth-child(even):not(:first-child) {
    background-color: var(--dark-even-row-bg-color, var(--even-row-bg-color, inherit)) !important;
    color: var(--dark-even-row-text-color, var(--even-row-text-color, inherit)) !important;
}

html.dark-on .wp-block-table.has-custom-header-row-style.has-custom-header-column-style tr:first-child td:first-child,
html.dark-on .wp-block-table.has-custom-header-row-style.has-custom-header-column-style tr:first-child th:first-child,
body.dark-on .wp-block-table.has-custom-header-row-style.has-custom-header-column-style tr:first-child td:first-child,
body.dark-on .wp-block-table.has-custom-header-row-style.has-custom-header-column-style tr:first-child th:first-child {
    background-color: var(--dark-header-row-bg-color, var(--header-row-bg-color, inherit)) !important;
    color: var(--dark-header-row-text-color, var(--header-row-text-color, inherit)) !important;
}

/* Transition effects for smooth mode switching */
.wp-block-table td,
.wp-block-table th {
    transition: background-color 0.3s ease, color 0.3s ease;
}