/* style.css - ПОЛНАЯ ИТОГОВАЯ ВЕРСИЯ */

/* ===== БАЗОВЫЕ НАСТРОЙКИ ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f4f6f9;
    min-height: 100vh;
    color: #1e293b;
    padding-bottom: 40px;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ===== МЕНЮ ===== */
.menu-wrapper {
    background: #ffffff;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 0 24px;
    max-width: 1200px;
    margin: 0 auto 30px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.menu {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 70px;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    color: #0b2a4a;
    letter-spacing: -0.5px;
}
.logo span { color: #7c3aed; }

.nav-list {
    display: flex;
    gap: 5px;
    align-items: center;
}

.nav-list > li { 
    position: relative; 
}

.nav-list > li > a {
    display: block;
    padding: 10px 16px;
    color: #1e293b;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-list > li > a:hover, .nav-list > li > a.active {
    background: #f1f5f9;
    color: #7c3aed;
}

/* Выпадающее меню */
.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 240px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    padding: 16px 0 8px 0;
    z-index: 1001;
    border: 1px solid #e2e8f0;
}

.dropdown-content::before {
    display: none;
}

@media (min-width: 769px) {
    .dropdown:hover .dropdown-content { 
        display: block; 
    }
}

.dropdown-content > a {
    padding: 10px 20px;
    font-size: 14px;
    display: block;
    color: #1e293b;
    transition: all 0.2s ease;
}

.dropdown-content > a:hover {
    background: #f8fafc;
    color: #7c3aed;
}

/* ===== НОВЫЕ СТИЛИ ДЛЯ ВЛОЖЕННОГО СПИСКА (Мои АИ сервисы) ===== */
.dropdown-content .dropdown-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dropdown-content .dropdown-list li {
    width: 100%;
}

.dropdown-content .dropdown-list a {
    display: block;
    padding: 10px 20px;
    font-size: 14px;
    color: #1e293b;
    text-decoration: none;
    transition: all 0.2s ease;
}

.dropdown-content .dropdown-list a:hover {
    background: #f8fafc;
    color: #7c3aed;
    padding-left: 24px; /* Небольшой сдвиг вправо для красоты на ПК */
}

/* Активный пункт меню (Законодательство РФ) */
.dropdown-content .dropdown-list a.active {
    background-color: #f0fdf4;
    color: #16a34a;
    font-weight: 600;
    border-left: 3px solid #16a34a;
}

/* Ссылка с бейджем NEW */
.dropdown-content .dropdown-list a.has-badge {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Компенсация сдвига для flex-элементов при наведении */
.dropdown-content .dropdown-list a.has-badge:hover {
    padding-left: 20px; 
}

/* Сам бейдж NEW */
.badge-new {
    display: inline-block;
    background-color: #16a34a;
    color: #ffffff;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

/* Гамбургер (скрыт на ПК) */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #0b2a4a;
}

/* ===== КОНТЕНТ ПРИЛОЖЕНИЯ ===== */
.app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

.selector-section {
    background: #ffffff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    text-align: center;
}

.selector-section h2 { color: #7c3aed; margin-bottom: 10px; }
.selector-section p { color: #64748b; margin-bottom: 25px; }

.code-buttons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.code-btn {
    padding: 15px 10px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s;
    color: #1e293b;
}

.code-btn:hover, .code-btn.active-all {
    border-color: #7c3aed;
    color: #7c3aed;
    background: #f5f3ff;
    transform: translateY(-2px);
}

/* Чат */
.chat-section {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 75vh;
    margin-top: 20px;
}

.hidden { display: none !important; }

.chat-header {
    background: #7c3aed;
    color: #ffffff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.small-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}
.small-btn:hover { background: rgba(255,255,255,0.3); }

.chat-history {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    padding: 12px 18px;
    border-radius: 12px;
    max-width: 85%;
    line-height: 1.6;
}

.bot-message {
    background: #ffffff;
    border-left: 4px solid #7c3aed;
    align-self: flex-start;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.user-message {
    background: #7c3aed;
    color: #ffffff;
    align-self: flex-end;
}

.chat-input-area {
    padding: 15px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 10px;
    background: #ffffff;
}

textarea {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    resize: none;
    font-family: inherit;
    min-height: 50px;
    transition: border-color 0.2s;
}

textarea:focus { outline: none; border-color: #7c3aed; }

.send-btn {
    background: #7c3aed;
    color: white;
    border: none;
    padding: 0 25px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.send-btn:hover { background: #6d28d9; }
.send-btn:disabled { background: #a78bfa; cursor: not-allowed; }

.usage-info {
    text-align: center;
    padding: 8px;
    font-size: 0.8rem;
    color: #64748b;
    background: #f8fafc;
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: #ffffff;
    padding: 30px;
    border-radius: 12px;
    max-width: 560px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.close-modal {
    position: absolute;
    top: 15px; right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
    transition: color 0.2s;
}
.close-modal:hover { color: #1e293b; }

.key-input-group { margin-top: 20px; }
.key-input-group input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 14px;
}
.key-input-group input:focus { outline: none; border-color: #7c3aed; }

.primary-btn {
    background: #7c3aed;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    width: 100%;
    font-weight: 600;
    font-size: 15px;
    transition: background 0.2s;
}
.primary-btn:hover { background: #6d28d9; }

/* ===== АДАПТИВНОСТЬ (МОБИЛЬНЫЕ УСТРОЙСТВА) ===== */
@media (max-width: 768px) {
    .mobile-menu-toggle { 
        display: block; 
    }

    .nav-list {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        background: #ffffff;
        flex-direction: column;
        box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        padding: 10px 0;
        gap: 0;
        z-index: 100;
    }

    .nav-list.mobile-open {
        display: flex;
    }

    .nav-list > li {
        width: 100%;
    }

    .nav-list > li > a {
        display: block;
        padding: 15px 20px;
        border-bottom: 1px solid #f0f0f0;
        border-radius: 0;
    }

    .nav-list > li > a:hover {
        background: #f8f9fa;
    }

    /* Адаптация выпадающего меню на мобильных */
    .dropdown-content {
        position: static;
        box-shadow: none;
        padding: 0;
        background: #f8f9fa;
        border: none;
        margin-top: 0;
        min-width: 100%;
    }

    .dropdown-content > a {
        padding: 15px 20px;
        border-bottom: 1px solid #e2e8f0;
    }

    .dropdown-content .dropdown-list a {
        padding: 15px 20px 15px 40px; /* Больший отступ слева для вложенности */
        border-bottom: 1px solid #e2e8f0;
    }

    .dropdown-content .dropdown-list a:hover {
        padding-left: 40px; /* Убираем сдвиг при наведении на мобильных */
        background: #eef2ff;
    }

    .dropdown-content .dropdown-list a.active {
        border-left: none;
        border-bottom: 3px solid #16a34a;
        background: #dcfce7;
    }

    /* Адаптация кнопок выбора кодекса */
    .code-buttons-grid {
        grid-template-columns: 1fr;
    }

    .code-btn {
        padding: 14px;
        font-size: 14px;
    }

    /* Адаптация чата */
    .chat-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .chat-input-area {
        flex-direction: column;
    }

    .send-btn {
        width: 100%;
        padding: 12px;
    }

    .message {
        max-width: 95%;
    }
}