* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    min-width: 330px;
    overflow-x: auto;
}

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

/* Шапка */
header {
    background: linear-gradient(135deg, #1a3a5f, #2c5a8a);
    color: white;
    padding: 5px 0;
    text-align: center;
    border-radius: 0 0 15px 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 0px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.rating-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rating-photo i {
    font-size: 2.5rem;
    color: white;
    opacity: 0.9;
}

.rating-info {
    text-align: center;
    max-width: 400px;
}

.rating-info h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

/* Фиксированный хедер */
.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(26, 58, 95, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 15px rgba(0,0,0,0.3);
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.15);
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.2);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    flex-shrink: 0;
}

.back-button span {
    transition: all 0.3s ease;
    display: inline-block;
    max-width: 80px;
}

.rating-name-header {
    color: white;
    font-weight: 600;
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    text-align: center;
    margin: 0 10px;
}

.rating-name-header.visible {
    opacity: 1;
}

/* Карточка с настройками */
.info-card-wrapper {
    margin-bottom: 5px;
    margin-left: auto;
    margin-right: auto;
}

.info-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    overflow: hidden;
    isolation: isolate;
}

.info-card.collapsed {
    max-height: 60px;
    overflow: hidden;
    border-radius: 10px;
}

.info-card.expanded {
    overflow: visible !important;
    max-height: none !important;
    clip-path: none !important;
    background: transparent !important;
    position: relative;
    isolation: auto;
    z-index: 100;
}

.info-card.expanded::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    border-radius: 10px;
    z-index: -1;
    pointer-events: none;
}

.info-card.expanded .info-card-header,
.info-card.expanded .info-card-content {
    position: relative;
    z-index: 1;
    background: white;
}

.info-card.expanded .info-card-header {
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

.info-card.expanded .info-card-content {
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

.info-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 10px;
    cursor: pointer;
    background: white;
    border-bottom: 1px solid transparent;
}

.info-card.expanded .info-card-header {
    border-bottom-color: #eaeaea;
}

.info-card-header h3 {
    color: #2c5a8a;
    margin: 0;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-btn {
    background: none;
    border: none;
    color: #2c5a8a;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.toggle-btn:hover {
    background: #f0f4f8;
}

.info-card-content {
    padding: 0 10px;
    max-height: 0;
    opacity: 0;
    transition: opacity 0.2s ease, padding 0.2s ease;
    overflow: visible !important;
}

.info-card.expanded .info-card-content {
    padding: 10px;
    max-height: 400px;
    opacity: 1;
    overflow: visible;
}

/* ============================================ */
/* КНОПКИ НАСТРОЕК - ЕДИНЫЙ СТИЛЬ */
/* ============================================ */

/* Контейнер для двух кнопок в ряд */
.buttons-row {
    display: flex;
    gap: 8px;
}

/* Общий стиль для всех кнопок настроек */
.config-btn,
.add-filter-btn {
    background: #f0f4f8;
    color: #1a3a5f;
    border: 1px solid #d1dce9;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.config-btn:hover,
.add-filter-btn:hover {
    background: #e9f0f5;
    border-color: #2c5a8a;
}

/* Обёртки */
.add-filter-wrapper {
    margin-bottom: 0 !important;
    display: inline-block;
}

.columns-selector-wrapper {
    position: relative;
    margin-top: 0 !important;
    display: inline-block;
}

/* ============================================ */
/* ВЫПАДАЮЩИЕ СПИСКИ (ЕДИНЫЙ СТИЛЬ) */
/* ============================================ */

.config-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    margin-top: 5px;
    overflow: hidden;
    min-width: 220px;
}

.config-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f0f4f8;
    border-bottom: 1px solid #ddd;
    font-weight: 600;
    font-size: 0.85rem;
    color: #1a3a5f;
}

.close-dropdown-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #999;
    padding: 0 4px;
}

.close-dropdown-btn:hover {
    color: #d32f2f;
}

.config-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 8px 0;
}

.config-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0px 6px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.85rem;
}

.config-option:hover {
    background-color: #f0f4f8;
}

