/* === CSS VARIABLES (Light & Dark Mode) === */
:root {
    --body-background: #f8f8f8;
    --main-text-color: #333;
    --input-border-color: #ccc;
    --table-container-background: #f8f8f8;
    
    /* Use consistent variable names */
    --table-header-bg: #f4f4f4;
    --table-row-odd-bg: #fdfdfd;
    --table-row-even-bg: #fafafa;
    --table-row-hover-bg: #0000FF;
    --table-row-hover-text: #FFFFFF;
    --table-border: #ddd;
    --table-shadow: 0 2px 4px rgba(0,0,0,0.1);
    
    /* Alpha button variables */
    --alpha-button-background: #eee;
    --alpha-button-border: #ccc;
    --alpha-button-selected-background: #007acc;
    --alpha-button-selected-border: #007acc;
    --alpha-button-selected-text: white;
}

@media (prefers-color-scheme: dark) {
    :root {
        --body-background: #1a1a1a;
        --main-text-color: #e0e0e0;
        --input-border-color: #555;
        --table-container-background: #1a1a1a;
        
        /* Update ALL table variables for dark mode */
        --table-header-bg: #333;
        --table-row-odd-bg: #2d2d2d;
        --table-row-even-bg: #242424;
        --table-row-hover-bg: #008000;
        --table-row-hover-text: #FFFFFF;
        --table-border: #444;
        --table-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        
        /* Alpha button variables for dark mode */
        --alpha-button-background: #333;
        --alpha-button-border: #555;
        --alpha-button-selected-background: #007acc;
        --alpha-button-selected-border: #007acc;
        --alpha-button-selected-text: white;
    }
}

body[data-theme='dark'] {
    --body-background: #1a1a1a;
    --main-text-color: #e0e0e0;
    --input-border-color: #555;
    --table-container-background: #1a1a1a;
    
    /* Add ALL table variables here too */
    --table-header-bg: #333;
    --table-row-odd-bg: #2d2d2d;
    --table-row-even-bg: #242424;
    --table-row-hover-bg: #008000;
    --table-row-hover-text: #FFFFFF;
    --table-border: #444;
    --table-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    
    --alpha-button-background: #333;
    --alpha-button-border: #555;
    --alpha-button-selected-background: #007acc;
    --alpha-button-selected-border: #007acc;
    --alpha-button-selected-text: white;
}

body {
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--body-background);
    color: var(--main-text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

.dotted-line {
    border-bottom: 2px dotted #ccc;
    margin-top: 5px;
    margin-bottom: 20px;
}

/* === Main Search & Filter Controls (copied from companies.css) === */
.filter-controls-container {
    width: 100%;
    background-color: var(--body-background);
    color: var(--main-text-color);
    padding: 10px 0;
}

.filter-and-buttons-container {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-buttons-container {
    display: flex;
    gap: 10px;
}

.divider {
    width: 1px;
    height: 30px;
    background-color: #ccc;
    margin: 0 5px;
}

.icon-button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: #444;
    padding: 5px;
    transition: color 0.2s ease-in-out;
}

.icon-button:hover {
    color: #007bff;
}

/* === Table Styling === */
.table-container {
    max-height: 70vh;
    overflow-y: auto;
    border: 1px solid var(--table-border);
    background-color: var(--table-container-background);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.company-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--table-container-background);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.company-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--table-header-bg);
    padding: 12px 10px;
    text-align: left;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    border-right: 1px solid var(--table-border);
    border-left: 1px solid var(--table-border);
    color: var(--main-text-color);
}

.company-table td {
    padding: 8px 10px;
    font-size: 14px;
    border-right: 1px solid var(--table-border);
    border-left: 1px solid var(--table-border);
    transition: background-color 0.1s ease, color 0.3s ease;
    color: var(--main-text-color);
}

.company-table tbody tr {
    border-bottom: 1px solid var(--table-border);
    cursor: pointer;
    transition: background-color 0.1s ease, color 0.1s ease;
}

.company-table tbody tr:nth-of-type(odd) {
    background-color: var(--table-row-odd-bg);
}

.company-table tbody tr:nth-of-type(even) {
    background-color: var(--table-row-even-bg);
}

.company-table tbody tr:hover {
    background-color: var(--table-row-hover-bg) !important;
}

.company-table tbody tr:hover td {
    color: var(--table-row-hover-text);
}

/* === Sortable Headers Styling === */
th.sortable {
    position: relative;
    padding-right: 25px; /* Add space for the icon */
}

th.sortable::after {
    content: "⇅";
    position: absolute;
    right: 10px;
    font-size: 0.7em;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.3;
    transition: opacity 0.2s, transform 0.2s;
    line-height: 1; /* Ensures vertical alignment */
}

th.sortable:hover::after {
    opacity: 0.6;
}

/* Style for active sorted column */
th.sortable[data-sort-direction="asc"]::after {
    opacity: 1;
    transform: translateY(-50%) rotate(180deg);
}

