body {
    min-width: 1900px;
}

.md-grid {
    max-width: 100%;
}

.md-sidebar {
    width: 7rem;
}

.md-header {
    background-color: #18354c;
}

.md-nav__item .md-nav__link--active, .md-nav__item .md-nav__link--active code {
    color: #51829B;
}

[dir=ltr] .md-nav--integrated>.md-nav__list>.md-nav__item--active .md-nav--secondary {
    border-left: .05rem solid #51829B;
}

:root {
    --md-accent-fg-color: #51829B;
}

p.table-description {
    font-size: 0.6rem;
    color: #AAAAAA;
}

td.num-downloads {
    text-align: right !important;
}

table td {
    white-space: nowrap;
    cursor: text;
}

table thead th {
    background-color: #EFF5F5;
}

table {
    border-collapse: collapse;
    border: 0 !important;
}

table thead th, table td {
    border: 1px solid #D6E4E5;
}

::selection {
    background: #FFAAC3;
}

tr.new-entry, tr.new-entry:hover {
    background-color: #FFF8E3 !important;
}

/* ag-Grid custom theme to match original table styling */

/* Remove default Alpine theme borders and use custom colors */
.ag-theme-alpine.ag-theme-kinotrkr {
    --ag-border-color: #D6E4E5;
    --ag-header-background-color: #EFF5F5;
    --ag-header-foreground-color: #000000;
    --ag-row-hover-color: #F6F5F5;
    --ag-selected-row-background-color: #FFAAC3;
    --ag-range-selection-background-color: #FFAAC3;
    --ag-range-selection-background-color-2: rgba(255, 170, 195, 0.2);
    --ag-range-selection-background-color-3: rgba(255, 170, 195, 0.3);
    --ag-range-selection-background-color-4: rgba(255, 170, 195, 0.4);
    --ag-row-border-color: #D6E4E5;
    --ag-row-border-width: 1px;
    --ag-row-border-style: solid;
}

/* Header styling to match original */
.ag-theme-alpine.ag-theme-kinotrkr .ag-header {
    background-color: #EFF5F5;
    border-bottom: 1px solid #D6E4E5;
}

.ag-theme-alpine.ag-theme-kinotrkr .ag-header-cell {
    border-right: 1px solid #D6E4E5;
    border-left: none;
    border-top: none;
    /* Ensure headers don't overlap */
    overflow: hidden;
}

/* Cell borders - only vertical borders on cells, horizontal borders on rows */
.ag-theme-alpine.ag-theme-kinotrkr .ag-cell {
    border-right: 1px solid #D6E4E5;
    border-bottom: none;
    border-left: none;
    border-top: none;
    /* Lock box-sizing to prevent any size changes */
    box-sizing: border-box !important;
}

/* Add horizontal borders only on rows to prevent stacking */
.ag-theme-alpine.ag-theme-kinotrkr .ag-row {
    border-bottom: 1px solid #D6E4E5;
}

/* Remove border from last row to prevent double border at bottom */
.ag-theme-alpine.ag-theme-kinotrkr .ag-row:last-child {
    border-bottom: none;
}

/* Row hover effect - unified orange-ish color for all rows */
.ag-theme-alpine.ag-theme-kinotrkr .ag-row:hover {
    background-color: #FFF0CC !important;
}

/* Selected row styling - override all states */
.ag-theme-alpine.ag-theme-kinotrkr .ag-row-selected,
.ag-theme-alpine.ag-theme-kinotrkr .ag-row-selected.ag-row-hover,
.ag-theme-alpine.ag-theme-kinotrkr .ag-row.ag-row-selected {
    background-color: #FFAAC3 !important;
}

/* Remove focus outline but preserve borders */
.ag-theme-alpine.ag-theme-kinotrkr .ag-row-focus:focus,
.ag-theme-alpine.ag-theme-kinotrkr .ag-cell-focus,
.ag-theme-alpine.ag-theme-kinotrkr .ag-cell:focus {
    outline: none !important;
}

/* Preserve cell borders and prevent layout shift when focused */
.ag-theme-alpine.ag-theme-kinotrkr .ag-cell-focus,
.ag-theme-alpine.ag-theme-kinotrkr .ag-cell:focus-within {
    /* Keep exact same borders as unfocused cells */
    border: none !important;
    border-right: 1px solid #D6E4E5 !important;
    outline: none !important;
    box-shadow: none !important;
    /* Prevent any padding or size changes */
    padding: 0 0.5rem !important;
    line-height: 32px !important;
    box-sizing: border-box !important;
}

