/* --- Только для элементов новой таблицы используем безопасный box-sizing --- */
#zone-table-wrapper, #zone-table-wrapper *,
.filters, .filters *,
.stats, .stats * {
    box-sizing: border-box;
}

/* Общие стили для тела страницы */
body {
    min-height: 100vh;
    margin: 0;
    
}

/* Контейнер */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* Шапка */
header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f2f5;
}

header h1 { font-size: 28px; color: #1a1a2e; }
.subtitle { color: #666; font-size: 14px; margin-top: 5px; }

/* Основной блок фильтров */
.filters {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

/* Поле ввода с поиском */
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 200px;
    min-width: 150px;
}

.filter-group label {
    font-weight: 600;
    color: #333;
    font-size: 13px;
}

.filter-group input {
    padding: 10px 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    width: 100%;
    transition: border-color 0.3s;
}

.filter-group input:focus {
    border-color: #667eea;
    outline: none;
}

/* Кнопки */
#filter-button, #refresh-button {
    padding: 10px 30px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

#filter-button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

#filter-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

#refresh-button {
    background: #2d3436;
    color: white;
}

#refresh-button:hover {
    background: #1a1a2e;
}

.stats {
    padding: 15px 20px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    margin-bottom: 25px;
}

.stat-item {
    display: flex;
    gap: 8px;
    font-size: 14px;
}
.stat-value { font-weight: 700; color: #1a1a2e; }

/* --- Стили для таблицы --- */
.pricelist-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    margin-top: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.pricelist-table th, 
.pricelist-table td {
    border: 1px solid #ccc;
    padding: 12px 15px;
    text-align: center;
}

.pricelist-table thead tr:first-child th {
    background-color: #f8f9fa;
    font-weight: 700;
    color: #1a1a2e;
}

.pricelist-table thead tr:last-child th {
    background-color: #f0f0f0;
    font-weight: 600;
    color: #333;
}

.zone-col { width: 20%; text-align: left !important; padding-left: 20px !important; }
.registrar-header { font-size: 16px; }

.zone-name-cell {
    text-align: left !important;
    padding-left: 20px !important;
    font-weight: 600;
}

/* Зебра для строк (чередование цветов) */
.pricelist-table tbody tr:nth-child(odd) {
    background-color: #f9f9f9;
}
.pricelist-table tbody tr:nth-child(even) {
    background-color: #ffffff;
}

.pricelist-table tbody tr:hover {
    background-color: #eef6ff;
}

/* Строки, у которых есть цены от обоих регистраторов */
.pricelist-table tbody tr.has-both {
    border-left: 3px solid #667eea;
}

/* ================================================================== */
/* МОБИЛЬНАЯ АДАПТАЦИЯ                                                */
/* ================================================================== */

@media (max-width: 768px) {
    .container {
        padding: 15px 10px;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 15px;
    }

    .filter-group {
        flex: none;
        width: 100%;
        min-width: 0;
    }

    #filter-button, #refresh-button {
        width: 100%;
        padding: 14px;
        text-align: center;
    }
    
    /* ===== ГЛАВНОЕ: АДАПТАЦИЯ ТАБЛИЦЫ ===== */
    #zone-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -10px;
        padding: 0 10px;
    }
    
    .pricelist-table {
        font-size: 12px;
        min-width: 600px;
        border-radius: 0;
    }
    
    .pricelist-table th, 
    .pricelist-table td {
        padding: 8px 6px;
        white-space: nowrap;
    }
    
    .zone-col, 
    .zone-name-cell {
        padding-left: 8px !important;
        min-width: 60px;
    }
    
    /* Делаем колонки с ценами уже */
    .pricelist-table th:not(:first-child),
    .pricelist-table td:not(:first-child) {
        min-width: 55px;
    }
    
    .registrar-header { 
        font-size: 13px; 
    }
}

/* Дополнительная адаптация для очень маленьких экранов */
@media (max-width: 480px) {
    .container {
        padding: 10px 5px;
    }
    
    .pricelist-table {
        font-size: 11px;
        min-width: 520px;
    }
    
    .pricelist-table th, 
    .pricelist-table td {
        padding: 6px 4px;
    }
    
    .zone-col, 
    .zone-name-cell {
        min-width: 45px;
    }
}