* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #001736;
    --secondary-color: #002a5c;
    --accent-color: #f1fc6a;
    --bg-color: #000000;
    --card-bg: #001736;
    --text-color: #ffffff;
    --border-color: #002a5c;
    --light-text: #a0a0a0;
    --apk-color: #f1fc6a;
    --hover-bg: #002a5c;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    font-size: 14px;
    transition: background-color 0.3s, color 0.3s;
    cursor: default;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
}

header {
    background: transparent;
    color: white;
    padding: 24px 0;
    margin-bottom: 24px;
    position: relative;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.header-title {
    flex: 1;
}

.header-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.logo-link {
    display: inline-block;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.logo-link:hover {
    transform: scale(1.02);
}

.header-logo {
    height: 80px;
    width: auto;
    display: block;
    max-width: 100%;
}

h1 {
    font-size: 1.8em;
    margin-bottom: 5px;
    font-weight: 700;
}

.subtitle {
    font-size: 0.95em;
    opacity: 0.9;
}

.header-stats {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.stat {
    background: rgba(255,255,255,0.1);
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.85em;
}

/* Header buttons */
.header-btn {
    padding: 8px 16px;
    border: 2px solid var(--accent-color);
    background: transparent;
    color: var(--accent-color);
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    transition: all 0.2s ease;
    min-width: 50px;
}

.header-btn:hover {
    background: var(--accent-color);
    color: var(--primary-color);
}

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

.info-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    font-weight: 600;
    padding: 0;
    border: 2px solid var(--accent-color);
    background: transparent;
    color: var(--accent-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.info-btn:hover {
    background: var(--accent-color);
    color: var(--primary-color);
}

.controls {
    background: var(--card-bg);
    padding: 18px 20px;
    margin-bottom: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.control-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.control-row:last-child {
    margin-bottom: 0;
}

.search-box {
    flex: 1;
    min-width: 200px;
}

.search-box input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    font-size: 0.9em;
    background: var(--bg-color);
    color: var(--text-color);
    transition: all 0.2s ease;
    font-family: inherit;
}

.search-box input::placeholder {
    font-style: italic;
    opacity: 0.6;
    color: var(--light-text);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(241, 252, 106, 0.15);
}

.filter-icon-btn {
    padding: 10px 16px;
    border: none;
    background: var(--accent-color);
    color: var(--primary-color);
    border-radius: 999px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    transition: all 0.2s ease;
    min-width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.filter-icon-btn:hover {
    background: #e0ec5a;
}

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

.filter-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9em;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85em;
    font-weight: 500;
}

.filter-btn:hover {
    background: var(--hover-bg);
    border-color: var(--accent-color);
}

.filter-btn.active {
    background: var(--accent-color);
    color: var(--primary-color);
    border-color: var(--accent-color);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.filter-btn.active:hover {
    background: #e0ec5a;
    border-color: #e0ec5a;
}

/* Advanced filters */
.range-filter {
    display: flex;
    align-items: center;
    gap: 8px;
}

.range-filter input[type="number"] {
    width: 90px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.85em;
    background: var(--card-bg);
    color: var(--text-color);
    -moz-appearance: textfield;
    transition: all 0.2s ease;
    font-family: inherit;
}

.range-filter input[type="number"]::-webkit-outer-spin-button,
.range-filter input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.range-filter input[type="number"]:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(241, 252, 106, 0.15);
}

.range-filter span {
    font-size: 0.85em;
    color: var(--light-text);
    font-weight: 500;
}

select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.85em;
    cursor: pointer;
    background: var(--card-bg);
    color: var(--text-color);
    transition: all 0.2s ease;
    font-family: inherit;
}

select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(241, 252, 106, 0.15);
}

/* Top pagination */
.pagination-top {
    border-bottom: 2px solid var(--border-color);
    border-top: none;
}

.table-container {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

/* Fixed column widths */
th:nth-child(1), td:nth-child(1) { width: 60px; } /* Rank */
th:nth-child(2), td:nth-child(2) { width: 100px; } /* APK */
th:nth-child(3), td:nth-child(3) { width: auto; min-width: 250px; } /* Product */
th:nth-child(4), td:nth-child(4) { width: 40px; text-align: center; } /* Ordervara icon */
th:nth-child(5), td:nth-child(5) { width: 100px; } /* Volume */
th:nth-child(6), td:nth-child(6) { width: 90px; } /* Alcohol */
th:nth-child(7), td:nth-child(7) { width: 100px; } /* Price */

thead {
    background: #002147;
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 3px solid var(--accent-color);
}

th {
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85em;
    cursor: pointer;
    user-select: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

th.sortable::after {
    content: '';
    opacity: 0;
}

th.sorted-asc::after {
    content: ' ↑';
    opacity: 1;
    font-size: 1em;
}

th.sorted-desc::after {
    content: ' ↓';
    opacity: 1;
    font-size: 1em;
}

tbody tr {
    transition: background-color 0.15s ease;
}

tbody tr:hover {
    background-color: var(--hover-bg);
}

td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9em;
}

.rank {
    font-weight: 700;
    font-size: 1em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.country-flag {
    font-size: 1.5em;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
    margin-right: 8px;
}

.product-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.product-link {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.product-link:hover {
    color: var(--accent-color);
}

.type-icon {
    font-size: 1.3em;
    margin-left: 12px;
}

.type-detailed {
    font-size: 0.8em;
    color: var(--light-text);
    margin-left: 4px;
}

.apk-value {
    font-weight: 700;
    color: var(--apk-color);
    font-size: 1em;
    font-variant-numeric: tabular-nums;
}

.ordervara-row {
    background-color: rgba(0, 42, 92, 0.25);
}

.ordervara-row:hover {
    background-color: rgba(0, 42, 92, 0.4);
}

.ordervara-column {
    text-align: center;
}

.ordervara-icon {
    font-size: 1.1em;
}

.price-value {
    font-weight: 500;
    font-size: 1em;
    color: var(--text-color);
    font-variant-numeric: tabular-nums;
}

.loading {
    text-align: center;
    padding: 40px;
    font-size: 1em;
    color: var(--light-text);
}

.no-results {
    text-align: center;
    padding: 40px;
    font-size: 1em;
    color: var(--light-text);
}

/* Pagination */
.pagination-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding: 15px;
    background: var(--card-bg);
    border-top: 2px solid var(--border-color);
    gap: 10px;
}

.pagination-info {
    font-size: 0.85em;
    color: var(--light-text);
}

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

.page-btn {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 500;
    min-width: 40px;
    transition: all 0.2s ease;
}

.page-btn:hover:not(.active) {
    background: var(--hover-bg);
    border-color: var(--accent-color);
}

.page-btn.active {
    background: var(--accent-color);
    color: var(--primary-color);
    border-color: var(--accent-color);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

/* Info modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    color: var(--text-color);
    padding: 32px;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    position: relative;
    border: 1px solid var(--border-color);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    font-size: 1.5em;
    cursor: pointer;
    border: none;
    background: var(--hover-bg);
    color: var(--text-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--border-color);
    transform: rotate(90deg);
}

.modal-content h2 {
    margin-bottom: 20px;
    color: var(--accent-color);
    font-size: 1.5em;
    font-weight: 700;
}

.modal-content p {
    line-height: 1.6;
    margin-bottom: 12px;
    color: var(--text-color);
}

/* Filters modal specific styles */
.filters-modal-content {
    max-width: 650px;
    max-height: 85vh;
    overflow-y: auto;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    margin-right: 40px; /* Leave space for X button */
}

.filters-header h2 {
    margin-bottom: 0;
}

.filters-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-top: 8px;
}

.filter-label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9em;
    min-width: 110px;
}

.clear-filters-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--light-text);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85em;
    font-weight: 500;
    font-family: inherit;
}

.clear-filters-btn:hover {
    background: var(--hover-bg);
    color: var(--text-color);
    border-color: var(--accent-color);
}

/* Info modal with logos */
.info-modal-content {
    max-width: 600px;
}

.logos-section {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 30px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.logo-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.logo-item a {
    display: block;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.logo-item a:hover {
    transform: scale(1.05);
}

.partner-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: brightness(0.8) sepia(100%) hue-rotate(180deg) saturate(0.4);
}

.logo-label {
    font-size: 0.75em;
    color: var(--light-text);
    text-align: center;
    font-weight: 500;
}

/* Mobile-specific: inline product details */
.mobile-info {
    display: none;
    color: var(--light-text);
    font-size: 0.85em;
    margin-top: 4px;
}

.mobile-info span {
    white-space: nowrap;
}

/* Loading indicator for infinite scroll */
.loading-indicator {
    text-align: center;
    padding: 20px;
    color: var(--light-text);
    display: none;
}

.loading-indicator.active {
    display: block;
}

/* Mobile responsive */
@media (max-width: 768px) {
    body {
        font-size: 16px; /* Increase base font size */
    }

    h1 {
        font-size: 1.6em; /* Larger header */
    }

    .header-logo {
        height: auto;
        width: 100%;
    }

    .header-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .header-controls {
        width: 100%;
        justify-content: flex-end;
    }

    .logos-section {
        flex-direction: column;
        gap: 20px;
    }

    .partner-logo {
        width: 70px;
        height: 70px;
    }

    .control-row {
        flex-direction: column;
        align-items: stretch;
    }

    table {
        font-size: 0.95em; /* Larger table text */
    }

    th, td {
        padding: 8px 6px; /* More padding */
    }

    .type-detailed {
        display: none;
    }

    /* Larger buttons on mobile */
    .filter-icon-btn {
        min-width: 52px;
        height: 52px;
        font-size: 1.3em;
    }

    .header-btn {
        font-size: 1em;
        padding: 8px 16px;
        height: 40px;
    }

    .info-btn {
        font-size: 1.2em;
        width: 40px;
        height: 40px;
    }

    /* Hide pagination on mobile, use infinite scroll */
    .pagination-container {
        display: none;
    }

    /* Hide some columns on mobile (they'll be shown inline) */
    th:nth-child(5), td:nth-child(5),  /* Volume */
    th:nth-child(6), td:nth-child(6),  /* Alcohol */
    th:nth-child(7), td:nth-child(7) { /* Price */
        display: none;
    }

    /* Adjust remaining column widths for mobile */
    th:nth-child(1), td:nth-child(1) { width: 40px; }
    th:nth-child(2), td:nth-child(2) { width: 70px; }
    th:nth-child(3), td:nth-child(3) { width: auto; }
    th:nth-child(4), td:nth-child(4) { width: 40px; }

    /* Show mobile info inline */
    .mobile-info {
        display: block;
    }

    .product-cell {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    header {
        padding: 15px 0;
    }

    .header-logo {
        height: auto;
        width: 100%;
    }

    .controls {
        padding: 12px;
    }

    table {
        font-size: 0.75em;
    }

    .product-cell {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .type-icon {
        margin-left: 8px;
    }
}
