/**
 * Styles for the scale data grid
 */

/* Grid container */
#scale-grid-container {
    min-height: 300px;
}

/* Scale data table */
#scale-data-table {
    font-size: 0.9rem;
}

/* Always show horizontal scrollbar */
#scale-data-table .tabulator-tableholder {
    overflow-x: scroll !important;
}

/* CSS triangle icons matching Tabulator's group toggle arrows */
.tbl-arrow-down {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid currentColor;
    vertical-align: middle;
    margin-right: 2px;
}

.tbl-arrow-right {
    display: inline-block;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 5px solid currentColor;
    vertical-align: middle;
    margin-right: 2px;
}

/* Scale topic column: wrap long text */
.tabulator-cell.scale-topic-col {
    white-space: normal !important;
    word-break: break-word;
}

/* Hide status badges when toggled off */
#scale-data-table.hide-status .status-badge {
    display: none !important;
}

/* Back to top button */
.back-to-top-btn {
    display: none;
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: none;
    background-color: #343a40;
    color: #fff;
    font-size: 1.4rem;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    opacity: 0.75;
    line-height: 1;
}

.back-to-top-btn:hover {
    opacity: 1;
}

/* Scale cell styling */
.scale-cell {
    padding: 0.25rem 0;
}

.scale-value {
    font-weight: 500;
    color: #212529;
}

.scale-unit {
    font-size: 0.85rem;
    margin-left: 0.25rem;
}

/* Badge sizing */
.badge-sm {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
}

/* Navbar spacing for dropdowns */
.navbar-nav .nav-item .navbar-text {
    padding: 0.25rem 0.5rem;
    color: rgba(255, 255, 255, 0.5);
}

.navbar-nav .nav-item.dropdown .nav-link {
    color: rgba(255, 255, 255, 0.75);
}

.navbar-nav .nav-item.dropdown .nav-link:hover:not(.disabled) {
    color: rgba(255, 255, 255, 1);
}

.navbar-nav .nav-item.dropdown .nav-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ------------------------------------------------------------------ */
/* Edit mode row states                                                */
/* ------------------------------------------------------------------ */

/* New row: green indicator */
.tabulator-row.row-new .tabulator-cell {
    background: rgba(25, 135, 84, 0.07) !important;
}
/* Frozen cells must use an opaque background so scrolled content doesn't bleed through */
.tabulator-row.row-new .tabulator-cell.tabulator-frozen {
    background: #eff6f3 !important; /* solid equivalent of rgba(25,135,84,0.07) on white */
}
.tabulator-row.row-new::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #198754;
    z-index: 10;
}

/* Deleted row: red, strikethrough, dimmed */
.tabulator-row.row-deleted .tabulator-cell {
    background: rgba(220, 53, 69, 0.07) !important;
    opacity: 0.6;
}
/* Apply strikethrough only to data cells, not the actions column */
.tabulator-row.row-deleted .tabulator-cell:not([tabulator-field="__actions"]) {
    text-decoration: line-through;
}
/* Frozen cells: opaque (no transparency) so scrolled content can't bleed through */
.tabulator-row.row-deleted .tabulator-cell.tabulator-frozen {
    background: #fdf1f2 !important;
    opacity: 1;
}
.tabulator-row.row-deleted::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #dc3545;
    z-index: 10;
}

/* Modified row: amber indicator */
.tabulator-row.row-modified .tabulator-cell {
    background: rgba(255, 193, 7, 0.06) !important;
}
.tabulator-row.row-modified .tabulator-cell.tabulator-frozen {
    background: #fffbf0 !important; /* solid equivalent of rgba(255,193,7,0.06) on white */
}
.tabulator-row.row-modified::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #ffc107;
    z-index: 10;
}

/* Modified cell highlight — frozen variant is opaque */
.tabulator-cell.cell-modified {
    background: rgba(255, 193, 7, 0.22) !important;
}
.tabulator-cell.cell-modified.tabulator-frozen {
    background: #fff5cc !important; /* solid equivalent of rgba(255,193,7,0.22) on white */
}

/* Row state label badge in actions column */
.row-state-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

/* Edit mode toolbar buttons */
.edit-mode-toolbar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

/* Change counter badge */
.change-count-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.12);
    white-space: nowrap;
}

/* Actions column buttons */
.actions-col-btn {
    padding: 1px 5px;
    font-size: 0.75rem;
    line-height: 1.4;
    border-radius: 3px;
}

/* Inline platform cell editor */
.inline-cell-editor {
    min-width: 200px;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.inline-cell-editor input,
.inline-cell-editor select {
    font-size: 0.8rem;
}
.ice-unit-input {
    max-width: 70px;
    flex-shrink: 0;
}

/* Variant editor table */
.variant-editor-table th,
.variant-editor-table td {
    vertical-align: middle;
    font-size: 0.85rem;
}
.variant-editor-table input,
.variant-editor-table select {
    font-size: 0.82rem;
    padding: 0.2rem 0.4rem;
}

/* Deleted variant in variant editor */
.variant-row-deleted td {
    opacity: 0.45;
    text-decoration: line-through;
}

/* Scale topic form checkbox group */
.topic-form-checkboxes {
    max-height: 120px;
    overflow-y: auto;
    font-size: 0.9rem;
}
.topic-form-checkboxes ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.topic-form-checkboxes li {
    padding: 2px 0;
}

/* Diff table */
.diff-table td {
    font-size: 0.85rem;
    vertical-align: top;
}
.diff-old {
    background: rgba(220, 53, 69, 0.08);
}
.diff-new {
    background: rgba(25, 135, 84, 0.1);
    color: #0a3622;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #scale-data-table {
        font-size: 0.8rem;
    }

    .scale-cell {
        padding: 0.15rem 0;
    }

    .badge-sm {
        font-size: 0.65rem;
        padding: 0.15rem 0.3rem;
    }
}
