/* Mastery Database Container */
.mdb-container {
    max-width: 1395px;
    margin: 0 auto;
    border-radius: 8px;
    overflow: hidden;
    font-family: var(--wp--preset--font-family--system);
    position: relative;
    background: var(--color-card-bg, #1a1a1a);
}

/* Results Area */
.mdb-results {
    padding: 20px;
    background: var(--color-card-bg, #1a1a1a);
}

/* Player Results Table */
.mdb-player-results-container {
    overflow-x: auto;
}

.mdb-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-card-bg, #1a1a1a);
    min-width: 1000px;
}

.mdb-table thead tr {
    background: var(--color-surface, #222222);
}

.mdb-table th {
    padding: 12px 10px;
    text-align: center;
    color: var(--color-text-secondary, #aaaaaa);
    font-family: var(--wp--preset--font-family--big-shoulders-display, sans-serif) !important;
    text-transform: uppercase;
    font-weight: normal;
    font-size: 0.9em;
    border-bottom: 1px solid var(--color-border, #333333);
    cursor: pointer;
    transition: color 0.2s ease;
}

.mdb-table th:hover {
    color: var(--color-text, #ffffff);
}

.mdb-table th a {
    color: inherit;
    text-decoration: none;
    display: block;
    width: 100%;
    height: 100%;
}

.mdb-table th.sorted {
    color: var(--color-text, #ffffff);
    background: rgba(255, 31, 70, 0.1);
}

.mdb-table th.sorted a {
    color: var(--color-text, #ffffff);
    position: relative;
}

.mdb-table th.sorted.asc a::after {
    content: '↑';
    display: inline-block;
    margin-left: 5px;
    color: #ff1f46;
}

.mdb-table th.sorted.desc a::after {
    content: '↓';
    display: inline-block;
    margin-left: 5px;
    color: #ff1f46;
}

.mdb-table tbody tr {
    border-bottom: 1px solid var(--color-border, #333333);
    transition: background 0.2s ease;
}

.mdb-table tbody tr:hover {
    background: var(--color-surface, #222222);
}

.mdb-table td {
    padding: 12px 10px;
    text-align: center;
    color: var(--color-text, #ffffff);
    font-size: 0.9em;
    vertical-align: middle;
}

/* Player Info Cell */
.mdb-td-player {
    text-align: left !important;
    min-width: 250px;
}

.mdb-player-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Mini mastery card spacing within table (structure comes from search.css) */
.mdb-td-player .ss-mini-card {
    margin-right: 10px;
    flex-shrink: 0;
}

.mdb-player-details {
    display: flex;
    flex-direction: column;
}

.mdb-player-name {
    font-weight: 600;
    font-size: 1.1em;
    color: var(--color-text, #ffffff);
    margin-bottom: 4px;
}

.mdb-player-name-link {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

.mdb-player-name-link:hover {
    color: #ff1f46;
}

.mdb-player-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.85em;
    color: var(--color-text-secondary, #aaaaaa);
}

/* Mastery Type Cell */
.mdb-td-mastery-type {
    font-weight: 600;
    color: #ff1f46;
    min-width: 80px;
}

/* Flag Icon */
.mdb-flag-icon {
    width: 15px;
    height: 10px;
    vertical-align: middle;
    margin-right: 4px;
}

/* Nationality Cell */
.mdb-td-nationality {
    min-width: 100px;
}

/* Club Cell */
.mdb-td-club {
    min-width: 120px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Stats Styling */
.mdb-stat-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    font-weight: 600;
    color: #ffffff;
    font-size: 0.9em;
}

.mdb-stat-high { 
    background-color: #4CAF50;
}

.mdb-stat-medium { 
    background-color: #FFC107;
    color: #000000;
}

.mdb-stat-low { 
    background-color: #2196F3;
}

.mdb-stat-default { 
    background-color: var(--color-text-secondary, #666666);
}

/* Rating Cell */
.mdb-td-rating .mdb-stat-box,
.mdb-stat-rating {
    background-color: #ff1f46 !important;
    color: #ffffff !important;
}

/* Position Cell */
.mdb-td-position {
    color: var(--color-text-secondary, #aaaaaa);
    font-weight: 500;
    min-width: 60px;
}

/* Age Cell */
.mdb-td-age {
    min-width: 50px;
}

/* Stat Columns */
.mdb-th-pac,
.mdb-th-sho,
.mdb-th-pas,
.mdb-th-drb,
.mdb-th-def,
.mdb-th-fit,
.mdb-td-pac,
.mdb-td-sho,
.mdb-td-pas,
.mdb-td-drb,
.mdb-td-def,
.mdb-td-fit {
    min-width: 60px;
}

/* Pagination */
.mdb-pagination {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    gap: 5px;
}

.mdb-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    background: var(--color-surface, #222222);
    color: var(--color-text, #ffffff);
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s ease;
    font-family: var(--wp--preset--font-family--big-shoulders-display, sans-serif) !important;
    font-weight: 600;
}

.mdb-pagination .page-numbers.current {
    background: #ff1f46;
    color: #ffffff;
}

.mdb-pagination .page-numbers:hover:not(.current) {
    background: var(--color-background, #333333);
    color: #ff1f46;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mdb-container {
        margin: 0 10px;
    }
    
    .mdb-results {
        padding: 15px;
    }
    
    .mdb-table {
        min-width: 800px;
    }
    
    .mdb-table th,
    .mdb-table td {
        padding: 8px 6px;
        font-size: 0.8em;
    }
    
    .mdb-player-name {
        font-size: 1em;
    }
    
    .mdb-stat-box {
        width: 32px;
        height: 32px;
        font-size: 0.8em;
    }
}

@media (max-width: 480px) {
    .mdb-table th,
    .mdb-table td {
        padding: 6px 4px;
    }
    
    .mdb-stat-box {
        width: 28px;
        height: 28px;
        font-size: 0.75em;
    }
    
    .mdb-pagination .page-numbers {
        min-width: 32px;
        height: 32px;
        font-size: 0.9em;
    }
}

/* Loading States */
.mdb-loading {
    opacity: 0.6;
    pointer-events: none;
}

.mdb-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 26, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.mdb-spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #ff1f46;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: mdb-spin 1s linear infinite;
}

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

/* Empty State */
.mdb-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-secondary, #aaaaaa);
}

.mdb-empty-state h3 {
    font-family: var(--wp--preset--font-family--big-shoulders-display, sans-serif) !important;
    text-transform: uppercase;
    color: var(--color-text, #ffffff);
    margin-bottom: 10px;
}

/* Accessibility */
.mdb-table th:focus,
.mdb-table th a:focus {
    outline: 2px solid #ff1f46;
    outline-offset: 2px;
}

.mdb-pagination .page-numbers:focus {
    outline: 2px solid #ff1f46;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .mdb-container {
        background: white !important;
        color: black !important;
    }
    
    .mdb-table th,
    .mdb-table td {
        border: 1px solid #ccc !important;
        background: white !important;
        color: black !important;
    }
    
    .mdb-pagination {
        display: none;
    }
}
