/* ============================================
   ДОСТУП — Legal Pages Styles
   Shared CSS for Privacy, Terms, Refund pages
   ============================================ */

/* --- Reading Progress Bar --- */
.reading-progress {
    position: fixed;
    top: 70px;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #2196F3, #42A5F5, #1976D2);
    z-index: 999;
    transition: width 0.1s ease;
}

/* --- Legal Page Layout --- */
.legal-page {
    padding: 100px 0 60px;
    background: #fafbfc;
    min-height: 100vh;
}

.legal-container {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 24px;
}

/* --- Document Header --- */
.legal-hero {
    background: linear-gradient(135deg, #1565C0 0%, #1976D2 30%, #2196F3 70%, #42A5F5 100%);
    border-radius: 20px;
    padding: 48px 40px 40px;
    margin-bottom: 40px;
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(33, 150, 243, 0.25);
}

.legal-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.legal-hero::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
    border-radius: 50%;
}

.legal-hero-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.legal-hero h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.3;
    position: relative;
    z-index: 1;
}

.legal-hero-meta {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    font-size: 14px;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.legal-hero-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* --- Table of Contents --- */
.legal-toc {
    background: white;
    border-radius: 16px;
    padding: 28px 32px;
    margin-bottom: 32px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border: 1px solid #e8edf2;
}

.legal-toc-title {
    font-size: 15px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.legal-toc-title::after {
    content: '▾';
    font-size: 12px;
    transition: transform 0.3s;
}

.legal-toc.collapsed .legal-toc-title::after {
    transform: rotate(-90deg);
}

.legal-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 24px;
}

.legal-toc.collapsed .legal-toc-list {
    display: none;
}

.legal-toc-list a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: #475569;
    font-size: 14px;
    line-height: 1.4;
    transition: all 0.2s;
}

.legal-toc-list a:hover {
    background: #f0f7ff;
    color: #1976D2;
}

.legal-toc-list .toc-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: #e3f2fd;
    color: #1976D2;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

/* --- Content Sections --- */
.legal-section {
    background: white;
    border-radius: 16px;
    padding: 32px 36px;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    border: 1px solid #e8edf2;
    transition: box-shadow 0.3s;
}

.legal-section:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.legal-section:target {
    box-shadow: 0 4px 20px rgba(33, 150, 243, 0.15);
    border-color: #90caf9;
}

.legal-section h2 {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid #e3f2fd;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    font-size: 18px;
    flex-shrink: 0;
}

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

.legal-section p {
    margin-bottom: 14px;
    color: #475569;
    line-height: 1.75;
    font-size: 15px;
}

.legal-section ul,
.legal-section ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.legal-section li {
    margin-bottom: 8px;
    color: #475569;
    line-height: 1.65;
    font-size: 15px;
}

.legal-section li::marker {
    color: #90caf9;
}

.legal-section a {
    color: #1976D2;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.legal-section a:hover {
    border-bottom-color: #1976D2;
}

/* --- Info Boxes --- */
.info-box {
    border-radius: 14px;
    padding: 24px 28px;
    margin: 20px 0;
    position: relative;
    overflow: hidden;
}