.config-option input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.config-option label {
    flex: 1;
    cursor: pointer;
    color: #333;
}

.config-dropdown-buttons {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #eaeaea;
    background: #fafafa;
}

.config-btn-small {
    flex: 1;
    padding: 4px 6px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
}

.config-btn-small.select-all {
    background: #2c5a8a;
    color: white;
}

.config-btn-small.select-all:hover {
    background: #1a3a5f;
}

.config-btn-small.deselect-all {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
}

.config-btn-small.deselect-all:hover {
    background: #e9e9e9;
}

.config-btn-small.apply {
    background: #4caf50;
    color: white;
}

.config-btn-small.apply:hover {
    background: #45a049;
}

.config-btn-small.cancel {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
}

.config-btn-small.cancel:hover {
    background: #e9e9e9;
}

/* Таблица */
.rating_card {
    background: white;
    border-radius: 10px;
    padding: 12px 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
    max-width: 100%;
}

.table-container {
    max-height: 600px;
    overflow-y: auto;
    position: relative;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.rating-table {
    width: 100%;
    border-collapse: collapse;
    min-width: auto;
    table-layout: auto;
}

.rating-table th,
.rating-table td {
    padding: 4px 3px;
    text-align: left;
    border-bottom: 1px solid #eaeaea;
    font-size: 0.8rem;
}

.rating-table thead {
    position: sticky;
    top: -1px;
    z-index: 100;
}

.rating-table thead th {
    background-color: #f8f9fa;
    color: #1a3a5f;
    font-weight: 600;
    position: sticky;
    top: -2px;
    border-bottom: 2px solid #eaeaea;
}

.rating-table th:hover {
    background-color: #f8f9fa;
}

.rating-table th i {
    margin-right: 5px;
    font-size: 0.8rem;
    opacity: 0.7;
}

.rating-table tr:hover {
    background-color: #f5f7fa;
}

/* Места */
.rank-column .place-badge {
    display: inline-block;
    border-radius: 50%;
    padding: 4px 8px;
}

.place-1 .place-badge {
    background-color: #FFD700;
    color: #333;
}

.place-2 .place-badge {
    background-color: #C0C0C0;
    color: #333;
}

.place-3 .place-badge {
    background-color: #CD7F32;
    color: #fff;
}

.place-top10 .place-badge {
    background-color: #e9f5ff;
    color: #1a3a5f;
}

.place-other .place-badge {
    background-color: #f5f5f5;
    color: #666;
}

.row-number-column {
    text-align: center;
    background-color: #f8f9fa;
    color: #1a3a5f;
    font-weight: 600;
}

/* Футер */
footer {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    border-top: 1px solid #eaeaea;
}


.filter-tab-close:hover {
    color: #d32f2f !important;
}

.filter-tab-content {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 220px;
    max-height: 350px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    margin-top: 5px;
	white-space: nowrap;
}

/* Выпадающий список выбора фильтра */
.filter-select-dropdown {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
}

.filter-select-option {
    padding: 10px 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.filter-select-option:hover {
    background-color: #f0f4f8;
}

/* Уведомление */
@keyframes fadeOut {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; visibility: hidden; }
}

.filter-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.8rem;
    z-index: 10000;
    animation: fadeOut 2s ease forwards;
}


.text-left {
    text-align: left;
}

.medal-gold {
    color: #FFD700;
}

.medal-silver {
    color: #C0C0C0;
}

.medal-bronze {
    color: #CD7F32;
}

.medal-center {
    text-align: center;
    font-weight: bold;
}

/* Цвета для иконок в заголовках таблицы */
.fa-medal.gold,
i.gold {
    color: #FFD700;
}

.fa-medal.silver,
i.silver {
    color: #C0C0C0;
}

.fa-medal.bronze,
i.bronze {
    color: #CD7F32;
}

.fa-trophy {
    color: #1a3a5f;
}


.config-btn-small.cancel {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
}

.config-btn-small.cancel:hover {
    background: #e9e9e9;
}

/* Стили для иконок в выпадающем списке колонок (если есть) */
.config-option i.fa-medal.gold,
.config-option .medal-gold {
    color: #FFD700;
}

