/* cpr - court_pract_rubricator */

.template-cpr .site__sidebar {
    display: none;
}

.template-cpr .site {
    --site-grid-template-columns: auto;
    --site-grid-template-areas: "h" "c";
    --site-grid-gap: 15px;
}

.cpr {
    /* Основные цвета Закон.РФ */

    --primary: 193 100% 37%;
    --primary-hover: 193 100% 30%;
    --primary-light: 203 62% 92%;
    --primary-foreground: 0 0% 100%;
    --primary-gradient: linear-gradient(93.74deg, #009BCE 0%, #198FB6 47%);

    --link: 205 100% 32%;
    --link-hover: 206 100% 27%;

    --background: 0 0% 100%;
    --foreground: 198 12% 28%;

    --card: 0 0% 100%;
    --card-foreground: 198 12% 22%;
    --card-muted: 216 20% 96%;

    --secondary: 216 24% 96%;
    --secondary-foreground: 198 12% 28%;

    --muted: 216 20% 96%;
    --muted-foreground: 206 12% 61%;

    --accent: 203 62% 92%;
    --accent-foreground: 205 100% 32%;

    --border: 213 18% 87%;

    --success: 176 62% 35%;
    --warning: 43 99% 60%;
    --danger: 344 52% 49%;

    /* Высота шапки для sticky позиционирования */
    --header-height: 107px;
    --breadcrumbs-height: 44px;

    --topic-tree-header-height: 60px;
    --topic-search-height: 100px;
    
    /* Типы дел */
    --civil: 210 100% 95%;
    --civil-foreground: 210 100% 40%;
    --admin: 45 100% 95%;
    --admin-foreground: 45 80% 35%;
    --arbitration: 150 60% 95%;
    --arbitration-foreground: 150 60% 30%;
    --criminal: 0 70% 95%;
    --criminal-foreground: 0 70% 40%;
    
    /* Результаты дел */
    --satisfied: 150 60% 95%;
    --satisfied-foreground: 150 60% 30%;
    --partial: 45 100% 95%;
    --partial-foreground: 45 80% 35%;
    --rejected: 0 70% 95%;
    --rejected-foreground: 0 70% 40%;
    
    /* Подсветка поиска */
    --highlight: 48 100% 67%;
    --highlight-foreground: 0 0% 10%;

    --radius-sm: 8px;
    --radius: 12px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
    --shadow-md: 0 6px 18px rgba(16, 24, 40, 0.10);
}


.cpr a {
    color: hsl(var(--link)); 
}
.cpr a:hover {
    color: hsl(var(--link-hover));
    text-decoration: none;;
}

.cpr:where(a,button,input,select,.tree-item,.tree-toggle):focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.22);
  border-radius: 6px;
}


/* Main layout */
.cpr__main-container {
    margin-top: 25px;
    padding: 0 0 32px;
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
    align-items: start;
}

/* Topic tree (left panel) */
.cpr__topic-tree-panel {
    border-radius: var(--radius);
    border: none;
    background: hsl(var(--card-muted));
    box-shadow: none;
    overflow: hidden;
    position: sticky;
    top: 0;
}

.cpr__topic-tree-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    font-size: 17px;
    font-weight: 500;
    letter-spacing: -0.01em;
    border-bottom: 1px solid hsl(var(--border));
}

.cpr__close {
    display: none;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border-radius: var(--radius-sm);
    border: 1px solid #cfcfcf;
    cursor: pointer;
    font-size: 18px;
    color: #56595b;
}

/* Rubric search block */
.cpr__topic-search {
    border-bottom: 1px solid hsl(var(--border));
    background: hsl(var(--card));
    padding: 12px 20px;
}

.cpr__topic-search-title {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    color: hsl(var(--muted-foreground));
    margin-bottom: 8px;
}

.cpr__topic-search-form {
    display: flex;
    gap: 6px;
}

