/* ============================================= */
/* ==       LIST PAGE LAYOUT & STYLING        == */
/* ============================================= */

.main-content-container {
    background: var(--sidebar);
    border: 1px solid var(--sidebar-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(12px);
    color: var(--sidebar-foreground);
    padding: 2rem;
    margin: 1.5rem 0;
    height: calc(100vh - var(--header-height) - 3rem);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* === NEW: SCROLLBAR STYLING === */
/* This will style the scrollbar inside the main container */
.main-content-container::-webkit-scrollbar { width: 8px; }
.main-content-container::-webkit-scrollbar-track { background: transparent; }
.main-content-container::-webkit-scrollbar-thumb {
    background: var(--primary); /* Using your accent orange color */
    border-radius: var(--radius-sm);
}
.main-content-container::-webkit-scrollbar-thumb:hover {
    background: var(--accent-dark); /* A slightly darker orange on hover */
}


.header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.page-title {
    color: var(--foreground);
    font-size: 1.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
}
.page-title i {
    color: var(--primary);
    margin-right: 0.8rem;
    font-size: 1.5rem;
}

/* === NEW: STATS BADGES CONTAINER === */
.stats-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-badge {
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    text-align: center;
    flex-grow: 1; /* Makes badges fill the space */
}
.stat-number {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}
.stat-text {
    display: block;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    text-transform: uppercase;
    margin-top: 0.25rem;
}


/* === NEW: TABLE HEADER WITH FILTER/SORT BUTTONS === */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}
.table-title {
    color: var(--foreground);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}
.table-actions {
    display: flex;
    gap: 0.5rem;
}

.list-card {
    border-radius: var(--radius-lg);
    overflow: hidden;
    flex-grow: 1;
    border: none;
    box-shadow: none;
    background: transparent;
}
.list-table {
    width: 100%;
    border-collapse: collapse;
}
.list-table thead th {
    background: var(--muted);
    color: var(--muted-foreground);
    padding: 0.75rem 1.25rem;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    text-align: left;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.list-table tbody tr {
    transition: background-color 0.2s ease;
    border-bottom: 1px solid var(--border);
}
.list-table tbody tr:last-child {
    border-bottom: none;
}
.list-table td {
    padding: 1rem 1.25rem;
    color: var(--foreground);
    vertical-align: middle;
    font-size: 0.9rem;
}
.status-badge {
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
}
.status-badge.active { background: var(--success-light); color: var(--success-dark); }
.status-badge.disabled { background: var(--danger-light); color: var(--danger-dark); }
.status-badge.pending { background: var(--info-light); color: var(--info-dark); }
.status-badge.paid { background: var(--success-light); color: var(--success-dark); }
.status-badge.overdue { background: var(--danger-light); color: var(--danger-dark); }
.action-buttons .btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: transparent;
    border: none;
    transition: all 0.2s ease;
    color: var(--muted-foreground);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.action-buttons .btn-view:hover { background-color: var(--info-light); color: var(--info-dark); transform: scale(1.1); }
.action-buttons .btn-edit:hover { background-color: var(--warning-light); color: var(--warning-dark); transform: scale(1.1); }
.action-buttons .btn-delete:hover { background-color: var(--danger-light); color: var(--danger-dark); transform: scale(1.1); }
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--muted-foreground);
}
.empty-state i {
    font-size: 3.5rem;
    color: var(--border);
    margin-bottom: 1rem;
}
.empty-state h5 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.5rem;
}

/* ============================================= */
/* ==      RESPONSIVE TABLE STYLES (MOBILE)   == */
/* ============================================= */

@media screen and (max-width: 767px) {
    /* Hide the table header row completely */
    .list-table thead {
        display: none;
    }

    /* Make the table, body, and rows behave like blocks (cards) */
    .list-table, .list-table tbody, .list-table tr {
        display: block;
        width: 100%;
    }

    /* Style each row like a card */
    .list-table tr {
        margin-bottom: 1rem;
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-sm);
        padding: 1rem;
    }

    /* Make each cell a full-width block */
    .list-table td {
        display: block;
        width: 100%;
        text-align: right; /* Align the data to the right */
        padding: 0.5rem 0;
        border-bottom: 1px solid var(--border);
        position: relative; /* Needed for the label */
    }

    .list-table tr td:last-child {
        border-bottom: none; /* No border for the last cell in a card */
    }

    /* This is the magic part: add the "Header" label before each cell's content */
    .list-table td::before {
        content: attr(data-label); /* Reads the label from the 'data-label' attribute */
        float: left; /* Pushes the label to the left */
        font-weight: 600;
        color: var(--muted-foreground);
        text-transform: uppercase;
        font-size: 0.75rem;
    }

    /* Special styling for the action buttons container on mobile */
    .list-table td.action-buttons {
        text-align: center; /* Center the buttons */
        padding-top: 1rem;
    }
}