.config-option i.fa-medal.silver,
.config-option .medal-silver {
    color: #C0C0C0;
}

.config-option i.fa-medal.bronze,
.config-option .medal-bronze {
    color: #CD7F32;
}

.config-option i.fa-trophy,
.config-option .total-medal {
    color: #1a3a5f;
}

/* Базовый стиль для иконок в выпадающем списке */
.config-option i {
    text-align: center;
}

/* Активные фильтры */
.active-filters-wrapper {
    background: white;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #eaeaea;
}

.active-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #eaeaea;
    font-size: 0.85rem;
    font-weight: 600;
    color: #1a3a5f;
}

.active-filters-header i {
    margin-right: 6px;
}

.clear-filters-btn {
    background: none;
    border: none;
    color: #d32f2f;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.clear-filters-btn:hover {
    background: #ffebee;
    text-decoration: underline;
}

.active-filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.active-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f0f4f8;
    border: 1px solid #d1dce9;
    border-radius: 16px;
    padding: 4px 10px;
    font-size: 0.8rem;
    color: #1a3a5f;
}

.active-filter-tag .filter-name {
    font-weight: 600;
}

.active-filter-tag .filter-values {
    color: #2c5a8a;
}

.active-filter-tag .remove-filter {
    cursor: pointer;
    color: #999;
    font-size: 0.7rem;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.active-filter-tag .remove-filter:hover {
    color: #d32f2f;
    background: rgba(211, 47, 47, 0.1);
}


/* Стили для пагинации */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 15px;
    flex-wrap: wrap;
}

.pagination-btn {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 3px 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    color: #1a3a5f;
}

.pagination-btn:hover:not(:disabled) {
    background: #e9f0f5;
    border-color: #2c5a8a;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: #2c5a8a;
    color: white;
    border-color: #2c5a8a;
}

.page-number {
    min-width: 20px;
}

.pagination-rows-select {
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
}

.pagination-info {
    font-size: 0.8rem;
    color: #666;
    margin-left: 15px;
}

.hidden-column {
    display: none;
}

.rating-link {
    color: inherit;
    text-decoration: none;
}

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

.icon-question {
    color: #ff6f00;
    font-size: 1.1em;
    vertical-align: middle;
}

.fa-map-marked-alt {
  color: #4CAF50;
}

.fa-route {
  color: #4169E1;
}

.fa-house {
  color: #FFA500;
}

.fa-bolt {
  color: #4169E1;
}

.fa-tree {
  color: #2E7D32;
}

/* Адаптивность */
@media (max-width: 768px) {
    .rating-table {
        min-width: auto;
        width: 100%;
        font-size: 0.6rem;
        line-height: 1.1;
    }
    .rating-table th,
    .rating-table td {
        padding: 2px 3px;
    }
    .container {
        padding: 8px;
    }
    .rating_card {
        padding: 12px 8px;
    }
    .header-content {
        text-align: center;
    }
    .rating-photo {
        width: 100px;
        height: 100px;
    }
    .rating-photo i {
        font-size: 2rem;
    }
    .rating-info h1 {
        font-size: 1.5rem;
    }
    .buttons-row {
        flex-wrap: wrap;
    }

    .pagination-container {
        gap: 4px;
    }

    .pagination-btn {
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    .page-number {
        min-width: 28px;
    }

    .pagination-info {
        font-size: 0.7rem;
        width: 100%;
        text-align: center;
        margin-top: 10px;
        margin-left: 0;
    }

    .pagination-rows-select {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .rating-table {
        font-size: 0.5rem;
    }
    .rating-table th,
    .rating-table td {
        padding: 1px 2px;
    }
    .place-badge {
        padding: 2px 4px;
        font-size: 0.7rem;
        min-width: 20px;
    }
    .rating-photo {
        width: 80px;
        height: 80px;
    }
    .rating-photo i {
        font-size: 1.8rem;
    }
    .rating-info h1 {
        font-size: 1.3rem;
    }
    .info-card-header h3 {
        font-size: 0.9rem;
    }
}