.cpr__topic-search-input {
    flex: 1;
    height: 30px;
    padding: 0 10px;
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.cpr__topic-search-btn {
    height: 30px;
    padding: 0 10px;
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    background: white;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.cpr__topic-search-btn.primary {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
}

.cpr__topic-search-btn.icon {
    width: 30px;
    padding: 0;
    justify-content: center;
    background: #DDEDF7;
    color: #005EA3;
    border-color: transparent;
}

.cpr__topic-search-hint {
    font-size: 10px;
    color: hsl(var(--muted-foreground));
    margin-top: 6px;
}

.cpr__topic-tree-content {
    position: relative;  /* need for scroll active topic to view */
    max-height: calc(100vh - var(--topic-search-height) - var(--topic-tree-header-height));
    overflow-y: auto;
}

.cpr__tree-node {
    /* border-bottom: 1px solid hsl(var(--border)); */
    margin-bottom: 3px;
}

.cpr__topic-tree-content > .cpr__tree-node:last-of-type {
    margin-bottom: 70px;
}

.cpr__tree-node a {
    color: hsl(var(--foreground));
}

.cpr__tree-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.15s;
    outline: none;
}

.cpr__tree-toggle {
    width: 20px;
    height: 20px;
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    transition: border-color 0.2s, background 0.2s;
}

.cpr__tree-node.expanded > * > .cpr__tree-toggle.plus {
    display: none;
}

.cpr__tree-node:not(.expanded) > * > .cpr__tree-toggle.minus {
    display: none;
}

.cpr__tree-toggle:hover {
    border-color: #55585c;
}

.cpr__tree-spacer {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 700;
    flex-shrink: 0;
}

.cpr__tree-label {
    flex: 1;
    font-weight: 400;
    font-size: 14px;
}

.cpr__tree-count {
    font-size: 11px;
    font-weight: 300;
    color: hsl(var(--muted-foreground));
}

.cpr__tree-item:hover {
    background: hsl(var(--card));
}

.cpr__tree-item.selected {
    background: hsl(var(--accent));
}

.l0 {margin-left: 0;}
.l1 {margin-left: 13px;}
.l2 {margin-left: 26px;}
.l3 {margin-left: 39px;}
.l4 {margin-left: 52px;}
.l5 {margin-left: 65px;}
.l6 {margin-left: 65px;}
.l7 {margin-left: 65px;}

/* .l0 {margin-left: 0;}
.l1 {margin-left: 23px;}
.l2 {margin-left: 46px;}
.l3 {margin-left: 69px;}
.l4 {margin-left: 92px;}
.l5 {margin-left: 92px;}
.l6 {margin-left: 92px;}
.l7 {margin-left: 92px;} */

.tree-children {
    margin-left: 23px;
    /* border-left: 1px solid hsl(var(--border)); */
    border-left: 1px dashed #a5aab0;
}




/* Right panel */
.cpr__content-panel {
    background: hsl(var(--card));
    border-radius: var(--radius);
    border: 2px solid hsl(var(--border));
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.cpr__content-header {
    padding: 16px;
    border-bottom: 1px solid hsl(var(--border));
}

.cpr__content-header h1 {
    font-size: 21px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 110%;
    margin-bottom: 4px;
}

.cpr__content-header p {
    margin-top: 5px;
    font-weight: 300;
    font-size: 13px;
    color: hsl(var(--muted-foreground));
}



/* Filters */
.cpr__filters-bar {
    padding: 14px 20px;
    border-bottom: 1px solid hsl(var(--border));
    background-color: #fff;
}

.cpr__filters-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    font-size: 17px;
    font-weight: 500;
    letter-spacing: -0.01em;
    border-bottom: 1px solid hsl(var(--border));
}

.cpr__type-chips {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid hsl(var(--border));
    flex-wrap: wrap;
}

.cpr__chip {
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    border: none;
    background: hsl(var(--card-muted));
    cursor: pointer;
    transition: all 0.2s;
}

.cpr__chip:hover {
    border-color: hsl(var(--primary));
    /* color: hsl(var(--primary)); */
    background: #DDEDF7;
    color: #005EA3;
}

.cpr__chip:has(input:checked) {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
}

.cpr__chip__button {
    display: none;
}

.cpr__filters-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 16px;
}

.cpr__filters-row-1 {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.cpr__filters-row-2 {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    flex-wrap: wrap;
}

.cpr__filter-text {
    flex: 1 1 420px;
    min-width: 320px;
}

.cpr__filter-date {
    flex: 0 0 220px;
}

.cpr__filter-case {
    flex: 0 0 240px;
}

.cpr__filter-result {
    flex: 0 1 260px;
    min-width: 240px;
}

.cpr__filter-court {
    flex: 0 0 280px;
    position: relative;
}

.cpr__filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cpr__filter-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    color: hsl(var(--muted-foreground));
    white-space: nowrap;
}

