/* mame_browser.css */

/* 1. Variable Definitions - Consistent with Omni-Games UI[cite: 4] */
:root {
    --omni-bg-page: #f4f7f9;
    --omni-bg-container: #ffffff;
    --omni-bg-section: #f8fafc;
    --omni-text: #1e293b;
    --omni-text-muted: #64748b;
    --omni-border: #e2e8f0;
    --omni-primary: #0ea5e9;
    --omni-table-header: #f1f5f9;
    --omni-accent: #059669; 
}

@media (prefers-color-scheme: dark) {
    :root {
        --omni-bg-page: #0f172a;
        --omni-bg-container: #1e293b;
        --omni-bg-section: #334155;
        --omni-text: #f1f5f9;
        --omni-text-muted: #94a3b8;
        --omni-border: #475569;
        --omni-primary: #38bdf8;
        --omni-item-bg: #1e293b;
        --omni-table-header: #334155;
    }
}

/* 2. Full Width Layout Base[cite: 4] */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    background-color: var(--omni-bg-page);
}

.omni1-page {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--omni-text);
    width: 100%;
    /* Set top padding to 170px to push content down below main site nav[cite: 4] */
    padding: 170px 20px 20px 20px; 
    box-sizing: border-box;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    background: var(--omni-bg-container);
    padding: 30px;
    box-sizing: border-box;
    border-radius: 8px;
    border: 1px solid var(--omni-border);
}

/* 3. Header Styling[cite: 4] */
.page-header {
    margin-bottom: 30px;
    border-bottom: 2px solid var(--omni-primary);
    padding-bottom: 10px;
}

.page-header h1 {
    margin: 0;
    color: var(--omni-text);
}

.subtitle {
    color: var(--omni-text-muted);
    margin: 5px 0 0 0;
}

/* 4. Two-Column Grid Layout[cite: 4] */
.omnira-grid-wrapper {
    display: flex;
    gap: 25px;
    width: 100%;
    align-items: flex-start;
}

/* Sidebar Column - Fixed to the left[cite: 4] */
.omnira-sidebar-column {
    flex: 0 0 280px; 
    background: var(--omni-bg-container);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--omni-border);
    position: sticky; /* Keep visible on scroll */
    top: 170px; /* Aligned with page padding */
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

/* Table Column - The main results area[cite: 4] */
.omnira-table-column {
    flex: 1; 
    background: var(--omni-bg-container);
    border-radius: 8px;
    border: 1px solid var(--omni-border);
    overflow: visible; /* Required for sticky header to function */
}

/* 5. Sidebar Controls & Typography[cite: 4] */
.sidebar-label {
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--omni-text-muted);
    margin-bottom: 12px;
}

.sidebar-divider {
    border: 0;
    border-top: 1px solid var(--omni-border);
    margin: 15px 0;
}

.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    padding: 6px 0;
}

.checkbox-container input {
    margin-right: 10px;
    width: 16px;
    height: 16px;
    accent-color: var(--omni-primary);
}

/* 6. MAME Status Badges */
.status-badge {
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: bold;
    display: inline-block;
}

.status-good {
    background-color: #22c55e; /* Green */
    color: #ffffff;
}

.status-imperfect {
    background-color: #f59e0b; /* Amber */
    color: #ffffff;
}

.status-preliminary {
    background-color: #ef4444; /* Red */
    color: #ffffff;
}
.status-unknown {
    background-color: var(--omni-text-muted); /* Grayish blue */
    color: #ffffff;
}

/* 7. Action Buttons[cite: 4] */
.download-btn {
    display: block;        /* Ensures it respects width/margin as a block element */
    width: 100%;           /* Fills the sidebar width */
    box-sizing: border-box; /* CRITICAL: Includes padding/border within the 100% width */
    background-color: var(--omni-text-muted);
    color: white;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s;
    margin-top: 10px;
    text-align: center;
    text-decoration: none;
}

.download-btn:hover {
    filter: brightness(1.1);
}

/* 8. Locked Table Header Row[cite: 4] */
.static-dat-table {
    width: 100%;
    border-collapse: separate; /* Required: collapse can break sticky borders */
    border-spacing: 0;
    font-size: 13px;
}

/* 8. Fixed Sticky Header Logic */
.static-dat-table thead th {
    background: var(--omni-table-header);
    padding: 15px 12px;
    text-align: left;
    color: var(--omni-text);
    font-weight: 700;
    text-transform: uppercase;
    border-bottom: 2px solid var(--omni-border);
    
    /* Stick to the top of the browser window as you scroll */
    position: sticky;
    top: 0; 
    z-index: 10;
}

/* Ensure the container allows the sticky header to be seen */
.omnira-table-column {
    flex: 1; 
    background: var(--omni-bg-container);
    border-radius: 8px;
    border: 1px solid var(--omni-border);
    overflow: visible !important; 
}

/* Prevent text bleeding through header edges */
.static-dat-table thead th::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    border-bottom: 2px solid var(--omni-border);
}

.static-dat-table td {
    padding: 12px;
    border-bottom: 1px solid var(--omni-border);
    color: var(--omni-text);
    vertical-align: middle;
}

.rom-row:hover td {
    background-color: var(--omni-bg-section);
}
/* Style for the clickable "Clone Of" filter */
.family-link {
    color: var(--omni-primary);
    text-decoration: none;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(var(--omni-primary-rgb), 0.1);
    transition: all 0.2s;
}

.family-link:hover {
    background: var(--omni-primary);
    color: #fff;
    text-decoration: none;
}
/* 10. Pagination UI Styles */
.pagination-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--omni-table-header);
    border-top: 1px solid var(--omni-border);
}

.pg-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pg-btn {
    padding: 6px 12px;
    background: var(--omni-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.pg-btn:disabled { background: var(--omni-text-muted); cursor: not-allowed; }

.pg-info {
    font-size: 13px;
    font-weight: 600;
    color: var(--omni-text);
}

.pg-select {
    padding: 5px;
    border-radius: 4px;
    border: 1px solid var(--omni-border);
    background: var(--omni-bg-container);
    color: var(--omni-text);
}

/* 9. Responsive Adjustments[cite: 4] */
@media (max-width: 900px) {
    .omni1-page {
        padding-top: 20px; 
    }
    .omnira-grid-wrapper {
        flex-direction: column;
    }
    .omnira-sidebar-column {
        flex: 1 1 auto;
        width: 100%;
        position: relative;
        top: 0;
        max-height: none;
    }
}