/* BA Property Management Database - Table Styles */

/* Table Container */
.table-responsive {
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* Main Table Styling */
.table-custom {
    margin-bottom: 0;
    background-color: white;
}

.table-custom thead th {
    background-color: var(--main-color);
    color: white;
    border: none;
    padding: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-custom thead th:first-child {
    border-top-left-radius: var(--border-radius);
}

.table-custom thead th:last-child {
    border-top-right-radius: var(--border-radius);
}

/* Table Body */
.table-custom tbody td {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
    font-size: 0.9rem;
}

.table-custom tbody tr {
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.table-custom tbody tr:hover {
    background-color: rgba(var(--main-color-rgb), 0.05);
}

.table-custom tbody tr:last-child td {
    border-bottom: none;
}

/* Table Cell Specific Styling */
.table-custom td strong {
    color: var(--main-color);
    font-weight: 600;
}

/* Status Badge Positioning in Tables */
.table-custom .badge {
    font-size: 0.7rem;
    padding: 0.4em 0.6em;
}

/* Action Button Styling in Tables */
.table-custom .btn-sm {
    padding: 3px 6px;
    font-size: 0.75rem;
    margin: 1px;
}

.table-custom .btn-sm i {
    font-size: 0.8rem;
}

/* Table Footer Styling */
.table-custom + .card-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 10px 15px;
}

/* Table Sorting Indicators */
.table-custom thead th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.table-custom thead th.sortable:hover {
    background-color: var(--main-color-dark);
}

.table-custom thead th .sort-icon {
    display: inline-block;
    margin-left: 5px;
    font-size: 0.8em;
    opacity: 0.8;
}

.table-custom thead th.sortable::after {
    content: '\f0dc';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 8px;
    opacity: 0.5;
    font-size: 0.8rem;
}

.table-custom thead th.sort-asc::after {
    content: '\f0de';
    opacity: 1;
}

.table-custom thead th.sort-desc::after {
    content: '\f0dd';
    opacity: 1;
}

/* Table Row Selection */
.table-custom tbody tr.selected {
    background-color: rgba(var(--main-color-rgb), 0.1);
    border-left: 3px solid var(--main-color);
}

/* Empty State */
.table-empty {
    text-align: center;
    padding: 40px;
    color: var(--muted-text);
}

.table-empty i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Loading State */
.table-loading {
    position: relative;
}

.table-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

/* Responsive Table Adjustments */
@media (max-width: 768px) {
    .table-custom {
        font-size: 0.8rem;
    }
    
    .table-custom thead th,
    .table-custom tbody td {
        padding: 8px 6px;
    }
    
    .table-custom thead th {
        font-size: 0.75rem;
    }
    
    /* Hide less important columns on mobile */
    .table-custom .d-none-mobile {
        display: none;
    }
    
    /* Stack table cells vertically on very small screens */
    @media (max-width: 576px) {
        .table-custom thead {
            display: none;
        }
        
        .table-custom,
        .table-custom tbody,
        .table-custom tr,
        .table-custom td {
            display: block;
            width: 100%;
        }
        
        .table-custom tr {
            border: 1px solid #e9ecef;
            border-radius: 4px;
            margin-bottom: 10px;
            padding: 10px;
        }
        
        .table-custom td {
            border: none;
            padding: 5px 0;
            position: relative;
            padding-left: 40%;
        }
        
        .table-custom td::before {
            content: attr(data-label);
            position: absolute;
            left: 6px;
            width: 35%;
            text-align: left;
            font-weight: 600;
            color: var(--main-color);
        }
    }
}

/* Table Filter/Search Highlighting */
.table-custom .highlight {
    background-color: #fff3cd;
    padding: 2px 4px;
    border-radius: 2px;
}

/* Table Column Widths */
.table-custom .col-address { width: 25%; }
.table-custom .col-tenant { width: 20%; }
.table-custom .col-filter-size { width: 12%; }
.table-custom .col-date { width: 12%; }
.table-custom .col-status { width: 10%; }
.table-custom .col-actions { width: 10%; }

/* Zebra Striping Alternative */
.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(var(--main-color-rgb), 0.02);
}

/* Table Borders */
.table-bordered {
    border: 1px solid #e9ecef;
}

.table-bordered th,
.table-bordered td {
    border: 1px solid #e9ecef;
}

/* Clickable Row Enhancements */
.clickable-row {
    cursor: pointer !important;
    transition: all 0.2s ease;
}

.clickable-row:hover {
    background-color: rgba(var(--main-color-rgb), 0.08) !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.clickable-row:active {
    transform: translateY(0);
    background-color: rgba(var(--main-color-rgb), 0.12) !important;
}

/* Unit Detail Page Specific Styles */
.unit-detail-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Modal Fix - Prevent layout issues when modal opens */
.modal-open {
    padding-right: 0 !important;
}

.modal-backdrop {
    z-index: 1040;
}

.modal {
    z-index: 1050;
}

/* Prevent body shifts when modal opens */
body.modal-open {
    overflow: hidden;
    padding-right: 0 !important;
}

/* Ensure containers maintain width when modal opens */
.container, .container-fluid {
    padding-right: 15px !important;
    padding-left: 15px !important;
}

/* Prevent table width issues when modal opens */
.table-responsive {
    overflow-x: auto;
    min-width: 100%;
}

/* Status Filter Tabs Styling */
#statusTabs {
    border-bottom: 2px solid #dee2e6;
}

#statusTabs .nav-link {
    color: #495057 !important;  /* Dark text instead of white */
    background-color: transparent !important;
    border: 1px solid transparent;
    border-top-left-radius: 0.375rem;
    border-top-right-radius: 0.375rem;
    padding: 0.75rem 1.25rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

#statusTabs .nav-link:hover {
    border-color: #dee2e6 #dee2e6 transparent;
    background-color: #f8f9fa !important;
    color: var(--main-color) !important;
}

#statusTabs .nav-link.active {
    color: var(--main-color) !important;
    background-color: white !important;
    border-color: #dee2e6 #dee2e6 white;
    border-bottom: 2px solid white;
    margin-bottom: -2px;
}

#statusTabs .nav-link .badge {
    font-size: 0.75rem;
    padding: 0.35em 0.6em;
    font-weight: 600;
}