/* Basic container styling */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    font-family: sans-serif;
}

/* Tab bar styling */
.tabs {
    display: flex;
    border-bottom: 1px solid #ccc;
    margin-bottom: 20px;
}

/* Tab button styling */
.tab-btn {
    padding: 10px 15px;
    cursor: pointer;
    border: none;
    background-color: transparent;
    font-size: 16px;
    outline: none;
    transition: background-color 0.3s, color 0.3s;
    border-radius: 5px 5px 0 0;
}

.tab-btn:hover:not(.active) {
    background-color: #eee;
}

/* Active tab styling */
.tab-btn.active {
    border: 1px solid #ccc;
    border-bottom: 1px solid white; /* visually connects the tab to the content area */
    background-color: #fff;
    font-weight: bold;
    color: #007bff; /* Highlight color */
}

/* Content area styling */
.tab-content {
    padding: 10px 0;
    display: none; /* Hidden by default */
}

/* Show active content */
.tab-content.active {
    display: block;
}

/* Loading state styling */
.loading {
    padding: 20px;
    text-align: center;
    color: #888;
    font-style: italic;
}

/* Footer styling */
.footer {
    margin-top: 40px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    font-size: 0.9em;
    color: #666;
}

/* Table container with fixed header */
.table-container {
    max-height: 600px;
    border: 1px solid #ddd;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

/* Table styling */
.books-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.books-table thead {
    position: sticky !important;
    top: 0 !important;
    background-color: #f8f9fa !important;
    z-index: 100 !important;
    display: table;
    width: 100%;
    table-layout: fixed;
}

.books-table thead tr {
    display: table-row;
}

.books-table tbody {
    display: block;
    max-height: 550px;
    overflow-y: auto;
    width: 100%;
}

.books-table tbody tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}

.books-table th {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 2px solid #ddd;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    background-color: #f8f9fa !important;
    position: sticky;
    top: 0;
}

.books-table th:hover {
    background-color: #e9ecef;
}

.books-table th.sortable::after {
    content: ' ↕';
    color: #999;
}

.books-table th.sort-asc::after {
    content: ' ↑';
    color: #007bff;
}

.books-table th.sort-desc::after {
    content: ' ↓';
    color: #007bff;
}

.books-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #eee;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.books-table tbody tr:nth-child(odd) {
    background-color: #f9f9f9;
}

.books-table tbody tr:nth-child(even) {
    background-color: #ffffff;
}

.books-table tbody tr:hover {
    background-color: #e3f2fd !important;
}



/* Search bar styling */
.search-container {
    margin-bottom: 15px;
}

.search-input {
    width: 100%;
    padding: 10px 15px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.search-input:focus {
    outline: none;
    border-color: #007bff;
}

/* Column width distribution */
.books-table th:nth-child(1), /* Title */
.books-table td:nth-child(1) {
    width: 20%;
    text-align: left;
}

.books-table th:nth-child(2), /* Author */
.books-table td:nth-child(2) {
    width: 15%;
    text-align: center;
}

.books-table th:nth-child(3), /* Pages */
.books-table td:nth-child(3) {
    width: 8%;
    text-align: center;
}

.books-table th:nth-child(4), /* Genre */
.books-table td:nth-child(4) {
    width: 15%;
    text-align: center;
}

.books-table th:nth-child(5), /* Finish Date */
.books-table td:nth-child(5) {
    width: 12%;
    text-align: center;
}

.books-table th:nth-child(6), /* Rating */
.books-table td:nth-child(6) {
    width: 8%;
    text-align: center;
}

.books-table th:nth-child(7), /* Audiobook */
.books-table td:nth-child(7) {
    width: 12%;
    text-align: center;
}

.books-table th:nth-child(8), /* Review */
.books-table td:nth-child(8) {
    width: 10%;
    text-align: center;
}

/* Green checkmark styling */
.checkmark {
    color: #28a745;
    font-size: 18px;
    font-weight: bold;
}


/* Statistics table - equal column widths and centered text */
#statistics .books-table td {
    width: auto;
    text-align: center;
}

#statistics .books-table th {
    white-space: normal;
    line-height: 1.3;
}

/*  */
.collapsible-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #f8f9fa;
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 10px;
    transition: background-color 0.2s;
    border: 1px solid #eee;
}

.collapsible-header:hover {
    background-color: #e9ecef;
}

/* The arrow icon */
.collapsible-header::after {
    content: '▼';
    font-size: 0.8em;
    color: #666;
    transition: transform 0.3s ease;
}

/* Rotated arrow when collapsed */
.collapsible-header.collapsed::after {
    transform: rotate(-90deg);
}

/* Hide content when collapsed */
.collapsible-content.collapsed {
    display: none;
}

/* Chart Layouts (From previous step) */
#statistics-charts {
    margin-top: 10px;
    padding-bottom: 50px;
}

.chart-wrapper {
    background: #fff;
    border: 1px solid #eee;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.charts-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-between;
}

.chart-half {
    flex: 1;
    min-width: 300px;
    background: #fff;
    border: 1px solid #eee;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.chart-wrapper canvas, 
.chart-half canvas {
    max-height: 400px; 
    width: 100%;
}