/* ---------- Юридический раздел: улучшенный стиль в духе основного сайта ---------- */

.page-legal {
    max-width: 960px;
}

/* Hero секция */
.legal-hero {
    background: radial-gradient(ellipse 120% 100% at 50% 0%, rgba(244, 204, 95, 0.08), transparent 55%),
                radial-gradient(circle at top, rgba(13, 21, 27, 0.98), rgba(10, 16, 20, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 24px;
    padding: 36px 36px 40px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
}

.legal-hero::before {
    content: "";
    position: absolute;
    top: -40%;
    right: -20%;
    width: 60%;
    height: 80%;
    background: radial-gradient(circle, rgba(244, 204, 95, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.legal-hero-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(244, 204, 95, 0.2), rgba(244, 204, 95, 0.05));
    border: 1px solid rgba(244, 204, 95, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    margin-bottom: 20px;
}

.legal-hero h1 {
    font-size: clamp(26px, 3vw, 32px);
    margin: 0 0 14px;
    letter-spacing: -0.02em;
}

.legal-lead {
    max-width: 640px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 15px;
    line-height: 1.65;
    margin: 0;
}

/* Категории документов */
.legal-category {
    margin-bottom: 32px;
}

.legal-category-title {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 18px 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.01em;
}

.legal-category-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.legal-category-icon--general {
    background: linear-gradient(145deg, rgba(244, 204, 95, 0.25), rgba(244, 204, 95, 0.08));
    border: 1px solid rgba(244, 204, 95, 0.35);
    color: var(--accent);
}

.legal-category-icon--rating {
    background: linear-gradient(145deg, rgba(120, 160, 255, 0.2), rgba(120, 160, 255, 0.06));
    border: 1px solid rgba(120, 160, 255, 0.35);
    color: #88b4ff;
}

.legal-category-icon--finance {
    background: linear-gradient(145deg, rgba(64, 191, 112, 0.2), rgba(64, 191, 112, 0.06));
    border: 1px solid rgba(64, 191, 112, 0.35);
    color: #5dd39e;
}

.legal-category-icon--services {
    background: linear-gradient(145deg, rgba(147, 51, 234, 0.2), rgba(147, 51, 234, 0.06));
    border: 1px solid rgba(147, 51, 234, 0.35);
    color: #b87aff;
}

/* Сетка карточек документов */
.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 18px;
}

.doc-card {
    background: rgba(12, 20, 25, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    overflow: hidden;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    backdrop-filter: blur(12px);
}

.doc-card:hover {
    transform: translateY(-3px);
    border-color: rgba(244, 204, 95, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.doc-card-inner {
    padding: 22px 22px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 180px;
}

.doc-title {
    font-size: 17px;
    font-weight: 600;
    margin: 0;
    line-height: 1.35;
    color: #fff;
    letter-spacing: -0.01em;
}

.doc-desc {
    font-size: 13.5px;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.5;
    margin: 0;
    flex-grow: 1;
}

.doc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

.doc-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px 11px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    text-decoration: none;
    border: 1px solid transparent;
}

.doc-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
}

.doc-btn--view {
    background: linear-gradient(150deg, rgba(244, 204, 95, 0.2), rgba(244, 204, 95, 0.06));
    border-color: rgba(244, 204, 95, 0.35);
    color: #fff;
}

.doc-btn--view:hover {
    background: linear-gradient(150deg, rgba(244, 204, 95, 0.3), rgba(244, 204, 95, 0.12));
    border-color: rgba(244, 204, 95, 0.5);
}

.doc-btn--download {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.doc-btn--download:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    color: #fff;
}

/* Страница одного документа (например /legal/offer/) */
.doc-page {
    max-width: 900px;
}
.doc-page .doc-viewer {
    background: #0a0e12;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 20px;
    overflow: hidden;
    min-height: 70vh;
    margin: 20px 0 16px 0;
}
.doc-page .doc-viewer iframe {
    display: block;
    width: 100%;
    height: 78vh;
    border: 0;
}
.doc-page .doc-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}
.doc-page .doc-back {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 14px;
}
.doc-page .doc-back:hover { color: #fff; }

/* Модальное окно PDF */
.pdf-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.pdf-modal[hidden] {
    display: none;
}

.pdf-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
}

.pdf-modal-box {
    position: relative;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 24px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pdf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.pdf-modal-title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
}

.pdf-modal-close {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}

.pdf-modal-close:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.pdf-modal-body {
    flex: 1;
    min-height: 70vh;
    position: relative;
    background: #0a0e12;
}

.pdf-modal-body iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.pdf-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    padding: 24px 32px;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 15px;
    max-width: 360px;
}

/* Адаптив */
@media (max-width: 1024px) {
    .doc-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .legal-hero {
        padding: 26px 20px 30px;
    }

    .legal-hero-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 16px;
    }

    .doc-card-inner {
        padding: 18px 18px 16px;
    }

    .doc-actions {
        flex-direction: column;
    }

    .doc-btn {
        justify-content: center;
    }

    .pdf-modal-box {
        max-height: 85vh;
    }

    .pdf-modal-header {
        padding: 14px 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .doc-card,
    .doc-btn {
        transition: none;
    }
}
