/* Table View Container */
#table-view-container {
    position: fixed;
    top: 100px;
    /* Aligned with sidebar top */
    left: 390px;
    /* Reduced gap (Sidebar ends ~370px + 20px gap) */
    right: 20px;
    bottom: 20px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.6);
    z-index: 999;
    /* Above map, below modals if any */
    display: none;
    /* Hidden by default */
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease-in-out;
}

/* Toggle Button Icon Logic (Copied from sidebar toggle) */
#menu-table .icon-table,
#menu-table .icon-close {
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Default State (Table Closed): Show Table Icon */
#menu-table .icon-table {
    opacity: 1;
    transform: rotate(0deg);
}

#menu-table .icon-close {
    opacity: 0;
    transform: rotate(90deg);
}

/* Active State (Table Open): Show Close Icon */
#menu-table.active .icon-table {
    opacity: 0;
    transform: rotate(-90deg);
}

#menu-table.active .icon-close {
    opacity: 1;
    transform: rotate(0deg);
}

/* Base Theme Adjustments (if any specific overrides needed) */
body.theme-glass #table-view-container {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* Mobile / Responsive Overrides */
@media (max-width: 768px) {
    #table-view-container {
        left: 0;
        right: 0;
        top: 60px;
        /* Adjust for mobile header */
        bottom: 0;
        border-radius: 0;
        border: none;
        width: 100%;
        height: calc(100% - 60px);
    }
}

/* Table Header Area */
.table-header {
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(255, 255, 255, 0.4);
}

.table-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
}

.table-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2c3e50;
}

.table-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Table Content Area */
.table-scroll-wrapper {
    flex: 1;
    overflow: auto;
    /* Scrollable both ways */
    padding: 0;
}

.listings-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
    /* Ensure horizontal scroll on small screens */
    font-size: 0.9rem;
}

.listings-table th,
.listings-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.listings-table th {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.95);
    /* Opaque enough to hide scrolling text */
    backdrop-filter: blur(4px);
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    z-index: 10;
    cursor: pointer;
    /* Sortable */
    user-select: none;
    transition: background 0.2s;
}

.listings-table th:hover {
    background: rgba(255, 255, 255, 1);
    color: #000;
}

.listings-table th.sort-asc::after {
    content: " ▲";
    font-size: 0.7em;
    margin-left: 4px;
}

.listings-table th.sort-desc::after {
    content: " ▼";
    font-size: 0.7em;
    margin-left: 4px;
}

.listings-table tbody tr {
    transition: background 0.15s;
}

.listings-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

/* Specific Column Styles */
.col-price {
    font-weight: 700;
    color: #2c3e50;
    white-space: nowrap;
}

.col-link a {
    color: #3498db;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
}

.col-link a:hover {
    text-decoration: underline;
}

/* Date column formatting */
.col-date {
    white-space: nowrap;
    color: #7f8c8d;
    font-size: 0.85rem;
}

/* Feature tags in table (small dots or icons?) */
/* For now, just text "Ano/Nie" or similar, maybe simplified */
.feature-check {
    color: #27ae60;
    font-weight: bold;
}

.feature-cross {
    color: #c0392b;
    opacity: 0.5;
}

/* Scrollbar Styling */
.table-scroll-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-scroll-wrapper::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
}

.table-scroll-wrapper::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

.table-scroll-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}