.cpr__filter-input {
    height: 32px;
    padding: 0 10px;
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    font-size: 12px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.cpr__filter-input:focus {
    border-color: hsl(var(--primary));
}

.cpr__filter-input.search {
    width: 100%;
    padding-left: 32px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") 10px center no-repeat;
}

.cpr__filter-select {
    height: 32px;
    padding: 0 28px 0 10px;
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    font-size: 12px;
    font-family: inherit;
    outline: none;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") calc(100% - 8px) center no-repeat;
    appearance: none;
    cursor: pointer;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cpr__filter-select:focus {
    border-color: hsl(var(--primary));
}

.cpr__filter-btn {
    height: 32px;
    padding: 0 14px;
    border: none;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    font-family: inherit;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
}

.cpr__filter-btn.primary {
    background: hsl(var(--primary));
    color: white;
}
.cpr__filter-btn.primary {
    background: #DDEDF7;
    color: #005EA3;
    border: none;
}

.cpr__filter-btn.primary:hover {
    background: hsl(var(--primary-hover));
}
.cpr__filter-btn.primary:hover {
    background: hsl(var(--muted));
    opacity: 0.85;
}

.cpr__filter-btn.secondary {
    background: hsl(var(--secondary));
    color: hsl(var(--foreground));
}

.cpr__filter-btn.secondary:hover {
    background: hsl(var(--muted));
}



/* Court typeahead styles */
.cpr__court-typeahead {
    position: relative;
    width: 100%;
}

.cpr__court-input-wrapper {
    position: relative;
}

.cpr__court-input {
    width: 100%;
    padding-right: 28px;
}

.cpr__court-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: hsl(var(--muted-foreground));
    padding: 2px;
    line-height: 1;
    display: none;
}

.cpr__court-clear:hover {
    color: hsl(var(--foreground));
}

.cpr__court-clear.visible {
    display: block;
}

.cpr__court-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.cpr__court-dropdown.open {
    display: block;
}

.cpr__court-dropdown-item {
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
    border-bottom: 1px solid hsl(var(--border) / 0.5);
}

.cpr__court-dropdown-item:last-child {
    border-bottom: none;
}

.cpr__court-dropdown-item:hover {
    background: hsl(var(--accent));
}

.cpr__court-dropdown-item .match {
    font-weight: 700;
    color: hsl(var(--primary));
}

.cpr__court-dropdown-hint {
    padding: 12px;
    font-size: 11px;
    color: hsl(var(--muted-foreground));
    text-align: center;
}


.cpr__court-api-note{
    display: block;
    margin-top: 6px;
    font-size: 10px;
    opacity: 0.9;
}
.cpr__court-dropdown-loader {
    padding: 12px;
    font-size: 11px;
    color: hsl(var(--muted-foreground));
    text-align: center;
}

.cpr__filter-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}



.cpr__topic-search-input, 
.cpr__filter-input, 
.cpr__filter-select {
    border-radius: 6px;
    border-color: hsl(var(--border));
    background: #fff;
    font-weight: 400;
}

.cpr__filter-group .cpr__filter-input, 
.cpr__filter-group .cpr__filter-select, 
.cpr__filter-group .cpr__court-typeahead {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
}

.cpr__topic-search-input:focus, .cpr__filter-input:focus, .cpr__filter-select:focus {
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.18);
}


/* DOC-LIST */

/* Results summary */
.cpr__results-summary {
    padding: 12px 16px;
    border-bottom: 1px solid hsl(var(--border));
    display: flex;
    gap: 12px;
    justify-content: flex-start;
    font-size: 13px;
    color: hsl(var(--foreground));
    font-weight: 500;
}

.cpr__doc-list {
    padding: 12px 20px 20px;
}

/* cpr__doc cards */
.cpr__doc-card {
    padding: 20px;
    border: none;
    border-radius: var(--radius);
    background: hsl(var(--card-muted));
    margin-bottom: 10px;
    transition: background 0.15s;
}

.cpr__doc-card:hover {
    background: hsl(var(--muted) / 0.3);
}

.cpr__doc-card:last-child {
    border-bottom: none;
}

.cpr__doc-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

.cpr__doc-title {
    color: #005EA3;
    font-weight: 500;
    font-size: 16px;
    text-decoration: underline;
}

.cpr__doc-title:hover {
    color: hsl(var(--link-hover));
    text-decoration: underline;
}

.cpr__doc-date {
    font-size: 12px;
    color: hsl(var(--muted-foreground));
    margin-left: 8px;
}

.cpr__doc-badges {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.cpr__badge {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.cpr__badge.civil {
    background: hsl(var(--civil));
    color: hsl(var(--civil-foreground));
}

.cpr__badge.admin {
    background: hsl(var(--admin));
    color: hsl(var(--admin-foreground));
}

.cpr__badge.arbitration {
    background: hsl(var(--arbitration));
    color: hsl(var(--arbitration-foreground));
}

.cpr__badge.criminal {
    background: hsl(var(--criminal));
    color: hsl(var(--criminal-foreground));
}

.cpr__badge.satisfied {
    background: hsl(var(--success) / 0.12);
    color: hsl(var(--success));
}

.cpr__badge.partial {
    background: hsl(var(--partial));
    color: hsl(var(--partial-foreground));
}

.cpr__badge.rejected {
    background: hsl(var(--rejected));
    color: hsl(var(--rejected-foreground));
}

.cpr__doc-meta {
    font-size: 14px;
    color: hsl(206deg 7.7% 38.84%);
    margin-bottom: 10px;
    font-weight: 500;
    line-height: var(--base-line-height);
}

.cpr__doc-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    margin-bottom: 0;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid hsl(var(--border));
}

.cpr__doc-actions a,
.cpr__doc-actions button {
    color: #005EA3;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
}

.cpr__doc-actions a:hover,
.cpr__doc-actions button:hover {
    text-decoration: underline;
}

.cpr__fulltext-link {
    color: #005EA3;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 12px;
}

.cpr__fulltext-link:hover {
    color: hsl(var(--link-hover));
}

.cpr__action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0;
    color: #005EA3;
}

