/**
 * BigBen CRM — Regulation / Регламент Styles
 * Document format: single block, standard HTML, copy-paste friendly
 */

/* ============================================
   Toolbar (above document, not copied)
   ============================================ */

.regulation-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin: 1.5rem auto;
    max-width: 800px;
    flex-wrap: wrap;
}

.regulation-toolbar__info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.regulation-toolbar__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    background: rgba(124, 58, 237, 0.08);
    color: #7c3aed;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
}

.regulation-toolbar__hint {
    font-size: 0.8125rem;
    color: #64748b;
}

.regulation-toolbar__actions {
    display: flex;
    gap: 0.5rem;
}

/* ============================================
   Two-column Layout (sidebar + document)
   ============================================ */

.regulation-layout--with-sidebar {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 1.5rem;
    max-width: 1120px;
    margin: 0 auto;
    align-items: start;
}

.regulation-sidebar {
    position: sticky;
    top: 5rem;
}

.regulation-sidebar__inner {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1.25rem;
    /* Sidebar fits viewport — long field lists scroll inside, actions stay pinned */
    max-height: calc(100vh - 6rem);
    display: flex;
    flex-direction: column;
}

.regulation-sidebar__hint {
    font-size: 0.8125rem;
    color: #64748b;
    margin: 0.75rem 0 1rem;
    line-height: 1.4;
    flex-shrink: 0;
}

.regulation-sidebar__fields {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    /* Take remaining space and scroll internally if fields overflow */
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    /* Fade-out hint at bottom — visual cue that more fields exist */
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 16px), transparent);
            mask-image: linear-gradient(to bottom, #000 calc(100% - 16px), transparent);
    padding-right: 0.25rem;
    margin-right: -0.25rem;
}

.regulation-sidebar__fields:hover {
    -webkit-mask-image: none;
            mask-image: none;
}

/* Slim scrollbar so it doesn't shift content */
.regulation-sidebar__fields::-webkit-scrollbar {
    width: 6px;
}
.regulation-sidebar__fields::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
.regulation-sidebar__fields::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.regulation-sidebar__label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.1875rem;
}

.regulation-sidebar__input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.875rem;
    background: white;
    color: #1a1a2e;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.regulation-sidebar__input:focus {
    outline: none;
    border-color: #94a3b8;
    box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.15);
}

.regulation-sidebar__input::placeholder {
    color: #cbd5e1;
}

.regulation-sidebar__actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e2e8f0;
    /* Always visible — never scrolled away even when fields list is long */
    flex-shrink: 0;
}

.btn--full {
    width: 100%;
    justify-content: center;
}

/* ============================================
   Document — looks like A4 paper
   ============================================ */

.regulation-layout--with-sidebar .regulation-document {
    max-width: 100%;
    min-width: 0;
    width: 100%;
}

.regulation-document {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    padding: 3rem 3.5rem;
    font-family: 'PT Serif', Georgia, 'Times New Roman', serif;
    overflow: hidden;
    font-size: 1rem;
    line-height: 1.7;
    color: #1a1a2e;
}

.regulation-document h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 1.5rem 0 0.5rem;
    line-height: 1.3;
}

.regulation-document h2 {
    font-size: 1.1875rem;
    font-weight: 700;
    margin: 2rem 0 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.regulation-document h2:first-of-type {
    border-top: none;
    padding-top: 0;
}

.regulation-document h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 1.5rem 0 0.5rem;
}

.regulation-document p {
    margin: 0 0 0.75rem;
}

.regulation-document ol,
.regulation-document ul {
    padding-left: 1.5rem;
    margin: 0 0 1rem;
}

.regulation-document li {
    margin-bottom: 0.375rem;
}

.regulation-document hr {
    border: none;
    border-top: 2px solid #1a1a2e;
    margin: 2rem 0;
}

.regulation-document strong {
    font-weight: 700;
}

/* Tables in document — scrollable wrapper */
.regulation-document .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.regulation-document .table-scroll table {
    min-width: 500px;
}

.regulation-document table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9375rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.regulation-document thead th {
    text-align: left;
    font-weight: 700;
    padding: 0.625rem 0.75rem;
    border-bottom: 2px solid #1a1a2e;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.regulation-document tbody td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}


/* ============================================
   Document Hub — Category Headers & Cards
   ============================================ */

.doc-category-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 2rem 0 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.doc-category-header h2 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
}

.doc-category-header__count {
    font-size: 0.8125rem;
    color: #9ca3af;
    margin-left: auto;
}

.doc-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.doc-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: white;
    border: 1px solid #f0f1f3;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.doc-card:hover {
    border-color: #c7d2fe;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
}

.doc-card__icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}