/* Remove any focus ring/highlight and prevent layout changes */
.ag-theme-alpine.ag-theme-kinotrkr .ag-cell-focus:not(.ag-cell-range-selected) {
    border-color: #D6E4E5 !important;
    background-color: transparent;
    /* Lock dimensions to prevent shifting */
    padding: 0 0.5rem !important;
    line-height: 32px !important;
}

/* Ensure all cells have consistent padding regardless of state */
.ag-theme-alpine.ag-theme-kinotrkr .ag-cell,
.ag-theme-alpine.ag-theme-kinotrkr .ag-cell-focus,
.ag-theme-alpine.ag-theme-kinotrkr .ag-cell:focus,
.ag-theme-alpine.ag-theme-kinotrkr .ag-cell:focus-within {
    padding: 0 0.5rem !important;
    line-height: 32px !important;
}

/* New entry highlighting - highest priority */
.ag-theme-alpine.ag-theme-kinotrkr .ag-row.new-entry {
    background-color: #FFF8E3 !important;
}

.ag-theme-alpine.ag-theme-kinotrkr .ag-row.new-entry:hover {
    background-color: #FFF0CC !important; /* Slightly darker yellow on hover */
}

/* Ensure new entry style overrides selection */
.ag-theme-alpine.ag-theme-kinotrkr .ag-row.new-entry.ag-row-selected {
    background-color: #FFE5B4 !important; /* Blend of yellow and pink */
}

/* Links in ag-Grid cells */
.ag-theme-alpine.ag-theme-kinotrkr .ag-cell a {
    color: inherit;
    text-decoration: none;
}

.ag-theme-alpine.ag-theme-kinotrkr .ag-cell a:hover {
    text-decoration: underline;
}

/* Right-align downloads column cells */
.ag-theme-alpine.ag-theme-kinotrkr .ag-cell.num-downloads {
    text-align: right;
}

/* Text selection styling */
.ag-theme-alpine.ag-theme-kinotrkr .ag-cell ::selection {
    background: #FFAAC3;
}

/* Remove unnecessary padding and shadows, add outer border */
.ag-theme-alpine.ag-theme-kinotrkr .ag-root-wrapper {
    border: 1px solid #D6E4E5;
    border-radius: 0;
}

/* Ensure grid body doesn't have extra borders */
.ag-theme-alpine.ag-theme-kinotrkr .ag-body-viewport {
    border: none;
}

/* Fix potential double borders at grid edges */
.ag-theme-alpine.ag-theme-kinotrkr .ag-center-cols-container {
    border: none;
}

/* Ensure consistent font */
.ag-theme-alpine.ag-theme-kinotrkr .ag-cell,
.ag-theme-alpine.ag-theme-kinotrkr .ag-header-cell-label {
    font-family: inherit;
    font-size: inherit;
}

/* Cell cursor and text overflow */
.ag-theme-alpine.ag-theme-kinotrkr .ag-cell {
    cursor: text;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: text !important; /* Enable text selection */
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
}

/* Enable text selection on cell content */
.ag-theme-alpine.ag-theme-kinotrkr .ag-cell-value {
    user-select: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
}

/* Disable row animation for better performance */
.ag-theme-alpine.ag-theme-kinotrkr .ag-row {
    transition: none;
}

/* Remove default Alpine theme gradients */
.ag-theme-alpine.ag-theme-kinotrkr .ag-header {
    background-image: none;
}

/* Remove column header hover effect */
.ag-theme-alpine.ag-theme-kinotrkr .ag-header-cell:hover {
    background-color: #EFF5F5;
}

/* Style for sorting indicators */
.ag-theme-alpine.ag-theme-kinotrkr .ag-icon-asc,
.ag-theme-alpine.ag-theme-kinotrkr .ag-icon-desc {
    color: #51829B;
}

td.multilingual-titles,
td.year-country-genre-quality,
td.dubs-subs {
    max-width: 900px;
    min-width: 900px;
}

td.multilingual-titles span,
td.year-country-genre-quality span,
td.dubs-subs span {
    display: block;
    max-width: max-content;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 0.5rem;
    margin-left: -0.5rem;
}

td.multilingual-titles:hover span,
td.year-country-genre-quality:hover span,
td.dubs-subs:hover span {
    overflow: visible;
    background-color: #F6F5F5;
    position: absolute;
    max-width: max-content;
    z-index: 3;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    border-radius: 3px;
}
