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

:root {
    --color-primary:  #FF6B5A;
    --color-bg:       #FFF9F0;
    --color-text:     #2A2A2A;
    --color-muted:    #666;
    --color-border:   #F5EDE4;
    --color-white:    #fff;
    --color-hover-bg: #FFFBF5;
    --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
    --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --radius:     8px;
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.05);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.1);
}

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    padding: 2rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 4rem;
    padding: 2rem 0;
}

h1 {
    font-family: var(--font-serif);
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.75rem;
}

.tagline {
    font-size: 1.125rem;
    color: var(--color-muted);
    margin-bottom: 2rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.5rem;
    max-width: 700px;
    margin: 0 auto 3rem;
}

.stat {
    text-align: center;
    padding: 1.5rem 1rem;
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.stat-number {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--color-primary);
    display: block;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

section {
    margin-bottom: 4rem;
}

h2 {
    font-family: var(--font-serif);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 600;
    margin-bottom: 2rem;
    color: var(--color-text);
}

/* --- Region cards --- */

.region-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 3rem;
}

.region-card {
    background: var(--color-white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.region-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.region-name {
    font-size: 0.95rem;
    color: var(--color-muted);
    margin-bottom: 0.5rem;
}

.region-count {
    font-family: var(--font-serif);
    font-size: 2.25rem;
    font-weight: 600;
    color: var(--color-primary);
}

/* --- Bar charts --- */

.bar-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.bar-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.bar-label {
    min-width: 160px;
    font-size: 0.9rem;
}

.bar-track {
    flex: 1;
    height: 36px;
    background: var(--color-border);
    border-radius: 18px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 18px;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
    transition: width 1s ease-out;
}

/* --- Table container --- */

.table-container {
    background: var(--color-white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

/* --- Filters --- */

.filters-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}

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

.search-input {
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    background: var(--color-white);
    color: var(--color-text);
    transition: all 0.2s;
}

.search-input:hover { border-color: var(--color-primary); }

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 90, 0.1);
}

/* --- Multi-select dropdown --- */

.multi-select-container { position: relative; }

.multi-select-input {
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    background: var(--color-white);
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s;
    min-height: 46px;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.multi-select-input:hover { border-color: var(--color-primary); }

.multi-select-input.active {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 90, 0.1);
}

.multi-select-placeholder { color: #999; }

.selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--color-primary);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

.selected-tag-remove { cursor: pointer; opacity: 0.8; font-weight: bold; }
.selected-tag-remove:hover { opacity: 1; }

.multi-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.25rem;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.multi-select-dropdown.active { display: block; }

.dropdown-search {
    position: sticky;
    top: 0;
    background: var(--color-white);
    padding: 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

.dropdown-search input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
}

.dropdown-search input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.dropdown-options { padding: 0.5rem 0; }

.dropdown-option {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dropdown-option:hover { background: var(--color-hover-bg); }

.dropdown-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.dropdown-option.no-results { color: #999; cursor: default; }
.dropdown-option.no-results:hover { background: var(--color-white); }

/* --- Filter actions --- */

.filter-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: 1rem;
}

.reset-btn {
    padding: 0.75rem 1.5rem;
    background: var(--color-border);
    color: var(--color-text);
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.reset-btn:hover {
    background: var(--color-primary);
    color: white;
}

.active-filters {
    color: var(--color-muted);
    font-size: 0.9rem;
}

/* --- Table --- */

.table-info {
    margin-bottom: 1rem;
    color: var(--color-muted);
    font-size: 0.9rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

thead { background: var(--color-border); }

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
    user-select: none;
    position: relative;
}

th:hover { background: #F0E7DA; }

th::after        { content: '⇅'; position: absolute; right: 1rem; opacity: 0.3; }
th.sorted-asc::after  { content: '↑'; opacity: 1; }
th.sorted-desc::after { content: '↓'; opacity: 1; }

td {
    padding: 1rem;
    border-bottom: 1px solid var(--color-border);
}

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

.product-link {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.product-link:hover { text-decoration: underline; }

.industry-tag {
    display: inline-block;
    background: var(--color-border);
    color: #8B7355;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* --- Empty and error states --- */

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--color-muted);
}

.error-message {
    text-align: center;
    padding: 3rem;
    color: #d32f2f;
    font-size: 1.125rem;
}

.error-detail {
    text-align: center;
    padding: 1rem;
    color: #999;
    font-size: 0.875rem;
}

/* --- Pagination --- */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-border);
    background: var(--color-white);
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--color-text);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.pagination-btn.current {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
    font-weight: 600;
}

.pagination-ellipsis {
    color: var(--color-muted);
    font-size: 0.9rem;
    padding: 0 0.25rem;
}

/* --- Footer --- */

footer {
    text-align: center;
    padding: 3rem 0;
    color: var(--color-muted);
    font-size: 0.9rem;
}

footer a {
    color: var(--color-primary);
    text-decoration: none;
}
