/* ========== ОСНОВНЫЕ СТИЛИ ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f7fb;
    color: #1e293b;
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}
.red {
    color:#f00;
}
/* ========== ШАПКА ========== */
.header {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    margin-bottom: 24px;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #0f172a;
}

.header h1 i {
    margin-right: 8px;
}

/* ========== ФОРМА ПОИСКА ========== */
.search-form {
    display: grid;
    grid-template-columns: 1fr 1fr 100px auto auto;
    gap: 12px;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
}

.form-group input,
.form-group select {
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    background: white;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.form-group input[type="number"] {
    width: 100%;
}

/* ========== АВТОКОМПЛИТ ========== */
.autocomplete-container {
    position: relative;
    width: 100%;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-top: 4px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
}

.autocomplete-item:hover {
    background: #f8fafc;
}

.autocomplete-item strong {
    color: #0f172a;
    font-weight: 600;
}

.autocomplete-item small {
    color: #94a3b8;
    font-size: 12px;
    margin-left: 8px;
}

/* ========== КНОПКИ ========== */
.advanced-btn,
.search-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    height: 42px;
}

.advanced-btn {
    background: #f1f5f9;
    color: #475569;
}

.advanced-btn:hover {
    background: #e2e8f0;
}

.search-btn {
    background: #3b82f6;
    color: white;
    box-shadow: 0 4px 8px rgba(59,130,246,0.2);
}

.search-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

/* ========== РАСШИРЕННЫЕ ПОЛЯ ========== */
.advanced-fields {
    display: none;
    grid-column: 1 / -1;
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    margin-top: 12px;
}

.advanced-fields.active {
    display: block;
}

.form-row {
    margin-bottom: 20px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.radius-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ========== ВЫБОР ДАТ ========== */
.date-dropdown {
    position: relative;
}

.date-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    cursor: pointer;
}

.date-trigger:hover {
    border-color: #3b82f6;
}

.date-trigger-caption {
    font-size: 14px;
}

.date-trigger-value {
    color: #64748b;
    font-size: 13px;
}

.date-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 320px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-top: 4px;
    box-shadow: 0 12px 24px rgba(0,0,0,0.1);
    z-index: 1000;
    display: none;
}

.date-dropdown-menu.show {
    display: block;
}

.date-option-list {
    list-style: none;
    max-height: 280px;
    overflow-y: auto;
}

.date-option-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
}

.date-option-item:hover {
    background: #f8fafc;
}

.date-option-item.selected {
    background: #eff6ff;
}

.date-option-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.date-option-title {
    font-weight: 500;
    font-size: 14px;
    color: #0f172a;
}

.date-option-subtitle {
    font-size: 12px;
    color: #64748b;
}

.manual-dates {
    padding: 16px;
    border-top: 1px solid #e2e8f0;
}

.manual-dates-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #3b82f6;
    font-size: 14px;
    cursor: pointer;
    padding: 8px 0;
}

.manual-dates-inputs {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.manual-dates-inputs.active {
    display: grid;
}

.date-input {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
}

/* ========== ЗАГРУЗКА ========== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== АДАПТИВНОСТЬ ========== */
@media (max-width: 768px) {
    .search-form {
        grid-template-columns: 1fr;
    }
    
    .radius-group {
        grid-template-columns: 1fr;
    }
    
    .date-dropdown-menu {
        width: 100%;
        position: fixed;
        left: 20px;
        right: 20px;
        max-width: calc(100% - 40px);
    }
}

/* ========== ВЕРХНЯЯ ПЛАШКА (5 КОЛОНОК) ========== */
.plasha-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    
    padding: 10px;
}

/* Базовые стили для колонок верхней плашки */
.column {
    color: #000;
  
    text-align: center;
    border-radius: 4px;
}

/* Вложенная сетка для первой и последней колонок */
.nested-grid {
    display: grid;

    gap: 8px;
    background-color: transparent;
    padding: 0;
}

