/* History page - dark theme */
.history-page-header {
    background: var(--bg-surface-elevated);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    margin-bottom: 25px;
}

.stats-filter-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.filter-section {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 120px;
}

.filter-group label {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
}

.filter-group select,
.filter-group input[type="number"] {
    padding: 12px 16px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--bg-surface);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.3s ease;
    outline: none;
}

.filter-group select:focus,
.filter-group input[type="number"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-muted);
}

.filter-group select:hover,
.filter-group input[type="number"]:hover {
    border-color: var(--accent);
}

/* Hide number input spinners */
.filter-group input[type="number"]::-webkit-outer-spin-button,
.filter-group input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.filter-group input[type="number"] {
    -moz-appearance: textfield;
}

.stats-submit-btn {
    padding: 12px 24px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    align-self: flex-start;
}

.stats-submit-btn:hover {
    background: var(--accent-hover);
}

.stats-submit-btn:active {
    transform: translateY(0);
}

.season-info {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
}

.modern-filter-form {
    width: 100%;
}

.filter-group-row {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 150px;
    flex: 1;
}

.filter-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.filter-icon {
    font-size: 14px;
}

.modern-input, .modern-select {
    padding: 10px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--bg-surface);
    font-size: 14px;
    color: var(--text-primary);
    transition: all 0.2s ease;
    outline: none;
}

.modern-input:focus, .modern-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-muted);
}

.modern-filter-btn {
    padding: 10px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
}

.modern-filter-btn:hover {
    background: var(--accent-hover);
}

.modern-filter-btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 16px;
}

.btn-text {
    font-weight: 600;
}

/* History table */
.table-container {
    background: var(--bg-surface);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    margin-bottom: 30px;
    border: 1px solid var(--border-primary);
    max-width: 100%;
    box-sizing: border-box;
}

.table-container table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
    max-width: 100%;
}

.table-container thead {
    background: var(--bg-surface-elevated);
}

.table-container thead th {
    padding: 14px 12px;
    color: var(--text-secondary) !important;
    font-weight: 600;
    text-align: center;
    border: none;
    position: relative;
    white-space: nowrap;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    background: var(--bg-surface-elevated) !important;
    border-bottom: 1px solid var(--border-primary);
}

/* Column widths */
.table-container thead th:nth-child(1) { width: 8%; }
.table-container thead th:nth-child(2) { width: 12%; }
.table-container thead th:nth-child(3) { width: 8%; }
.table-container thead th:nth-child(4) { width: 8%; }
.table-container thead th:nth-child(5) { width: 8%; }
.table-container thead th:nth-child(6) { width: 35%; }
.table-container thead th:nth-child(7) { width: 20%; }
.table-container thead th:nth-child(8) { width: 8%; }

.table-container thead th:first-child { border-radius: 0; }
.table-container thead th:last-child { border-radius: 0; }

.table-container tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-secondary);
    background: var(--bg-surface);
}

.table-container tbody tr:nth-child(even) {
    background: var(--table-row-odd);
}

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

.table-container tbody td {
    padding: 10px 12px;
    border: none;
    vertical-align: top;
    color: var(--text-primary);
    max-height: none;
    overflow: visible;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-container tbody td:nth-child(6),
.table-container tbody td:nth-child(7) {
    white-space: normal;
}

.table-container tbody td:nth-child(2) {
    text-align: center;
}

.table-container tbody td:nth-child(6),
.table-container tbody td:nth-child(7) {
    text-align: center;
}

.table-container td.wrap-text {
    text-align: center;
}

/* Match ID */
.table-container tbody td:first-child {
    position: relative;
}

.table-container tbody td:first-child a {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--accent-muted);
    transition: all 0.2s ease;
    display: inline-block;
    border: 1px solid var(--accent-border);
}

.table-container tbody td:first-child a {
    background: var(--accent-muted);
    border-color: var(--accent-border);
}

/* AVG rating badge */
.table-container tbody td:first-child small.match-avg-rating {
    display: inline-block !important;
    margin-top: 4px !important;
    padding: 3px 8px !important;
    background: var(--color-negative) !important;
    color: white !important;
    border-radius: 12px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    text-align: center !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3) !important;
}

