/* Table Styles - Corporate Theme */
.table {
    background: var(--bg-tertiary);
    border-radius: 15px;
    overflow: hidden;
    color: var(--text-primary);
    font-size: 0.9rem; /* Slightly smaller base font size */
}

/* Balanced compact table variant */
.table-compact {
    font-size: 0.875rem; /* More readable than 0.75rem */
}

.table-compact td,
.table-compact th {
    padding: 0.375rem 0.75rem; /* More padding than before */
    line-height: 1.3; /* Better line height */
}

.table-compact .btn {
    font-size: 0.8rem; /* Larger than before */
    padding: 0.25rem 0.5rem; /* More padding */
}

.table-compact .badge {
    font-size: 0.75rem; /* More readable */
    padding: 0.25rem 0.5rem; /* Better padding */
}

.table thead {
    background: linear-gradient(135deg, var(--bg-quaternary) 0%, var(--bg-tertiary) 100%);
    color: var(--text-primary);
}

/* Enhanced table hover effects with higher specificity */
.table tbody tr:hover,
.table-hover tbody tr:hover,
.table.table-hover tbody tr:hover {
    background-color: rgba(30, 58, 138, 0.08) !important;
    transform: scale(1.002);
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Ensure hover works on all table variants */
.table.table-sm tbody tr:hover,
.table.table-compact tbody tr:hover {
    background-color: rgba(30, 58, 138, 0.08) !important;
    transform: scale(1.002);
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Clickable table rows */
.clickable-row {
    cursor: pointer;
    transition: all 0.2s ease;
}

.clickable-row:hover {
    background: rgba(30, 58, 138, 0.08) !important;
    transform: scale(1.008);
}

.clickable-row:active {
    transform: scale(1.002);
}

/* Table links */
.table a:not(.btn) {
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

/* Table responsive wrapper */
.table-responsive {
    max-width: 100%;
    overflow-x: auto;
}

/* Advanced table controls */
.advanced-table-controls {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 25px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #333;
}

/* Filter chips */
.filter-chip {
    display: inline-flex;
    align-items: center;
    background: var(--primary-gradient);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 25px;
    font-size: 0.875rem;
    margin: 0.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.filter-chip:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(30, 58, 138, 0.3);
}

.filter-chip .remove {
    margin-left: 0.5rem;
    cursor: pointer;
    opacity: 0.7;
}

.filter-chip .remove:hover {
    opacity: 1;
}

/* Sort headers */
.sort-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: all 0.3s ease;
}

.sort-header:hover {
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.1) 0%, rgba(30, 64, 175, 0.1) 100%);
}

.sort-header.sort-asc::after {
    content: ' ↑';
    color: var(--accent-blue);
    font-weight: bold;
}

.sort-header.sort-desc::after {
    content: ' ↓';
    color: var(--accent-blue);
    font-weight: bold;
}

/* Table search */
.table-search {
    position: relative;
}

.table-search input {
    padding-left: 2.5rem;
    border-radius: 25px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.table-search input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 0.2rem rgba(30, 64, 175, 0.25);
}

.table-search .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
}

/* Advanced filters */
.advanced-filters {
    display: none;
    animation: slideDown 0.3s ease;
}

.advanced-filters.show {
    display: block;
}

.filter-group {
    background: #f8fafc;
    border-radius: 15px;
    padding: 1rem;
    margin-bottom: 1rem;
}

/* Table stats */
.table-stats {
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 1rem;
}

/* Highlight text */
.highlight {
    background-color: rgba(255, 235, 59, 0.3);
    padding: 0.1rem 0.2rem;
    border-radius: 3px;
}

/* Hidden rows */
.row-hidden {
    display: none !important;
}

/* Table input styling for spreadsheet-style editing */
.table-input {
    border: none !important;
    background: transparent !important;
    color: var(--text-primary) !important;
    padding: 0.5rem !important;
    width: 100% !important;
    box-shadow: none !important;
}

.table-input:focus {
    outline: 2px solid var(--accent-blue) !important;
    outline-offset: -1px !important;
    background: rgba(30, 58, 138, 0.05) !important;
    box-shadow: none !important;
}

.table-input.text-right {
    text-align: right !important;
}

.table-input.resizable {
    resize: vertical !important;
}

/* Spreadsheet column widths */
.col-part-number { width: 120px; }
.col-description { width: 300px; }
.col-category { width: 120px; }
.col-cost { width: 100px; }
.col-weight { width: 100px; }
.col-manufacturer { width: 150px; }
.col-supplier { width: 150px; }
.col-actions { width: 80px; }

/* Inline form styling */
.inline-form {
    display: inline;
}

/* Spreadsheet specific styles */
.table-responsive {
    max-height: 70vh;
    overflow-y: auto;
}

.sticky-top {
    position: sticky;
    top: 0;
    z-index: 10;
}

.editable-cell:focus {
    outline: none;
}

.table td {
    padding: 0.25rem 0.5rem;
    vertical-align: middle;
}

.form-control-sm {
    font-size: 0.875rem;
}

/* Freeze first column */
.table th:first-child,
.table td:first-child {
    position: sticky;
    left: 0;
    background: white;
    z-index: 5;
}

.table thead th:first-child {
    z-index: 15;
}

/* BOM specific table hover styles */
.bom-row:hover,
.bom-structure-table tbody tr:hover {
    background-color: rgba(30, 58, 138, 0.08) !important;
    transform: scale(1.002);
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Project detail table hover */
.table tbody tr:hover td {
    background-color: inherit !important;
}

/* Advanced table hover */
.advanced-table tbody tr:hover {
    background-color: rgba(30, 58, 138, 0.08) !important;
    transform: scale(1.002);
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}