th.sortable[data-sort-direction="desc"]::after {
    opacity: 1;
    transform: translateY(-50%) rotate(0deg);
}

.company-details {
    /* Remove padding to align with other page content */
    padding: 0;
}

/* === Filter Tag Styling (copied from companies.css) === */
.filter-tag {
    display: inline-block;
    padding: 5px 10px;
    margin-right: 10px;
    margin-bottom: 0;
    background-color: #FFEB3B;
    color: #000000;
    font-size: 14px;
    white-space: nowrap;
    border-radius: 4px;
    font-weight: bold;
}

.filter-tag.no-filter {
    background-color: #FFEB3B;
    color: #000000;
}

#total-games-count {
    background-color: #0F9ED5;
    color: #FFFFFF;
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: bold;
    white-space: nowrap;
    font-size: 14px;
}

.close-tag-btn {
    background: none;
    border: none;
    color: #000000;
    cursor: pointer;
    font-weight: bold;
    margin-left: 5px;
    padding: 0;
}

.close-tag-btn:hover {
    color: #ff0000;
}

/* === Description Container Styling (copied from companies.css) === */
.description-container {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    margin-bottom: 20px;
    line-height: 1.6;
    color: var(--main-text-color);
    padding-bottom: 15px;
}

/* This hides the content when the 'collapsed' class is present */
#description-content.collapsed {
    display: none;
}

/* This styles the button to look like text and positions it correctly */
.read-more-button {
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    color: var(--main-text-color);
    padding: 0;
    margin-top: 5px;
    font-size: 14px;
    font-weight: bold;
}

.hidden {
    display: none;
}

/* === Header Styling (copied from companies.css) === */
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    flex-wrap: wrap;
    gap: 10px;
}

.header-container h1 {
    font-size: 2em;
    margin: 0;
}

.main-content-wrapper {
    display: block;
    min-height: 100vh;
    padding: 120px 20px 40px;
    box-sizing: border-box;
}

/* === Slide-out Menu Styles === */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
    z-index: 1000;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

.filter-sidebar {
    position: fixed;
    top: 80px;
    left: -800px;
    width: 800px;
    height: 100%;
    background-color: var(--body-background);
    transition: left 0.3s ease-in-out;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    padding-bottom: 80px; /* Add this line */
}

.filter-sidebar.active {
    left: 0;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: var(--table-header-bg);
    border-bottom: 1px solid var(--table-border);
}

.filter-title {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--main-text-color);
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--main-text-color);
    line-height: 1;
    padding: 0;
}

.filter-content {
    padding: 20px;
    padding-bottom: 80px; /* Add or adjust this line */
    overflow-y: auto;
    flex-grow: 1;
}

.filter-group {
    margin-bottom: 25px;
}

.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 10px 0;
    border-bottom: 1px solid var(--table-border);
    margin-bottom: 10px;
}
.filter-divider {
    border-bottom: 1px solid var(--table-border);
    margin: 15px 0;
}
.filter-group-title {
    font-size: 1em;
    font-weight: bold;
    color: var(--main-text-color);
    margin-bottom: 10px;
}

.toggle-icon {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--main-text-color);
}

.collapsible-content {
    display: none;
    padding-left: 10px;
    margin-top: 10px; /* Adds a small gap above the filters */
}

.collapsible-content.expanded {
    display: block;
}

.collapsible-content label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    color: var(--main-text-color);
}

.collapsible-content input[type="checkbox"] {
    cursor: pointer;
    transform: scale(1.2);
}

/* Filter button styling */
.filter-button {
    background: var(--alpha-button-background);
    border: 1px solid var(--alpha-button-border);
    border-radius: 3px;
    padding: 8px 16px;
    cursor: pointer;
    font-weight: bold;
    color: var(--main-text-color);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.filter-button:hover {
    background: var(--alpha-button-selected-background);
    color: var(--alpha-button-selected-text);
    border-color: var(--alpha-button-selected-border);
}
/* Company Statistics Styles */
.company-stats-container {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.company-overview {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 0 8px 8px 0;
    font-size: 1.05rem;
    line-height: 1.6;
    color: #1565c0;
}

.company-overview p {
    margin: 0;
}

.company-stats-container h2 {
    margin: 0 0 1.5rem 0;
    color: #333;
    font-size: 1.5rem;
    border-bottom: 2px solid #007bff;
    padding-bottom: 0.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.stat-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e9ecef;
}

.stat-header i {
    font-size: 1.25rem;
    margin-right: 0.75rem;
    color: #007bff;
}

.stat-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
    font-weight: 600;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #007bff;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-details {
    space-y: 0.5rem;
}

.stat-detail {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    line-height: 1.4;
}

.detail-label {
    color: #666;
    font-weight: 500;
    margin-right: 1rem;
    min-width: fit-content;
}

.detail-value {
    color: #333;
    text-align: right;
    flex: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .stat-detail {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .detail-label {
        margin-bottom: 0.25rem;
    }
    
    .detail-value {
        text-align: left;
    }
}