/* Table Density Styles */

/* Compact Density - Minimal padding for power users */
.table-density-compact table.table {
    font-size: 0.875rem;
}

.table-density-compact table.table th,
.table-density-compact table.table td {
    padding: 0.375rem 0.5rem;
    line-height: 1.3;
}

.table-density-compact table.table .btn-sm {
    padding: 0.15rem 0.4rem;
    font-size: 0.8rem;
}

.table-density-compact .page-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

/* Comfortable Density - Default, balanced spacing */
.table-density-comfortable table.table th,
.table-density-comfortable table.table td {
    padding: 0.75rem;
}

/* Spacious Density - Extra padding for touch targets */
.table-density-spacious table.table {
    font-size: 1rem;
}

.table-density-spacious table.table th,
.table-density-spacious table.table td {
    padding: 1rem 1.25rem;
    line-height: 1.6;
}

.table-density-spacious table.table .btn {
    padding: 0.5rem 1rem;
    font-size: 1rem;
}

.table-density-spacious table.table .btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.9rem;
}

.table-density-spacious .page-header h1 {
    font-size: 2.25rem;
    margin-bottom: 1.5rem;
}

/* Density dropdown styling */
#table-density-toggle .dropdown-menu {
    min-width: 280px;
}

#table-density-toggle .dropdown-item {
    padding: 0.75rem 1rem;
    white-space: normal;
    line-height: 1.4;
}

#table-density-toggle .dropdown-item:hover {
    background-color: var(--bs-secondary-bg);
}

#table-density-toggle .dropdown-item.active {
    background-color: var(--bs-primary-bg-subtle);
    color: var(--bs-emphasis-color);
}

#table-density-toggle .dropdown-item small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
}

#table-density-toggle .dropdown-header {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--bs-secondary);
}

/* Smooth transitions */
table.table th,
table.table td {
    transition: padding 0.2s ease, font-size 0.2s ease;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    /* On mobile, default to compact for better scrolling */
    body:not(.table-density-spacious):not(.table-density-comfortable) table.table th,
    body:not(.table-density-spacious):not(.table-density-comfortable) table.table td {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    /* Spacious mode on mobile - good for touch */
    .table-density-spacious table.table th,
    .table-density-spacious table.table td {
        padding: 0.875rem 1rem;
    }
}

/* Dark mode adjustments */
[data-bs-theme="dark"] #table-density-toggle .dropdown-item.active {
    background-color: rgba(13, 110, 253, 0.15);
}

[data-bs-theme="dark"] #table-density-toggle .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Improve readability in compact mode */
.table-density-compact table.table tbody tr:hover {
    background-color: var(--bs-secondary-bg);
}

/* Better button alignment in different densities */
.table-density-compact table.table .btn-group {
    gap: 0.15rem;
}

.table-density-spacious table.table .btn-group {
    gap: 0.5rem;
}

/* Adjust checkboxes and form elements */
.table-density-compact table.table input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.table-density-spacious table.table input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

/* Pagination adjustments */
.table-density-compact .pagination {
    font-size: 0.875rem;
}

.table-density-compact .pagination .page-link {
    padding: 0.375rem 0.65rem;
}

.table-density-spacious .pagination {
    font-size: 1.05rem;
}

.table-density-spacious .pagination .page-link {
    padding: 0.625rem 1rem;
}

/* Badge sizing */
.table-density-compact .badge {
    font-size: 0.7rem;
    padding: 0.2em 0.5em;
}

.table-density-spacious .badge {
    font-size: 0.85rem;
    padding: 0.4em 0.7em;
}

/* Icon sizing */
.table-density-compact table.table i {
    font-size: 0.9rem;
}

.table-density-spacious table.table i {
    font-size: 1.1rem;
}

/* Action button sizing in tables */
.table-density-compact table.table .btn-group .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.table-density-comfortable table.table .btn-group .btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.table-density-spacious table.table .btn-group .btn {
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
}

/* Filter panel adjustments */
.table-density-compact .filter-panel {
    padding: 0.75rem;
}

.table-density-compact .filter-panel .form-label {
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.table-density-compact .filter-panel .form-control,
.table-density-compact .filter-panel .form-select {
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
}

.table-density-spacious .filter-panel {
    padding: 1.5rem;
}

.table-density-spacious .filter-panel .form-label {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.table-density-spacious .filter-panel .form-control,
.table-density-spacious .filter-panel .form-select {
    padding: 0.625rem 1rem;
    font-size: 1rem;
}

/* Table header adjustments */
.table-density-compact table.table thead th {
    font-size: 0.8rem;
    font-weight: 600;
}

.table-density-spacious table.table thead th {
    font-size: 1.05rem;
    font-weight: 600;
}

/* Link styling in different densities */
.table-density-compact table.table a {
    font-size: inherit;
}

.table-density-spacious table.table a {
    font-size: inherit;
    padding: 0.125rem 0;
}

/* Truncation improvements */
.table-density-compact .text-truncate {
    max-width: 150px;
}

.table-density-spacious .text-truncate {
    max-width: 300px;
}
