/*
Файл: static/css/legal.css
Назначение: Стили для юридических документов (оферта, политика конфиденциальности)
TASK-10-62: Приведение сайта в соответствие требованиям ЮKassa

Особенности:
- Чёткая типографика для удобства чтения
- Нумерованные списки для пунктов документа
- Якорная навигация
- Print-friendly стили
- Адаптивная вёрстка
*/

/* =============================================
   Основные стили документа
   ============================================= */

.legal-page {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    min-height: 100vh;
    color: #1e293b;
    line-height: 1.7;
}

.legal-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px 80px;
}

.legal-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid #e2e8f0;
}

.legal-header h1 {
    font-size: 32px;
    color: #1a1a2e;
    margin: 0 0 12px 0;
    font-weight: 700;
}

.legal-meta {
    color: #64748b;
    font-size: 14px;
}

.legal-meta .update-date {
    display: inline-block;
    background: #f1f5f9;
    padding: 4px 12px;
    border-radius: 20px;
    margin-top: 8px;
}

/* =============================================
   Навигация по документу (Table of Contents)
   ============================================= */

.legal-toc {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 40px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.legal-toc h2 {
    font-size: 18px;
    color: #1a1a2e;
    margin: 0 0 16px 0;
    font-weight: 600;
}

.legal-toc ol {
    margin: 0;
    padding-left: 20px;
    counter-reset: toc-counter;
}

.legal-toc li {
    margin-bottom: 8px;
    padding-left: 8px;
}

.legal-toc a {
    color: #3b82f6;
    text-decoration: none;
    font-size: 15px;
    transition: color 0.2s ease;
}

.legal-toc a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* =============================================
   Секции документа
   ============================================= */

.legal-content {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.legal-section {
    margin-bottom: 40px;
    scroll-margin-top: 20px; /* Для якорной навигации */
}

.legal-section:last-child {
    margin-bottom: 0;
}

.legal-section h2 {
    font-size: 22px;
    color: #1a1a2e;
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
}

.legal-section h3 {
    font-size: 18px;
    color: #334155;
    margin: 24px 0 12px 0;
    font-weight: 600;
}

.legal-section p {
    margin: 0 0 16px 0;
    text-align: justify;
}

/* =============================================
   Нумерованные списки пунктов
   ============================================= */

.legal-section ol {
    margin: 16px 0;
    padding-left: 0;
    counter-reset: item;
    list-style-type: none;
}

.legal-section ol > li {
    margin-bottom: 12px;
    padding-left: 36px;
    position: relative;
    text-align: justify;
}

.legal-section ol > li::before {
    content: counter(item) ".";
    counter-increment: item;
    position: absolute;
    left: 0;
    font-weight: 600;
    color: #3b82f6;
    min-width: 28px;
}

/* Вложенные списки */
.legal-section ol ol {
    margin: 12px 0 12px 20px;
    counter-reset: subitem;
}

.legal-section ol ol > li::before {
    content: counter(item) "." counter(subitem) ".";
    counter-increment: subitem;
    font-weight: 500;
    color: #64748b;
}

/* Ненумерованные списки */
.legal-section ul {
    margin: 16px 0;
    padding-left: 24px;
}

.legal-section ul li {
    margin-bottom: 8px;
    position: relative;
}

.legal-section ul li::marker {
    color: #3b82f6;
}

/* =============================================
   Определения терминов
   ============================================= */

.legal-definitions {
    background: #f8fafc;
    border-radius: 8px;
    padding: 20px 24px;
    margin: 20px 0;
}

.legal-definitions dt {
    font-weight: 600;
    color: #1a1a2e;
    margin-top: 16px;
}

.legal-definitions dt:first-child {
    margin-top: 0;
}

.legal-definitions dd {
    margin: 4px 0 0 0;
    color: #475569;
}

/* =============================================
   Реквизиты
   ============================================= */

.legal-requisites {
    background: #f8fafc;
    border-radius: 8px;
    padding: 24px;
    margin-top: 32px;
}

.legal-requisites h3 {
    margin: 0 0 16px 0;
    color: #1a1a2e;
    font-size: 18px;
}

.requisites-list {
    display: grid;
    gap: 12px;
}

.requisites-list .requisite-item {
    display: flex;
    gap: 12px;
}

.requisites-list .requisite-label {
    font-weight: 500;
    color: #64748b;
    min-width: 180px;
}

.requisites-list .requisite-value {
    color: #1e293b;
}

/* =============================================
   Кнопка печати
   ============================================= */

.print-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 14px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 100;
}

.print-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.print-button svg {
    width: 18px;
    height: 18px;
}

/* =============================================
   Адаптивная вёрстка
   ============================================= */

@media (max-width: 768px) {
    .legal-container {
        padding: 20px 16px 100px;
    }

    .legal-header h1 {
        font-size: 24px;
    }

    .legal-content {
        padding: 24px 20px;
    }

    .legal-section h2 {
        font-size: 20px;
    }

    .legal-toc {
        padding: 20px;
    }

    .requisites-list .requisite-item {
        flex-direction: column;
        gap: 4px;
    }

    .requisites-list .requisite-label {
        min-width: auto;
    }

    .print-button {
        bottom: 16px;
        right: 16px;
        padding: 12px 20px;
    }
}

@media (max-width: 480px) {
    .legal-header h1 {
        font-size: 22px;
    }

    .legal-content {
        padding: 20px 16px;
    }

    .legal-section ol > li {
        padding-left: 28px;
    }
}

/* =============================================
   Print-friendly стили
   ============================================= */

@media print {
    .legal-page {
        background: white;
    }

    .legal-container {
        max-width: 100%;
        padding: 0;
    }

    .legal-header {
        page-break-after: avoid;
    }

    .legal-toc {
        page-break-after: always;
        background: none;
        border: 1px solid #ccc;
        box-shadow: none;
    }

    .legal-content {
        background: none;
        border: none;
        padding: 0;
        box-shadow: none;
    }

    .legal-section {
        page-break-inside: avoid;
    }

    .legal-section h2 {
        page-break-after: avoid;
    }

    .print-button {
        display: none !important;
    }

    .site-footer {
        display: none !important;
    }

    .site-header {
        display: none !important;
    }

    a {
        color: #000 !important;
        text-decoration: none !important;
    }

    a[href]::after {
        content: none !important;
    }
}

/* =============================================
   Навигация на странице
   ============================================= */

.legal-nav {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 50;
    margin-bottom: 20px;
}

.legal-nav-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.legal-nav-logo {
    font-weight: 700;
    font-size: 18px;
    color: #1a1a2e;
    text-decoration: none;
}

.legal-nav-logo:hover {
    color: #3b82f6;
}

.legal-nav-links {
    display: flex;
    gap: 24px;
}

.legal-nav-links a {
    color: #64748b;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

.legal-nav-links a:hover {
    color: #3b82f6;
}

@media (max-width: 640px) {
    .legal-nav-inner {
        flex-direction: column;
        gap: 12px;
    }

    .legal-nav-links {
        gap: 16px;
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media print {
    .legal-nav {
        display: none !important;
    }
}
