/* Checklist Table Pro - Frontend Styles */
/* Charte graphique MyHobbyRoom */
:root {
    --mhr-blue-dark: #041636;
    --mhr-blue-navy: #020b1b;
    --mhr-orange: #ee950a;
    --mhr-green: #00f00f;
}

.checklist-table-wrapper {
    margin: 30px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
}

/* Checklist Sections */
.checklist-section {
    margin-bottom: 40px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.checklist-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.section-title {
    background: var(--mhr-orange);
    color: white;
    padding: 20px;
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.section-footer {
    background: #f8f9fa;
    padding: 15px 20px;
    text-align: right;
    font-weight: 600;
    color: #555;
    border-top: 2px solid #e0e0e0;
}

/* Collection Info Box */
.collection-info {
    background: linear-gradient(to right, #f8f9fa, #e9ecef);
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.collection-info h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--mhr-orange);
}

.collection-info ul {
    list-style: disc;
    padding-left: 20px;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.collection-info li {
    padding: 5px 0;
    font-size: 13px;
    color: #555;
}

/* Export Buttons */
.checklist-export-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    padding: 12px;
    background: linear-gradient(to right, #f8f9fa, #e9ecef);
    border-radius: 8px;
    border: 1px solid #dee2e6;
    flex-wrap: wrap;
}

.checklist-export-btn {
    padding: 10px 18px;
    border: 1px solid #ddd;
    background: #fff;
    color: #555;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.checklist-export-btn:hover {
    background: var(--mhr-orange);
    color: #fff;
    border-color: var(--mhr-orange);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(238, 149, 10, 0.3);
}

.checklist-export-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Sheet Tabs */
.checklist-sheets-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    border-bottom: 2px solid #e0e0e0;
}

.sheet-tab {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-bottom: none;
    padding: 12px 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    border-radius: 5px 5px 0 0;
    transition: all 0.3s ease;
    position: relative;
    bottom: -2px;
}

.sheet-tab:hover {
    background: #fff;
    color: var(--mhr-orange);
}

.sheet-tab.active {
    background: #fff;
    color: var(--mhr-orange);
    border-bottom: 2px solid #fff;
    font-weight: 600;
    box-shadow: 0 -2px 4px rgba(238, 149, 10, 0.1);
}

/* Search Bar */
.checklist-search-bar {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    padding: 12px;
    background: linear-gradient(to right, #f8f9fa, #e9ecef);
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.checklist-search {
    flex: 1;
    min-width: 250px;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: #fff;
}

.checklist-search:focus {
    outline: none;
    border-color: var(--mhr-orange);
    box-shadow: 0 0 0 3px rgba(238, 149, 10, 0.1);
}

.search-results-count {
    color: var(--mhr-orange);
    font-size: 14px;
    font-weight: 600;
    display: none;
    padding: 8px 12px;
    background: rgba(238, 149, 10, 0.1);
    border-radius: 6px;
}

.clear-cache-btn {
    padding: 8px 14px;
    border: 1px solid #ddd;
    background: #fff;
    color: #555;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.clear-cache-btn:hover {
    background: var(--mhr-blue-dark);
    color: #fff;
    border-color: var(--mhr-blue-dark);
}

.clear-cache-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Table Container */
.checklist-table-container {
    overflow-x: auto;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Table */
.checklist-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.checklist-table thead {
    background: var(--mhr-orange);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.checklist-table th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    white-space: nowrap;
    position: relative;
    transition: background 0.2s ease;
}

/* Styles spécifiques pour les en-têtes triables (checklists) */
.checklist-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.checklist-table th.sortable:hover {
    background: rgba(255, 255, 255, 0.2);
}

.checklist-table th.sortable .sort-icon {
    margin-left: 5px;
    opacity: 0.8;
    font-size: 11px;
    transition: opacity 0.2s ease;
}

.checklist-table th.sortable:hover .sort-icon {
    opacity: 1;
}

/* Styles pour les en-têtes non-triables (listes de joueurs, etc.) */
.checklist-table th.no-sort {
    cursor: default;
    user-select: none;
}

.checklist-table th.no-sort:hover {
    background: transparent;
}

/* Filter Row */
.filter-row th {
    padding: 8px 12px !important;
    background: rgba(255,255,255,0.95) !important;
    cursor: default !important;
}

.filter-row th:hover {
    background: rgba(255,255,255,0.95) !important;
}

.column-filter {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    background: #fff;
    color: #333;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.column-filter:focus {
    outline: none;
    border-color: var(--mhr-orange);
}

/* Table Body */
.checklist-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
}

.checklist-table tbody tr:hover {
    background: linear-gradient(to right, #fff8f0, #fff4e6);
    transform: scale(1.001);
}

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

.checklist-table td {
    padding: 12px;
    color: #333;
}

.checklist-table tbody tr:nth-child(even) {
    background: rgba(248, 249, 250, 0.5);
}

/* Responsive Table */
@media (max-width: 768px) {
    .checklist-table {
        font-size: 13px;
    }
    
    .checklist-table thead {
        display: none;
    }
    
    .checklist-table tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }
    
    .checklist-table td {
        display: flex;
        justify-content: space-between;
        padding: 10px 15px;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .checklist-table td:last-child {
        border-bottom: none;
    }
    
    .checklist-table td:before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--mhr-orange);
        margin-right: 10px;
        min-width: 40%;
    }
    
    .checklist-export-bar {
        flex-direction: column;
    }
    
    .checklist-export-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Pagination */
.checklist-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 15px 20px;
    background: linear-gradient(to right, #f8f9fa, #e9ecef);
    border-radius: 8px;
    border: 1px solid #dee2e6;
    flex-wrap: wrap;
    gap: 15px;
}

.pagination-info {
    color: #555;
    font-size: 14px;
    font-weight: 500;
}

.pagination-info span {
    font-weight: 600;
    color: var(--mhr-orange);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pagination-btn {
    padding: 8px 14px;
    border: 1px solid #ddd;
    background: #fff;
    color: #555;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--mhr-orange);
    color: #fff;
    border-color: var(--mhr-orange);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(238, 149, 10, 0.3);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f5f5f5;
}

.pagination-pages {
    display: flex;
    gap: 3px;
    margin: 0 5px;
}

.pagination-page-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: #fff;
    color: #555;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.pagination-page-btn:hover {
    background: #f0f0f0;
    border-color: var(--mhr-orange);
}

.pagination-page-btn.active {
    background: var(--mhr-orange);
    color: #fff;
    border-color: var(--mhr-orange);
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(238, 149, 10, 0.3);
}

.pagination-ellipsis {
    padding: 6px 8px;
    color: #999;
}

.pagination-per-page {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-per-page label {
    font-size: 14px;
    color: #555;
    font-weight: 500;
}

.per-page-select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: border-color 0.2s ease;
}

.per-page-select:focus {
    outline: none;
    border-color: var(--mhr-orange);
}

/* Error/Empty States */
.checklist-error,
.checklist-empty {
    padding: 40px;
    text-align: center;
    color: #666;
    background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
    border: 2px dashed #dee2e6;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
}

.checklist-error {
    color: #dc3545;
    background: linear-gradient(to bottom, #fff5f5, #ffe5e5);
    border-color: #ffc9c9;
}

/* Responsive Pagination */
@media (max-width: 768px) {
    .checklist-pagination {
        flex-direction: column;
        align-items: stretch;
    }
    
    .pagination-controls,
    .pagination-per-page {
        justify-content: center;
    }
    
    .pagination-btn {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    .pagination-pages {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Loading Animation */
.checklist-loading {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px dashed #dee2e6;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.checklist-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(238, 149, 10, 0.1), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.loading-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid var(--mhr-orange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.checklist-loading p {
    color: #666;
    font-size: 16px;
    margin: 0;
    font-weight: 500;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.checklist-section {
    animation: fadeIn 0.5s ease;
}

/* Print styles */
@media print {
    .checklist-export-bar,
    .checklist-search-bar,
    .checklist-pagination,
    .sheet-tab,
    .clear-cache-btn {
        display: none !important;
    }
    
    .checklist-section {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #333;
    }
    
    .checklist-table thead {
        background: #333 !important;
        color: #fff !important;
    }
}
/* Badge Rookie Card (RC) - Topps Chrome et similaires */
.badge-rc {
    display: inline-block;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 5px;
    vertical-align: middle;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.row-rookie td:first-child {
    font-weight: 600;
}

/* Version 3: accessible controls and scoped visual resets. */
.checklist-table-wrapper .checklist-sort-btn { border: 0; background: transparent; color: inherit; font: inherit; font-weight: inherit; padding: 0; cursor: pointer; text-align: left; }
.checklist-table-wrapper button:focus-visible, .checklist-table-wrapper select:focus-visible, .checklist-table-wrapper input:focus-visible { outline: 3px solid #3158ba; outline-offset: 3px; }
.checklist-table-wrapper .checklist-export-help { font-size: 12px; align-self: center; }
.checklist-table-wrapper .checklist-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.checklist-table-wrapper .checklist-pagination { flex-wrap: wrap; gap: 12px; }
.checklist-table-wrapper .clear-cache-btn { flex-shrink: 0; }
@media screen and (max-width: 768px) {
    /* Keep sorting and filters available on mobile; scroll the table horizontally. */
    .checklist-table-wrapper .checklist-table-container { overflow-x: auto; }
    .checklist-table-wrapper .checklist-table { min-width: 520px; }
    .checklist-table-wrapper .checklist-table thead { display: table-header-group; }
    .checklist-table-wrapper .checklist-table tbody tr { display: table-row; box-shadow: none; }
    .checklist-table-wrapper .checklist-table td { display: table-cell; }
    .checklist-table-wrapper .checklist-table td:before { content: none; }
}
.checklist-table-wrapper .checklist-browse-controls { display: flex; flex-wrap: wrap; gap: 16px; margin: 18px 0; }
.checklist-table-wrapper .checklist-browse-controls label { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 200px; }
.checklist-table-wrapper .checklist-browse-controls select { padding: 10px; border: 1px solid #d8dee7; border-radius: 6px; max-width: 100%; width: 100%; }
.checklist-table-wrapper .checklist-series-details { margin: 16px 0; background: #fff8e8; padding: 16px; border-radius: 8px; }
.checklist-table-wrapper .checklist-series-details summary { cursor: pointer; font-weight: 600; }
.checklist-table-wrapper .checklist-collection-title { margin: 0; }
.checklist-table-wrapper .checklist-overview { color: #525c6a; }
.checklist-table-wrapper button { font: inherit; }
.checklist-table-wrapper .sheet-tab, .checklist-table-wrapper .checklist-export-btn { padding: 10px 16px; border: 1px solid #ccd3dc; border-radius: 6px; background: #fff; cursor: pointer; }
.checklist-table-wrapper .checklist-table th { min-width: 100px; }
.checklist-table-wrapper .checklist-table td { overflow-wrap: normal; }
.checklist-table-wrapper .checklist-table { min-width: 740px; }
@media screen and (max-width: 768px) {
    .checklist-table-wrapper .checklist-table { min-width: 740px; }
    .checklist-table-wrapper .checklist-table td { padding: 12px; }
}

.checklist-table-wrapper .checklist-view-tabs { display: flex; gap: 8px; margin: 16px 0; flex-wrap: wrap; }
.checklist-table-wrapper .checklist-view-tab { background: #fff; color: #253447; border: 1px solid #cbd2dc; border-radius: 6px; padding: 10px 18px; cursor: pointer; }
.checklist-table-wrapper .checklist-view-tab[aria-pressed="true"] { background: #253447; color: #fff; border-color: #253447; }
.checklist-table-wrapper .checklist-browse-controls[hidden], .checklist-table-wrapper .checklist-team-controls[hidden] { display: none; }
.checklist-table-wrapper .checklist-team-controls { margin: 16px 0; }
.checklist-table-wrapper .checklist-team-controls label { display: flex; flex-direction: column; gap: 8px; }
.checklist-table-wrapper .checklist-team-controls select { max-width: 100%; padding: 10px; border: 1px solid #d8dee7; border-radius: 6px; }
.checklist-table-wrapper .checklist-team-help { font-size: 13px; color: #525c6a; }
.checklist-table-wrapper .checklist-team-summary { margin: 16px 0; }
.checklist-table-wrapper .checklist-export-btn:disabled { opacity: .5; cursor: default; }

/* Mobile cards share the table's filters, order and pagination; desktop stays unchanged. */
.checklist-table-wrapper .checklist-mobile-view { display: none; }
@media screen and (max-width: 768px) {
    .checklist-table-wrapper .checklist-has-mobile-view > .checklist-table-container,
    .checklist-table-wrapper .checklist-has-mobile-view > .checklist-pagination { display: none; }
    .checklist-table-wrapper .checklist-mobile-view { display: block; color: #253447; }
    .checklist-table-wrapper .checklist-section.checklist-has-mobile-view { padding: 0; background: transparent; box-shadow: none; border: 0; }
    .checklist-table-wrapper .checklist-mobile-filters { border-bottom: 1px solid #d8dee7; margin-bottom: 14px; }
    .checklist-table-wrapper .checklist-mobile-filters summary { padding: 12px 0; min-height: 44px; box-sizing: border-box; cursor: pointer; font-weight: 600; }
    .checklist-table-wrapper .checklist-mobile-filter-fields { display: grid; gap: 12px; padding: 0 0 16px; }
    .checklist-table-wrapper .checklist-mobile-filter-fields label { display: flex; flex-direction: column; gap: 6px; }
    .checklist-table-wrapper .checklist-mobile-view select { max-width: 100%; width: 100%; min-width: 0; min-height: 44px; padding: 8px; font-size: 16px; background: #fff; color: #253447; border: 1px solid #d8dee7; border-radius: 6px; }
    .checklist-table-wrapper .checklist-mobile-status { font-size: 13px; color: #525c6a; margin: 8px 0; }
    .checklist-table-wrapper .checklist-mobile-pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
    .checklist-table-wrapper .checklist-mobile-pagination button { min-height: 44px; padding: 8px 10px; }
    .checklist-table-wrapper .checklist-mobile-pagination select { width: auto; }
    .checklist-table-wrapper .checklist-mobile-card { padding: 14px; margin: 10px 0; border: 1px solid #d8dee7; border-radius: 10px; background: #fff; overflow-wrap: anywhere; }
    .checklist-table-wrapper .checklist-mobile-card-title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
    .checklist-table-wrapper .checklist-mobile-card-title strong { font-weight: 600; }
    .checklist-table-wrapper .checklist-mobile-number { color: #a55b00; font-weight: 600; }
    .checklist-table-wrapper .checklist-mobile-card p { margin: 5px 0 0; padding: 0; font-size: 13px; }
    .checklist-table-wrapper .checklist-mobile-card-context { color: #525c6a; }
    .checklist-table-wrapper .checklist-mobile-card-field span { font-weight: 600; }
    .checklist-table-wrapper .checklist-search-bar { padding: 10px; gap: 8px; margin-bottom: 12px; }
    .checklist-table-wrapper .checklist-search { min-width: 0; min-height: 44px; font-size: 16px; }
    .checklist-table-wrapper .clear-cache-btn { min-height: 44px; padding: 8px 12px; }
    .checklist-table-wrapper .checklist-browse-controls { margin: 12px 0; gap: 10px; }
    .checklist-table-wrapper .checklist-browse-controls label { min-width: 0; flex-basis: 100%; }
    .checklist-table-wrapper .checklist-browse-controls select,
    .checklist-table-wrapper .checklist-team-controls select { min-height: 44px; font-size: 16px; width: 100%; min-width: 0; }
    .checklist-table-wrapper .checklist-view-tabs { flex-wrap: nowrap; gap: 6px; margin: 12px 0; }
    .checklist-table-wrapper .checklist-view-tab { flex: 1; padding: 10px 8px; min-height: 44px; }
    .checklist-table-wrapper .checklist-team-help { font-size: 12px; line-height: 1.5; margin: 8px 0; }
    .checklist-table-wrapper .checklist-team-summary { margin: 12px 0; }
}

/* Keep light controls legible inside themes with dark article text and fixed field heights. */
.checklist-table-wrapper .checklist-overview,
.checklist-table-wrapper .checklist-team-help { color: inherit; opacity: .85; }
.checklist-table-wrapper .checklist-export-bar,
.checklist-table-wrapper .checklist-search-bar,
.checklist-table-wrapper .checklist-pagination,
.checklist-table-wrapper .checklist-series-details { color: #253447; }
.checklist-table-wrapper .checklist-export-help { color: #525c6a; }
.checklist-table-wrapper input.checklist-search,
.checklist-table-wrapper select.column-filter,
.checklist-table-wrapper select.per-page-select,
.checklist-table-wrapper .checklist-browse-controls select,
.checklist-table-wrapper .checklist-team-controls select,
.checklist-table-wrapper .checklist-mobile-view select {
    box-sizing: border-box;
    height: auto;
    min-height: 44px;
    line-height: 1.4;
    padding-top: 10px;
    padding-bottom: 10px;
    color: #253447;
    background-color: #fff;
    font-family: inherit;
    text-transform: none;
    letter-spacing: normal;
    opacity: 1;
}
.checklist-table-wrapper select.column-filter,
.checklist-table-wrapper select.per-page-select,
.checklist-table-wrapper .checklist-browse-controls select,
.checklist-table-wrapper .checklist-team-controls select,
.checklist-table-wrapper .checklist-mobile-view select { padding-left: 10px; padding-right: 34px; }
.checklist-table-wrapper input.checklist-search::placeholder { color: #606c7a; opacity: 1; }
.checklist-table-wrapper .checklist-export-btn,
.checklist-table-wrapper .clear-cache-btn { color: #253447; background: #fff; }
.checklist-table-wrapper .checklist-table th,
.checklist-table-wrapper .checklist-table td { line-height: 1.5; }

.checklist-table-wrapper .checklist-browse-controls label[hidden] { display: none; }