.cpr__action-btn:hover {
    background: #DDEDF7;
}

/* cpr__doc parts grid */
.cpr__doc-parts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 0;
}

.cpr__doc-part {
    padding: 10px;
    border-radius: 6px;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
}

.cpr__doc-part-title {
    font-size: 11px;
    margin-bottom: 3px;
    font-weight: 500;
    text-transform: uppercase;
}

.cpr__doc-part-text {
    font-size: 12px;
    line-height: 16px;
    font-weight: 300;
    letter-spacing: -0.01em;
    color: hsl(var(--muted-foreground));
    display: block;
    overflow: visible;
}

.highlight {
    background: hsl(var(--highlight));
    color: hsl(var(--highlight-foreground));
    padding: 0 2px;
    border-radius: 2px;
}


/* simple paginator */
.cpr__pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px;
    border-top: 1px solid hsl(var(--border));
}

.cpr__pagination-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    background: white;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.2s;
}

.cpr__pagination-btn.enabled:hover {
    border-color: hsl(var(--link));
    color: hsl(var(--link));
}

.cpr__pagination-text {
    font-size: 12px;
    color: hsl(var(--muted-foreground));
    font-weight: 300;
    padding: 0 10px;
    min-width: 140px;
    text-align: center;
}

.cpr__mobile-control-bar {
    background: hsl(var(--card));
    border-bottom: 1px solid hsl(var(--border));
    padding: 10px 0;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    display: flex;
    gap: 10px;
    z-index: 100;
}

.cpr__mobile-control-bar {
    display: none;
}

.cpr__mobile-control-button {
    flex: 1;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.cpr__mobile-control-icon {
    width: 20px;
    height: 20px;
}

.cpr__mobile-control-button_topic-tree {
    background: var(--primary-gradient);
    color: white;
}

.cpr__mobile-control-button_doc-filter {
    background: #DDEDF7;
    color: #005EA3;
    border: none;
}



/* PAD */

@media screen and (max-width: 1024px) {
    .cpr__doc-parts {
        grid-template-columns: 1fr;
    }

    .cpr__filters-row-1, .cpr__filters-row-2, .cpr__filter-group {
        flex-wrap: wrap;
    }

    .cpr__main-container {
        grid-template-columns: 1fr 1fr;
    }

    .cpr__doc-header {
        flex-wrap: wrap;
    }
}


/* MOBILE */

@media screen and (max-width: 860px) {
    .cpr__close {
        display: flex;
    }

    .cpr__doc-card {
        padding: 10px;
    }

    /*topicTreePanel  */
    #topicTreePanel  {
        position: fixed;
        top: 0; 
        left: 0;
        width: 100%; 
        height: 100%;
        z-index: 1000;
    }

    #topicTreePanel  {
        display: none;
    }

    #topicTreePanel.opened  {
        display: block;
    }

    .cpr__main-container {
        grid-template-columns: 1fr;
    }

    .cpr__topic-tree-panel {
        border-radius: 0;
    }

    .cpr__topic-tree-header {
        font-size: 21px;
        font-weight: 600;
        letter-spacing: -0.01em;
        line-height: 110%;
    }

    .cpr__tree-label {
        font-size: 15px;
    }

    .cpr__content-panel {
        border: none;
        box-shadow: none;
    }

    .cpr__content-header {
        padding: 16px 0;
    }

    .cpr__doc-list {
        padding: 12px 0 20px 0;
    }

    .cpr__mobile-control-bar {
        display: flex;
    }

    /* DocFilters */
    #filtersBar  {
        position: fixed;
        top: 0; 
        left: 0;
        width: 100%; 
        height: 100%;
        z-index: 1000;
        background-color: #fff;
    }

    #filtersBar  {
        display: none;
    }

    #filtersBar.opened  {
        display: block;
    }

    .cpr__filters-header {
        display: flex;
        font-size: 21px;
        font-weight: 600;
        letter-spacing: -0.01em;
        line-height: 110%;
    }

    .cpr__filter-actions {
        margin: 15px 0 0 0;
    }
}