.info-box::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.info-box-primary {
    background: linear-gradient(135deg, #e3f2fd 0%, #f0f7ff 100%);
    border: 1px solid #bbdefb;
}
.info-box-primary::before { background: #2196F3; }

.info-box-warning {
    background: linear-gradient(135deg, #fff8e1 0%, #fffde7 100%);
    border: 1px solid #ffe082;
}
.info-box-warning::before { background: #ffc107; }

.info-box-success {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
    border: 1px solid #a5d6a7;
}
.info-box-success::before { background: #4caf50; }

.info-box-danger {
    background: linear-gradient(135deg, #fce4ec 0%, #fff5f7 100%);
    border: 1px solid #ef9a9a;
}
.info-box-danger::before { background: #ef5350; }

.info-box-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-box p {
    margin-bottom: 8px !important;
    font-size: 14px !important;
    color: #475569 !important;
}

.info-box p:last-child {
    margin-bottom: 0 !important;
}

/* --- Operator Card --- */
.operator-card {
    background: white;
    border-radius: 16px;
    padding: 28px 32px;
    margin: 24px 0;
    border: 1px solid #e3f2fd;
    box-shadow: 0 4px 16px rgba(33, 150, 243, 0.08);
    position: relative;
    overflow: hidden;
}

.operator-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #1565C0, #2196F3, #42A5F5);
}

.operator-card h3 {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 16px;
}

.operator-card p {
    margin-bottom: 6px;
    color: #475569;
    font-size: 14px;
    line-height: 1.6;
}

.operator-card .label {
    color: #64748b;
    font-size: 13px;
}

.operator-card .value {
    font-weight: 600;
    color: #1e293b;
}

/* --- Tables --- */
.legal-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 20px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
}

.legal-table thead th {
    background: linear-gradient(135deg, #1565C0, #1976D2);
    color: white;
    padding: 14px 18px;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    letter-spacing: 0.3px;
}

.legal-table tbody td {
    padding: 13px 18px;
    font-size: 14px;
    color: #475569;
    border-bottom: 1px solid #f1f5f9;
    line-height: 1.5;
}

.legal-table tbody tr:last-child td {
    border-bottom: none;
}

.legal-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.legal-table tbody tr:hover {
    background: #f0f7ff;
}

/* --- Formula Box --- */
.formula-box {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 24px 28px;
    margin: 20px 0;
    text-align: center;
}

.formula-box .formula {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    background: white;
    padding: 12px 20px;
    border-radius: 8px;
    display: inline-block;
    margin: 10px 0;
    border: 1px solid #e2e8f0;
}

.formula-box .example {
    font-size: 14px;
    color: #64748b;
    margin-top: 12px;
}

.formula-box .result {
    font-weight: 700;
    color: #1976D2;
}

/* --- Confirmation Box (bottom of page) --- */
.confirm-box {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border-radius: 16px;
    padding: 32px;
    margin: 32px 0 0;
    text-align: center;
    border: 1px solid #90caf9;
}

.confirm-box h3 {
    font-size: 17px;
    font-weight: 700;
    color: #1565C0;
    margin-bottom: 16px;
}

.confirm-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: inline-block;
    text-align: left;
}

.confirm-list li {
    padding: 6px 0;
    font-size: 15px;
    color: #1e40af;
    display: flex;
    align-items: center;
    gap: 10px;
}

.confirm-list li::before {
    content: '✓';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    color: #1976D2;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(25, 118, 210, 0.15);
}

/* --- Contact Section --- */
.contact-card {
    background: white;
    border-radius: 16px;
    padding: 32px;
    margin: 24px 0;
    border: 1px solid #e3f2fd;
    box-shadow: 0 4px 20px rgba(33, 150, 243, 0.1);
}

.contact-card h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e8edf2;
    transition: all 0.2s;
}

.contact-item:hover {
    background: #f0f7ff;
    border-color: #90caf9;
}

.contact-item-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.contact-item-label {
    font-size: 12px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.contact-item-value {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.contact-item-value a {
    color: #1976D2;
    text-decoration: none;
}

/* --- Back to Top --- */
.back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #1976D2, #2196F3);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(33, 150, 243, 0.35);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 100;
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 24px rgba(33, 150, 243, 0.45);
}

/* --- Footer overrides --- */
.legal-page ~ footer,
.legal-page + footer {
    margin-top: 0;
}

/* --- Navigation Pills --- */
.legal-nav-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 24px 0;
}

.legal-nav-pill {
    padding: 8px 16px;
    border-radius: 20px;
    background: white;
    border: 1px solid #e2e8f0;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    text-decoration: none;
    transition: all 0.2s;
}

.legal-nav-pill:hover,
.legal-nav-pill.active {
    background: #e3f2fd;
    border-color: #90caf9;
    color: #1976D2;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .legal-hero {
        padding: 32px 24px 28px;
        border-radius: 16px;
        margin-bottom: 24px;
    }

    .legal-hero h1 {
        font-size: 22px;
    }

    .legal-hero-meta {
        flex-direction: column;
        gap: 8px;
    }

    .legal-container {
        padding: 0 16px;
    }

    .legal-toc-list {
        grid-template-columns: 1fr;
    }

    .legal-section {
        padding: 24px 20px;
        border-radius: 14px;
        margin-bottom: 14px;
    }

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

    .info-box {
        padding: 18px 20px;
    }

    .operator-card {
        padding: 22px 20px;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }

    .legal-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .formula-box .formula {
        font-size: 13px;
        padding: 10px 14px;
    }

    .confirm-box {
        padding: 24px 20px;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }
}

@media (max-width: 480px) {
    .legal-hero {
        padding: 24px 18px 22px;
    }

    .legal-hero h1 {
        font-size: 19px;
    }

    .legal-hero-icon {
        font-size: 36px;
    }

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

    .legal-section h2 {
        font-size: 16px;
        gap: 8px;
    }

    .section-icon {
        width: 30px;
        height: 30px;
        border-radius: 8px;
        font-size: 15px;
    }
}

/* --- Print Styles --- */
@media print {
    .reading-progress,
    .back-to-top,
    header,
    footer,
    .legal-toc {
        display: none !important;
    }

    .legal-page {
        padding: 0;
        background: white;
    }

    .legal-hero {
        background: #f0f0f0 !important;
        color: #333 !important;
        box-shadow: none;
        border: 1px solid #ccc;
        -webkit-print-color-adjust: exact;
    }

    .legal-section {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }

    .info-box,
    .operator-card,
    .contact-card,
    .confirm-box {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
