/* Front page styles */

/* Alpaga search styles */
.alpaga-search-container {
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Filter mode selector */
.alpaga-filter-mode {
    display: flex;
    border-bottom: 1px solid #ddd;
    font-size: 12px;
}

.filter-mode-btn {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-mode-btn.active {
    border-bottom: 2px solid #007bff;
    font-weight: bold;
}

.filter-mode-btn:hover {
    background-color: #f0f0f0;
}

/* Search input and clear button */
.alpaga-search-left {
    flex: 1;
    min-width: 250px;
    display: flex;
    gap: 0.5rem;
}

/* Filter mode containers */
.alpaga-search-right {
    flex: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-mode {
    display: none;
    width: 100%;
}

.filter-mode.active {
    display: flex;
    flex-wrap: wrap;
}

/* Search input */
#alpaga-search-input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

/* Clear button */
#alpaga-search-clear {
    padding: 8px 12px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
    font-size: 12px;
}

#alpaga-search-clear:hover {
    background-color: #e9e9e9;
}

/* Standard filter dropdowns */
.alpaga-filter-dropdown {
    flex: 0 1 auto;
    min-width: 120px;
    max-width: 200px;
    padding: 2px 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    margin-right: 5px;
    margin-bottom: 5px;
}

.alpaga-filter-dropdown:focus {
    outline: none;
    border-color: #007bff;
}

/* Cascading filter dropdowns */
.alpaga-filter-primary,
.alpaga-filter-secondary {
    flex: 1;
    min-width: 200px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-right: 0.5rem;
    font-size: 0.9rem;
}

.alpaga-filter-primary:focus,
.alpaga-filter-secondary:focus {
    outline: none;
    border-color: #007bff;
}

@media (max-width: 768px) {
    .alpaga-search-container {
        flex-direction: column;
    }
    
    .alpaga-search-left,
    .alpaga-search-right {
        width: 100%;
    }
    
    .alpaga-filter-primary,
    .alpaga-filter-secondary {
        width: 100%;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
}

/* Alpaga table styles */
.alpaga-table-wrapper {
    position: relative;
    margin-bottom: 2rem;
    display: flex;
    width: 100%;
    overflow: hidden;
    justify-content: center;
}

.alpaga-table-fixed {
    position: sticky;
    left: 0;
    z-index: 2;
    background-color: #fff;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.alpaga-table-scrollable {
    overflow-x: auto;
    margin-left: -1px; /* Adjust for border overlap */
}

.alpaga-table {
    border-collapse: collapse;
    margin-top: 1rem;
    table-layout: fixed;
    font-size: 12px;
}

.alpaga-table-fixed .alpaga-table {
    width: auto;
}

.alpaga-table-scrollable .alpaga-table {
    width: auto;
    min-width: 100%;
}

.alpaga-table th,
.alpaga-table td {
    padding: 0.75rem 8px;
    border: 1px solid #ddd;
    white-space: nowrap;
}

.alpaga-table th {
    background-color: #f5f5f5;
    font-weight: bold;
    text-align: left;
    position: relative;
}

.alpaga-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.alpaga-table tr:hover {
    background-color: #f1f1f1;
}

/* Ensure rows in both tables have the same height */
.alpaga-table-fixed tr,
.alpaga-table-scrollable tr {
    height: 28px;
}

.sort-indicator {
    margin-left: 0.25rem;
}

/* Ensure the scrollable area doesn't get too small */
@media (max-width: 768px) {
    .alpaga-table-wrapper {
        flex-direction: column;
    }
    
    .alpaga-table-fixed {
        position: relative;
        width: 100%;
        overflow-x: auto;
    }
    
    .alpaga-table-scrollable {
        margin-left: 0;
        margin-top: -1px; /* Adjust for border overlap */
    }
}

/* Modal styles */
.alpaga-modal {
    display: none;
    position: fixed !important;
    z-index: 159999 !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5) !important;
}

.alpaga-modal-content {
    position: relative !important;
    background-color: #fefefe !important;
    margin: 10vh auto !important;
    padding: 30px !important;
    border: 1px solid #888;
    width: 80% !important;
    max-width: 800px !important;
    border-radius: 4px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2) !important;
}

.alpaga-modal-close {
    position: absolute !important;
    top: 10px !important;
    right: 15px !important;
    color: #aaa;
    font-size: 28px !important;
    font-weight: bold;
    cursor: pointer;
    line-height: 28px !important;
}

.alpaga-modal-close:hover {
    color: #333;
}

body.modal-open {
    overflow: hidden !important;
}

.alpaga-modal-loading {
    text-align: center;
    padding: 2rem;
    font-style: italic;
    color: #666;
}

/* Alpaga detail styles in modal */
.alpaga-detail-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.alpaga-detail-table th,
.alpaga-detail-table td {
    padding: 0.75rem;
    border: 1px solid #ddd;
    text-align: left;
}

.alpaga-detail-table th {
    width: 30%;
    background-color: #f5f5f5;
    font-weight: bold;
}

.entry-navigation {
    margin-top: 1.5rem;
}

.back-to-list {
    display: inline-block;
    margin-top: 1rem;
    text-decoration: none;
}

/* Pagination styles */
.alpaga-pagination {
    position: fixed;
    bottom: 0;
    text-align: center;
    left: 0;
    right: 0;
    background-color: #fff;
    padding: 10px 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

/* Add padding to the bottom of the main content to prevent pagination from overlapping content */
.site-main {
    padding-bottom: 150px; /* Adjust based on the maximum height of your pagination */
}

.alpaga-pagination-info {
    margin-bottom: 0.5rem;
    color: #666;
    font-size: 12px;
}

.alpaga-per-page-selector {
    margin: 0.5rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 12px;
}

.alpaga-per-page-selector label {
    color: #666;
}

.alpaga-per-page {
    padding: 0.25rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    font-size: 12px;
    cursor: pointer;
}

.alpaga-per-page:focus {
    outline: none;
    border-color: #007bff;
}

.alpaga-pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.alpaga-pagination-controls * {
    font-size: 12px !important;
}

.alpaga-pagination-link {
    font-size: 12px;
    display: inline-block;
    padding: 6px 12px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.alpaga-pagination-link:hover {
    background-color: #e9e9e9;
}

.alpaga-pagination-current {
    display: inline-block;
    padding: 6px 12px;
    background-color: #007bff;
    border: 1px solid #007bff;
    border-radius: 4px;
    color: #fff;
    font-weight: bold;
}

.alpaga-pagination-disabled {
    display: inline-block;
    padding: 0.5rem 0.75rem;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #aaa;
    cursor: not-allowed;
}

.alpaga-pagination-ellipsis {
    display: inline-block;
    padding: 0.5rem 0.75rem;
    color: #666;
}

/* Loading indicator */
.alpaga-table-wrapper.loading {
    position: relative;
    min-height: 200px;
}

.alpaga-table-wrapper.loading::after {
    content: "Loading...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.8);
    padding: 1rem;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