.nested-item {
  
    color: #000;
  
    text-align: left;
    border-radius: 4px;
    font-size: 0.9em;
}




/* ========== НИЖНЯЯ ПЛАШКА (70% / 30%) ========== */
.bottom-plasha {
    display: grid;
    grid-template-columns: 30% 70%;
    gap: 10px;
    padding: 10px;
}
 
.bottom-column {
    display: flex;
    align-items: center;        /* Выравнивание по вертикали */
    justify-content: flex-start; /* Элементы прижаты к левому краю */
    gap: 20px;                   /* Расстояние между элементами */
    flex-wrap: wrap;             /* Если не помещаются - перенос */
    
    /* Ваши существующие стили */
    color: #000;
    
    border-radius: 4px;
   
  
}
/* Стили для дочерних элементов */
.load-company {
    display: flex;
    align-items: center;
    gap: 10px;
}

.company-name {
    #000-space: nowrap;         /* Запрет переноса текста */
}

.company-rating-container {
    display: flex;
    align-items: center;
    gap: 5px;
}

.rating-bar {
    width: 60px;                 /* Фиксированная ширина полосы рейтинга */
    height: 8px;
    background-color: rgba(255,255,255,0.3);
    border-radius: 4px;
}

.rating-fill {
    height: 100%;
    background-color: #64b92a;
    border-radius: 4px;
}
.rating-fill.negative{
	background-color:red;
}

.load_name, .load-phone {
    #000-space: nowrap;
}

.phone-link {
    color: #000;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
}

.phone-link:hover {
    text-decoration: underline;
}


/* ========== РОДИТЕЛЬСКИЙ БЛОК ========== */
.parent-block {
    border-radius: 8px;
    overflow: hidden;
    background-color: #e0e0e0; /* Серый фон по умолчанию */
	    margin-bottom: 10px;
}

.parent-block .plasha-grid {
    background-color: #e0e0e0;
}

.parent-block .bottom-plasha {
    background-color: #d0d0d0;
}

/* ========== ДОПОЛНИТЕЛЬНЫЕ СТИЛИ ========== */
h1 {
    margin: 20px 0;
    color: #333;
}

.content-example {
    background-color: rgba(255,255,255,0.2);
    padding: 10px;
    border-radius: 4px;
    width: 100%;
}

/* ========== АВТОКОМПЛИТ ========== */
.autocomplete-container {
    position: relative;
    width: 100%;
}

.autocomplete-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.2s;
}

.autocomplete-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.autocomplete-input.has-value {
    border-color: #10b981;
    background-color: #f0fdf4;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-top: 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    display: none;
}

.autocomplete-dropdown.active {
    display: block;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.2s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background-color: #f8fafc;
}

.autocomplete-item.selected {
    background-color: #eff6ff;
    border-left: 3px solid #3b82f6;
}

.autocomplete-item-name {
    font-weight: 500;
    color: #0f172a;
    margin-bottom: 2px;
}

.autocomplete-item-name strong {
    color: #3b82f6;
    font-weight: 600;
}

.autocomplete-item-region {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 2px;
}

.autocomplete-item-id {
    font-size: 11px;
    color: #94a3b8;
}

.autocomplete-empty {
    padding: 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
}

/* Индикатор загрузки */
.autocomplete-loading {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: none;
}

.autocomplete-container.loading .autocomplete-loading {
    display: block;
}

@keyframes spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* ========== СТИЛИ ДЛЯ ВЫБОРА ДАТ ========== */
.date-dropdown {
    position: relative;
    width: 100%;
}

.date-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.date-trigger:hover {
    border-color: #3b82f6;
}

.date-trigger.active {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.date-trigger-caption {
    font-size: 14px;
    color: #1e293b;
}

.date-trigger-value {
    color: #64748b;
    font-size: 13px;
}

.date-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 350px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-top: 4px;
    box-shadow: 0 12px 24px rgba(0,0,0,0.1);
    z-index: 1000;
    display: none;
}

.date-dropdown-menu.active {
    display: block;
}

