/* public/css/header.css */
/* Стили новой шапки Rate Insight */

/* ==========================
   HEADER – LEVEL 1 (Top Nav)
   ========================== */
.header-level-1 {
    background: linear-gradient(135deg, #111827, #1f2937);
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 28px;
    border-bottom: 1px solid #2d3748;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.logo {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #ffffff;
    margin-right: 48px;
    text-decoration: none;
}

.logo:hover {
    color: #ffffff;
}

.nav-link {
    margin-right: 20px;
    padding: 9px 14px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    color: #e5e7eb;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.nav-link:hover {
    background: rgba(37, 99, 235, 0.18);
    color: #f1f5f9;
    text-decoration: none;
}

.nav-link.active {
    background: #2563eb;
    color: #ffffff;
}

/* ==========================
   HEADER – LEVEL 2 (Section)
   ========================== */
.header-level-2 {
    background: #ffffff;
    height: 50px;
    display: flex;
    align-items: center;
    padding: 0 28px;
    border-bottom: 1px solid #d1d5db;
    position: fixed;
    top: 64px; /* под Level 1 */
    left: 0;
    right: 0;
    z-index: 999;
}

.section-title {
    margin-right: 28px;
    font-size: 16px;
    font-weight: 600;
    color: #1a1f2b;
    white-space: nowrap;
}

.tool-link {
    margin-right: 16px;
    padding: 6px 12px;
    border-radius: 6px;
    color: #475569;
    font-size: 15px;
    font-weight: 400;
    text-decoration: none;
    transition: all 0.2s ease;
}

.tool-link:hover {
    background: #eef1f5;
    color: #2563eb;
    text-decoration: none;
}

.tool-link.active {
    background: #e8f0ff;
    color: #2563eb;
    font-weight: 600;
}

/* ==========================
   HEADER – LEVEL 3 (Filters)
   ========================== */
.header-level-3 {
    background: #f7f7f8;
    height: 42px;
    display: flex;
    align-items: center;
    padding: 0 28px;
    border-bottom: 1px solid #d1d5db;
    position: fixed;
    top: 114px; /* под Level 1 + Level 2 */
    left: 0;
    right: 0;
    z-index: 998;
}

.header-level-3 .section-title {
    font-size: 15px;
    margin-right: 18px;
    color: #374151;
}

.filter-link {
    margin-right: 12px;
    padding: 5px 10px;
    border-radius: 6px;
    background: white;
    border: 1px solid #d1d5db;
    color: #374151;
    font-size: 14px;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
}

.filter-link:hover {
    border-color: #2563eb;
    color: #2563eb;
    text-decoration: none;
}

.filter-link.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.action-btn {
    margin-left: auto;
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.action-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
    text-decoration: none;
}

.action-btn.primary {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.action-btn.primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #ffffff;
}

/* ==========================
   MAIN CONTENT OFFSET
   ========================== */
/* Создаем отступ для основного контента под фиксированной шапкой */
main {
    margin-top: 156px; /* 64px + 50px + 42px */
    min-height: calc(100vh - 156px);
    background: #f7f7f8;
}

/* ==========================
   RESPONSIVE DESIGN
   ========================== */
@media (max-width: 768px) {
    .header-level-1 {
        height: 56px;
        padding: 0 16px;
    }
    
    .header-level-2 {
        top: 56px;
        height: 45px;
        padding: 0 16px;
    }
    
    .header-level-3 {
        top: 101px;
        height: 40px;
        padding: 0 16px;
    }
    
    .logo {
        font-size: 22px;
        margin-right: 24px;
    }
    
    .nav-link {
        margin-right: 12px;
        padding: 6px 10px;
        font-size: 14px;
    }
    
    .section-title {
        margin-right: 16px;
        font-size: 14px;
    }
    
    .tool-link {
        margin-right: 12px;
        padding: 4px 8px;
        font-size: 14px;
    }
    
    .filter-link {
        margin-right: 8px;
        padding: 4px 8px;
        font-size: 13px;
    }
    
    main {
        margin-top: 141px; /* 56px + 45px + 40px */
        min-height: calc(100vh - 141px);
    }
}

@media (max-width: 480px) {
    .header-level-1 {
        flex-wrap: wrap;
        height: auto;
        min-height: 56px;
        padding: 8px 16px;
    }
    
    .header-level-2 {
        top: auto;
        position: relative;
        height: auto;
        min-height: 45px;
        padding: 8px 16px;
        flex-wrap: wrap;
    }
    
    .header-level-3 {
        top: auto;
        position: relative;
        height: auto;
        min-height: 40px;
        padding: 8px 16px;
        flex-wrap: wrap;
    }
    
    .logo {
        margin-right: auto;
        margin-bottom: 8px;
    }
    
    main {
        margin-top: 0;
        min-height: 100vh;
    }
}

/* ==========================
   UTILITY CLASSES
   ========================== */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

/* Анимации для плавного появления/скрытия */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Стили для контейнера расширенных фильтров */
.advanced-filters-container {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Индикатор загрузки для быстрых фильтров */
.filter-loading {
    position: relative;
    pointer-events: none;
}

.filter-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Стили для активных фильтров */
.filter-link.active {
    background: #007bff !important;
    color: white !important;
    border-color: #007bff !important;
}

.action-btn.active {
    background: #495057 !important;
}

/* Анимация для расширенных фильтров */
.advanced-filters-container {
    transition: all 0.3s ease;
}

.advanced-filters-container[style*="display: block"] {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Стили для всплывающих подсказок */

/* СТИЛИ ДЛЯ ТУЛТИПОВ - МЕНЬШИЙ ШРИФТ, БОЛЬШАЯ ПОДЛОЖКА */
.filter-link {
    position: relative;
    cursor: pointer;
}

.filter-link:hover::after {
    content: attr(title);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #2d3748;
    color: white;
    padding: 18px 22px; /* ← БОЛЬШАЯ ПОДЛОЖКА */
    border-radius: 8px;
    font-size: 12px; /* ← МЕНЬШИЙ ШРИФТ */
    white-space: pre-line;
    z-index: 1001;
    margin-top: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    pointer-events: none;
    font-weight: 500;
    min-width: 180px;
    max-width: 260px;
    text-align: center;
    line-height: 1.4;
}

.filter-link:hover::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: #2d3748;
    margin-top: -2px;
    z-index: 1002;
    pointer-events: none;
}

/* Для кнопки расширенных фильтров */
.action-btn {
    position: relative;
}

.action-btn:hover::after {
    content: attr(title);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #2d3748;
    color: white;
    padding: 16px 20px;
    border-radius: 8px;
    font-size: 12px; /* ← ТАКОЙ ЖЕ МАЛЕНЬКИЙ ШРИФТ */
    white-space: normal;
    z-index: 1001;
    margin-top: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    pointer-events: none;
    font-weight: 500;
    min-width: 180px;
    max-width: 240px;
    text-align: center;
    line-height: 1.4;
}

.action-btn:hover::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: #2d3748;
    margin-top: -2px;
    z-index: 1002;
    pointer-events: none;
}