.doc-card__body {
    flex: 1;
    min-width: 0;
}

.doc-card__title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0;
    line-height: 1.35;
}

.doc-card__excerpt {
    font-size: 0.8125rem;
    color: #6b7280;
    margin: 0.25rem 0 0;
    line-height: 1.4;
}

.doc-card__arrow {
    flex-shrink: 0;
    color: #d1d5db;
    transition: color 0.2s;
}

.doc-card:hover .doc-card__arrow {
    color: #6366f1;
}

.doc-coming-soon {
    text-align: center;
    padding: 2rem;
    background: #f8fafc;
    border-radius: 12px;
    margin-top: 2rem;
}

.doc-coming-soon h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 0.5rem;
}

.doc-coming-soon p {
    font-size: 0.9375rem;
    color: #6b7280;
    margin: 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================
   CTA (below document, not copied)
   ============================================ */

.regulation-cta {
    max-width: 800px;
    margin: 2rem auto 0;
    text-align: center;
    padding: 2.5rem 1.5rem;
    background: linear-gradient(135deg, #f5f3ff, #eff6ff);
    border-radius: 16px;
}

.regulation-cta h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 0.75rem;
}

.regulation-cta p {
    font-size: 1rem;
    color: #4b5563;
    margin: 0 0 1.5rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.regulation-cta__links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    margin-top: 1.5rem;
}

.regulation-cta__links a {
    font-size: 0.875rem;
    color: #7c3aed;
    text-decoration: underline;
    text-decoration-color: rgba(124, 58, 237, 0.3);
}

/* ============================================
   Print
   ============================================ */

@media print {
    .no-print,
    header,
    footer,
    nav,
    .breadcrumbs,
    .regulation-toolbar,
    .regulation-sidebar,
    .regulation-cta {
        display: none !important;
    }

    /* Browser handles page margins via @page — kill site-level constraints */
    html, body {
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        font-size: 11pt;
    }

    .section,
    .section.nav-offset {
        padding: 0 !important;
        margin: 0 !important;
    }

    .container {
        max-width: none !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Flatten the 2-col grid so document doesn't get stuck in the 280px sidebar slot */
    .regulation-layout,
    .regulation-layout--with-sidebar {
        display: block !important;
        max-width: none !important;
        margin: 0 !important;
        gap: 0 !important;
    }

    .regulation-document {
        border: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        max-width: none !important;
        width: 100% !important;
    }

    @page {
        margin: 1.5cm 1.8cm;
    }
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 700px) {
    /* Breadcrumbs spacing on mobile */
    .section--breadcrumbs {
        padding-top: 6.5rem;
        padding-bottom: 0;
    }
    /* Compact breadcrumbs on mobile */
    .breadcrumbs__list {
        font-size: 0.75rem;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        display: block;
    }
    .breadcrumbs__item {
        display: inline;
        font-size: 0.75rem;
    }
    .breadcrumbs__sep {
        margin: 0 0.25rem;
    }
    .breadcrumbs__item--current {
        display: inline;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .regulation-document {
        padding: 1.5rem 1.25rem;
        border: none;
        box-shadow: 0 1px 8px rgba(0,0,0,0.06);
    }

    .regulation-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 1rem;
    }

    .regulation-toolbar__info {
        flex-direction: column;
        gap: 0.5rem;
    }

    .regulation-toolbar__actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .regulation-toolbar__actions .btn:first-child {
        grid-column: 1 / -1;
    }

    .regulation-toolbar__actions .btn {
        justify-content: center;
        font-size: 0.8125rem;
        padding: 0.625rem 0.75rem;
    }

    .regulation-layout--with-sidebar {
        grid-template-columns: minmax(0, 1fr);
    }

    .regulation-sidebar {
        position: static;
    }

    .regulation-sidebar__inner {
        max-height: none;
        display: block;
    }

    .regulation-sidebar__fields {
        overflow-y: visible;
        -webkit-mask-image: none;
                mask-image: none;
        padding-right: 0;
        margin-right: 0;
    }

    .regulation-sidebar__actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .regulation-sidebar__actions .btn--full {
        flex: 1;
        min-width: 0;
    }

    .regulation-sidebar__actions .btn--full:first-child {
        flex: 1 1 100%;
    }

    .regulation-document h1 {
        font-size: 1.25rem;
    }

    .regulation-document h2 {
        font-size: 1.0625rem;
    }

    .regulation-document table {
        font-size: 0.8125rem;
    }

    .regulation-document .table-scroll {
        margin: 1rem -1.25rem;
        padding: 0 1.25rem;
        margin: 0;
    }

    .regulation-document table th,
    .regulation-document table td {
        padding: 0.375rem 0.5rem;
    }
}