.date-option-list {
    list-style: none;
    max-height: 280px;
    overflow-y: auto;
    padding: 8px 0;
}

.date-option-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f1f5f9;
}

.date-option-item:last-child {
    border-bottom: none;
}

.date-option-item:hover {
    background: #f8fafc;
}

.date-option-item.selected {
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
}

.date-option-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.date-option-title {
    font-weight: 500;
    font-size: 14px;
    color: #0f172a;
}

.date-option-subtitle {
    font-size: 12px;
    color: #64748b;
}
.dates {
    text-align: right;
    padding: 10px;
}
.cargo-value {
    font-weight: bold;
}
.route-city {
    font-weight: bold;
}
.route-date {
    font-weight: bold;
}
.podpis {
    font-weight: 100;
    font-style: italic;
}
.manual-dates {
    padding: 16px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.manual-dates-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #3b82f6;
    font-size: 14px;
    cursor: pointer;
    padding: 8px 0;
    font-weight: 500;
}

.manual-dates-title:hover {
    color: #2563eb;
}

.manual-dates-title svg {
    transition: transform 0.2s;
}

.manual-dates-inputs {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}

.manual-dates-inputs.active {
    display: grid;
}

.date-input {
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.date-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* Стили для flatpickr */
.flatpickr-calendar {
    border-radius: 12px;
    box-shadow: 0 12px 24px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
    font-family: inherit;
}

.flatpickr-day.selected {
    background: #3b82f6;
    border-color: #3b82f6;
}

.flatpickr-day.selected:hover {
    background: #2563eb;
    border-color: #2563eb;
}

/* ========== СТАТИСТИКА ========== */
.stats-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    border-radius: 16px;
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    border: 1px solid #eef2f6;
    flex-wrap: wrap;
    gap: 16px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 100px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: #e2e8f0;
    margin: 0 8px;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .stats-card {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
    }
    
    .stat-item {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        min-width: auto;
    }
    
    .stat-value {
        font-size: 20px;
        margin-bottom: 0;
    }
    
    .stat-label {
        font-size: 14px;
    }
    
    .stat-divider {
        display: none;
    }
}

/* Анимация появления */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== ТУЛТИПЫ (ПОДСКАЗКИ) ========== */
.tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: #eef2ff;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: #4f46e5;
    cursor: help;
    margin-left: 4px;
}

.tooltip-text {
    visibility: hidden;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    font-size: 11px;
    font-weight: normal;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 10;
    margin-bottom: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: opacity 0.2s, visibility 0.2s;
}

.tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #1e293b transparent transparent transparent;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Темная тема для тултипа (опционально) */
@media (prefers-color-scheme: dark) {
    .tooltip-text {
        background: #334155;
    }
    
    .tooltip-text::after {
        border-color: #334155 transparent transparent transparent;
    }
}

/* Дополнительные стили для улучшения внешнего вида */
.stats-card .stat-item:first-child .stat-value {
    color: #059669; /* Зеленый для общего количества */
}

.stats-card .stat-item:nth-child(3) .stat-value {
    color: #3b82f6; /* Синий для номера страницы */
}

/* Если города длинные, уменьшаем шрифт */
.stat-value {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .stat-value {
        max-width: 150px;
        font-size: 18px;
    }
}

.autocomplete-empty {
    padding: 12px 16px;
    color: #666;
    font-style: italic;
    text-align: center;
}

.autocomplete-item.selected {
    background-color: #e3f2fd;
}

.autocomplete-item {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.autocomplete-item:hover {
    background-color: #f8f9fa;
}

.autocomplete-item.selected {
    background-color: #e3f2fd;
}

.autocomplete-item-name strong {
    color: #1976d2;
    font-weight: 600;
}

.autocomplete-item-region {
    font-size: 0.8em;
    color: #666;
    margin-top: 2px;
}

.autocomplete-item-id {
    font-size: 0.7em;
    color: #999;
    margin-top: 2px;
}