/* Winner */
.table-container tbody td:nth-child(2) a {
    color: var(--color-positive);
    font-weight: 700;
    text-decoration: none;
    padding: 3px 6px;
    border-radius: 4px;
    background: rgba(34, 197, 94, 0.1);
    transition: all 0.2s ease;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

/* Duel status */
.table-container tbody td:nth-child(3) {
    text-align: center;
    font-size: 16px;
}

.duel-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.duel-active {
    background: var(--color-negative);
    color: white;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.duel-inactive {
    background: var(--bg-surface-elevated);
    color: var(--text-muted);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.duel-unknown {
    background: var(--color-warning);
    color: white;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

/* Waves */
.table-container tbody td:nth-child(4) {
    font-weight: 700;
    color: var(--accent);
    text-align: center;
}

/* Duration */
.table-container tbody td:nth-child(5) {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--color-warning);
    text-align: center;
}

/* Bans */
.table-container .wrap-text {
    max-width: 300px;
    max-height: 80px;
    overflow: visible;
    position: relative;
}

.table-container thead th.wrap-text {
    text-align: center !important;
}

.bans-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
    max-height: 46px;
    overflow: hidden;
}

.banned-icon-wrap {
    display: inline-block;
    position: relative;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
    transition: transform 0.2s ease;
}

.banned-icon-wrap img {
    width: 22px;
    height: 22px;
    border-radius: 3px;
}

.banned-icon-wrap::after {
    content: '';
    position: absolute;
    top: -1px;
    right: -1px;
    font-size: 8px;
    background: var(--color-negative);
    color: white;
    border-radius: 50%;
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6px;
}

/* Compact bans */
.compact-bans {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    overflow: visible;
    align-items: center;
    justify-content: flex-start;
    align-content: flex-start;
}

.compact-bans .compact-bans-more::before {
    content: "";
    flex-basis: 100%;
    height: 0;
    margin: 0;
    padding: 0;
}

.compact-bans .banned-icon-wrap {
    position: relative;
}

.compact-bans .banned-icon-wrap img {
    width: 20px;
    height: 20px;
    border-radius: 3px;
}

.compact-bans-more {
    background: rgba(100, 116, 139, 0.6);
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    margin: 2px 0 0 0;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-block;
    line-height: 1;
    order: 10;
    cursor: pointer;
}

.compact-bans-more:hover,
.compact-bans-more.active {
    background: var(--accent);
}

.compact-bans-popup {
    display: none;
    gap: 2px;
    order: 20;
    flex-basis: 100%;
}

.compact-bans-popup-abilities.open {
    display: grid;
    grid-template-columns: repeat(8, max-content);
    justify-content: start;
}

.compact-bans-popup-heroes.open {
    display: grid;
    grid-template-columns: repeat(4, max-content);
    justify-content: start;
}

/* Match ID cell layout */
.match-id-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.match-id-top {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Settings gear toggle in match ID cell */
.settings-row-toggle {
    cursor: pointer;
    font-size: 13px;
    opacity: 0.5;
    transition: opacity 0.15s;
    line-height: 1;
}
.settings-row-toggle:hover {
    opacity: 1;
}

/* Expanded settings row */
.settings-expanded-row td {
    padding: 0 !important;
    border-top: none !important;
}
.match-settings-inline {
    padding: 12px 16px;
    background: rgba(255,255,255,0.02);
    border-top: 1px solid rgba(255,255,255,0.04);
}
.match-settings-inline-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #999);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.match-settings-inline-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 6px;
}
.match-settings-inline-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: 5px;
    background: rgba(255,255,255,0.03);
}
.match-settings-inline-item .setting-icon {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    object-fit: cover;
    flex-shrink: 0;
}
.match-settings-inline-label {
    color: var(--text-secondary, #999);
    font-size: 12px;
    flex: 1;
}
.match-settings-inline-value {
    color: var(--text-heading, #fff);
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
}
.setting-bool-yes { color: #4ade80; }
.setting-bool-no  { color: #f87171; }

/* Time */
.table-container tbody td:last-child {
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
}

.table-container tbody td:last-child small {
    display: block;
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 2px;
}

/* Sort links */
.sort-link {
    color: var(--text-secondary) !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.sort-link .arrow {
    font-size: 10px;
    opacity: 0.7;
    color: var(--accent);
}

/* Pagination */
.pagination-nav {
    display: flex;
    justify-content: center;
    margin-top: 25px;
}

.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 8px;
}

.pagination li a {
    display: block;
    padding: 10px 16px;
    background: var(--bg-surface);
    border: 2px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pagination li a:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.pagination li.active a {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Match details expanded card */
.match-details {
    display: none;
    background: var(--bg-surface-elevated);
    border-radius: 12px;
    margin: 10px 20px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-primary);
}

.match-details.expanded {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.match-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.match-info-section {
    background: var(--bg-surface);
    border-radius: 8px;
    padding: 15px;
    border: 1px solid var(--border-primary);
}

.match-info-section h3 {
    margin: 0 0 10px 0;
    color: var(--text-heading);
    font-size: 16px;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 5px;
}

.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.player-card {
    background: var(--bg-surface-elevated);
    border-radius: 6px;
    padding: 10px;
}

.player-place {
    font-weight: 700;
    color: var(--color-negative);
}

.all-bans {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 10px;
}

.all-bans .banned-icon-wrap img {
    width: 28px;
    height: 28px;
    border-radius: 4px;
}

.match-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    background: var(--bg-surface);
    border-radius: 8px;
    padding: 15px;
    border: 1px solid var(--border-primary);
}

.stat-item {
    text-align: center;
    padding: 10px;
    background: var(--bg-surface-elevated);
    border-radius: 6px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-heading);
    display: block;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 5px;
}

/* No data */
.no-data {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 16px;
    background: var(--bg-surface);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-primary);
}
