/* ===== School Table ===== */
.school-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.school-table thead th {
    vertical-align: middle;
    white-space: nowrap;
    font-weight: 600;
    font-size: 0.9rem;
    color: #555;
    background-color: #f7f7f7;
    border: none;
    padding: 0.75rem 1rem;
}
.school-table thead th:first-child {
    border-radius: 0.75rem 0 0 0;
}
.school-table thead th:last-child {
    border-radius: 0 0.75rem 0 0;
}
.school-table thead th[data-sortable] {
    cursor: pointer;
    user-select: none;
}
.school-table thead th[data-sortable]:hover {
    background-color: #efefef;
}
.school-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
}
.school-table tbody tr:last-child td:first-child {
    border-radius: 0 0 0 0.75rem;
}
.school-table tbody tr:last-child td:last-child {
    border-radius: 0 0 0.75rem 0;
}
.school-table tbody td {
    vertical-align: middle;
    padding: 0.75rem 1rem;
    border: none;
}
.school-table .preview-list {
    max-width: 150px;
    max-height: 112px;
    object-fit: cover;
    border-radius: 0.5rem;
}
.school-table .row-number {
    font-weight: 600;
    color: #999;
    width: 40px;
    text-align: center;
}

/* ===== Map Color Legend ===== */
.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1rem 0;
}
.map-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.map-legend .legend-item small {
    font-size: 0.85rem;
    color: #555;
}

/* ===== Comments Section ===== */
.scomments .checked_comm_div {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}
.scomments .checked_comm .form-check-label {
    font-size: 0.9rem;
}
.comments-content-container {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #dee2e6;
}
.comments-content-container .sentiment-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    margin-top: 0.2rem;
}
.comments-content {
    flex: 1;
    min-width: 0;
}
.scomments-text {
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.scomments-vote a {
    text-decoration: none;
}

/* Comment unpublished state */
.comments-content-container.unpublished {
    border-radius: 1rem;
    background-color: #E5E5E5;
    padding: 1rem !important;
}

/* ===== Sentiment Colors ===== */
.sentiment-good { color: #009F2D; }
.sentiment-neutral { color: #E17A00; }
.sentiment-bad { color: #D82700; }

/* ===== School Photo with Badges ===== */
.school-photo-wrapper {
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
}
.school-photo-wrapper img {
    width: 100%;
    display: block;
    border-radius: 1rem;
}
.school-photo-badges {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.school-photo-badge {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
}
/* Record type badges */
.school-photo-badge--cluster {
    background-color: #FF8E4F;
}
.school-photo-badge--school {
    background-color: #2253FF;
}
.school-photo-badge--kindergarten {
    background-color: #B822FF;
}
/* Institution type badge */
.school-photo-badge--institution {
    background-color: #fff;
    color: #333;
    border: 1px solid #e0e0e0;
}

/* ===== Cluster Header ===== */
.cluster-header {
    padding: 0.5rem 0;
}

/* ===== School Info Panel (replaces dl/dd) ===== */
.school-info-panel {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.school-info-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}
.school-info-label {
    font-weight: 300;
    font-size: 0.95rem;
    color: #7a7a7a;
    min-width: 140px;
    flex-shrink: 0;
}
.school-info-value {
    font-size: 0.95rem;
    color: #333;
}
.school-info-value a {
    color: #007bff;
    text-decoration: none;
}
.school-info-value a:hover {
    text-decoration: underline;
}
.school-info-address--school {
    /* color: #0d6efd; */
}
.school-info-address--kindergarten {
    color: #6f42c1;
}

/* ===== Rating Block (composite) ===== */
/* ===== Old rating block (deprecated, kept for compat) ===== */
.rating-block {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.rating-block-card {
    flex: 1;
    min-width: 280px;
    background-color: #f7f7f7;
    border-radius: 1rem;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
.rating-circle {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.rating-circle--orange {
    background-color: #f6921e;
}
.rating-circle--purple {
    background-color: #7b61ff;
}
.rating-circle--gray {
    background-color: #bbb;
    font-size: 1rem;
}
.rating-block-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.rating-block-title {
    font-weight: 600;
    font-size: 1rem;
    color: #333;
}
.rating-block-sub {
    font-size: 0.85rem;
    color: #7a7a7a;
}

/* ===== Unified Rating Card (Figma design) ===== */
.school-rating-card {
    background-color: #f7f7f7;
    border-radius: 1rem;
    padding: 2rem;
}
.school-rating-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}
.school-rating-card__header-text {
    flex: 1;
    min-width: 0;
}
.school-rating-card__title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 0.25rem 0;
}
.school-rating-card__subtitle {
    font-size: 0.85rem;
    color: #7b61ff;
}
.school-rating-card__score {
    flex-shrink: 0;
    margin-left: 1.5rem;
    line-height: 1;
    position: relative;
}
.school-rating-card__score-num {
    font-size: 3rem;
    font-weight: 800;
    color: #7b61ff;
    font-style: italic;
}
.school-rating-card__score-total {
    font-size: 1.4rem;
    font-weight: 700;
    color: #7b61ff;
    vertical-align: baseline;
}
.school-rating-card__score-asterisk {
    font-size: 1.2rem;
    color: #7b61ff;
    vertical-align: super;
}
.school-rating-card__body {
    border-top: 1px solid #e0e0e0;
    padding-top: 1rem;
}
.school-rating-card__row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px dotted #ddd;
}
.school-rating-card__row:last-child {
    border-bottom: none;
}
.school-rating-card__row-label {
    font-size: 0.9rem;
    color: #555;
    white-space: nowrap;
}
.school-rating-card__row-value {
    font-size: 0.9rem;
    color: #333;
    font-weight: 500;
    margin-left: auto;
    text-align: right;
}
.school-rating-card__row-value a {
    color: #7b61ff;
    text-decoration: underline;
}
.school-rating-card__link {
    color: #2289FF !important;
    text-decoration: none !important;
    font-weight: 500;
}
.school-rating-card__link:hover {
    text-decoration: underline !important;
}
@media (max-width: 576px) {
    .school-rating-card__header {
        flex-direction: column;
        gap: 1rem;
    }
    .school-rating-card__score {
        margin-left: 0;
        align-self: flex-end;
    }
    .school-rating-card__row {
        flex-direction: column;
        gap: 0.2rem;
    }
    .school-rating-card__row-value {
        margin-left: 0;
        text-align: left;
    }
}

/* ===== EGE Ratings Block ===== */
.ege-ratings-block-styled {
    background: url('/images/_new_theme/school_back.svg') no-repeat center right;
    background-color: #F7F7F7;
    border-radius: 1rem;
    padding: 1.5rem;
}

/* ===== Stats Block (4-column equal-width) ===== */
.school-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}
.school-stat-card {
    background-color: #f7f7f7;
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
    text-align: center;
}
.school-stat-card__label {
    color: #6c757d;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}
.school-stat-card__value {
    font-weight: 700;
    font-size: 1.15rem;
    color: #333;
}

/* ===== General Provisions (3-col) ===== */
.general-provisions {
    margin-bottom: 1.5rem;
}
.general-provisions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}
.general-provisions-tab {
    background-color: #f7f7f7;
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
}
.general-provisions-tab__title {
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 0.75rem;
    color: #333;
}
.general-provisions-tab__row {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.9rem;
}
.general-provisions-tab__row:last-child {
    border-bottom: none;
}
.general-provisions-tab__field {
    color: #7a7a7a;
}
.general-provisions-tab__value {
    color: #333;
    text-align: right;
    max-width: 60%;
    word-break: break-word;
}

/* ===== Buildings Grid ===== */
.buildings-filter-tabs {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    align-items: center;
}
.buildings-filter-switch {
    display: flex;
    align-items: center;
}
.buildings-filter-switch .form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    min-height: auto;
}
.buildings-filter-switch .form-check-input {
    width: 2.5rem;
    height: 1.25rem;
    cursor: pointer;
}
.buildings-filter-switch .form-check-input:checked {
    background-color: #2289FF;
    border-color: #2289FF;
}
.buildings-filter-switch .form-check-label {
    font-size: 0.95rem;
    cursor: pointer;
    user-select: none;
}
.buildings-filter-tabs .form-check-label {
    font-size: 0.95rem;
    cursor: pointer;
}
.buildings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}
.building-card {
    background-color: #fff;
    border-radius: 1rem;
    border: 2px solid #2289FF;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.building-card--kindergarten {
    border-color: #B822FF;
}
.building-card__img-wrapper {
    position: relative;
}
.building-card__img-wrapper .school-photo-badges {
    top: 0.5rem;
    left: 0.5rem;
}
.building-card__img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background-color: #e9ecef;
}
.building-card__body {
    padding: 1rem 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.building-card__title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #333;
}
.building-card__title a {
    color: #333;
    text-decoration: none;
}
.building-card__title a:hover {
    color: #007bff;
}
.building-card__subtitle {
    font-size: 0.8rem;
    color: #999;
}
.building-card__address {
    font-size: 0.85rem;
    color: #7a7a7a;
}
.building-card__metro {
    font-size: 0.85rem;
    color: #6c757d;
}
.building-card__rating {
    display: none;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: #FFA500;
    margin-top: 0.25rem;
}
.building-card__rating-label {
    font-size: 0.8rem;
    color: #999;
    margin-right: 0.25rem;
}
.building-card__footer {
    padding: 0 1.25rem 1.25rem;
}
.building-card__btn,
.building-card__btn:link,
.building-card__btn:visited,
.building-card__btn:focus,
.building-card__btn:active,
.building-card__btn:hover {
    display: block;
    width: 100%;
    padding: 0.55rem;
    text-align: center;
    background-color: #2289FF;
    color: #fff !important;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}
.building-card__btn:hover {
    background-color: #1a6fd6;
}
.building-card--kindergarten .building-card__btn,
.building-card--kindergarten .building-card__btn:link,
.building-card--kindergarten .building-card__btn:visited,
.building-card--kindergarten .building-card__btn:focus,
.building-card--kindergarten .building-card__btn:active,
.building-card--kindergarten .building-card__btn:hover {
    background-color: #B822FF;
    color: #fff !important;
}
.building-card--kindergarten .building-card__btn:hover {
    background-color: #9a1dd6;
}
.buildings-pagination {
    display: flex;
    justify-content: center;
    margin-top: 1.25rem;
}
.buildings-pagination .page-link:focus {
    box-shadow: none;
}
.buildings-pagination .page-item.active .page-link {
    background-color: #2289FF;
    border-color: #2289FF;
    color: #fff;
}

/* ===== Map (always visible) ===== */
.school-map-section {
    margin-bottom: 1.5rem;
}
.school-map-section #school-map-container {
    border-radius: 1rem;
}

/* ===== Nearby Schools ===== */
.nearby-school-card {
    border-radius: 1rem;
    overflow: hidden;
}
.nearby-school-card .card-body a {
    text-decoration: none;
}

/* ===== Responsive ===== */
@media screen and (max-width: 992px) {
    .buildings-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .rating-block-card {
        min-width: 240px;
    }
}
@media screen and (max-width: 768px) {
    .buildings-grid {
        grid-template-columns: 1fr;
    }
    .rating-block {
        flex-direction: column;
    }
    .rating-block-card {
        min-width: auto;
    }
    .school-info-row {
        flex-direction: column;
        gap: 0.15rem;
    }
    .school-info-label {
        min-width: auto;
    }
    .general-provisions-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Exam Results Tables ===== */
.school-exam-card {
    background-color: #f7f7f7;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
}
.school-exam-card .table {
    background-color: transparent;
}
.school-exam-card .table th,
.school-exam-card .table td {
    background-color: transparent;
    border-color: #e9ecef;
}
.school-exam-card .table thead th {
    border-bottom-width: 1px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #555;
}
.school-exam-card .table tbody td {
    font-size: 0.9rem;
    color: #333;
}

/* ===== Responsive table → mobile cards ===== */
@media screen and (max-width: 768px) {
    .school-table thead {
        display: none;
    }
    .school-table tbody {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    .school-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        background: #fff;
        border: 1px solid #e9ecef;
        border-radius: 1rem;
        overflow: hidden;
        padding: 0;
    }
    .school-table tbody td {
        border: none;
    }
    .school-table tbody td::before {
        content: attr(data-label);
    }
    /* Hide row number */
    .school-table tbody td.row-number {
        display: none;
    }
    /* Photo: full width at top */
    .school-table tbody td[data-label="Фото"] {
        width: 100%;
        padding: 0;
        order: 1;
    }
    .school-table tbody td[data-label="Фото"]::before {
        display: none;
    }
    .school-table tbody td[data-label="Фото"] img.preview-list {
        width: 100%;
        max-width: 100%;
        max-height: 200px;
        height: 200px;
        object-fit: cover;
        border-radius: 0;
        display: block;
    }
    /* Name: full width below photo */
    .school-table tbody td[data-label="Название"] {
        width: 100%;
        padding: 1rem 1rem 0.5rem;
        order: 2;
    }
    .school-table tbody td[data-label="Название"]::before {
        display: none;
    }
    .school-table tbody td[data-label="Название"] a {
        font-size: 1.05rem;
        font-weight: 600;
        color: #333;
    }
    .school-table tbody td[data-label="Название"] small {
        display: block;
        margin-top: 0.25rem;
        font-size: 0.85rem;
    }
    /* Stats row: all remaining cells in a bottom row */
    .school-table tbody td[data-label*="балл"],
    .school-table tbody td[data-label*="ЕГЭ"],
    .school-table tbody td[data-label*="ЕНТ"],
    .school-table tbody td[data-label*="ЦЭ"] {
        order: 3;
        flex: 1;
        text-align: center;
        padding: 0.75rem 0.5rem;
        border-top: 1px solid #f0f0f0;
    }
    .school-table tbody td[data-label*="балл"]::before,
    .school-table tbody td[data-label*="ЕГЭ"]::before,
    .school-table tbody td[data-label*="ЕНТ"]::before,
    .school-table tbody td[data-label*="ЦЭ"]::before {
        display: block;
        width: 100%;
        text-align: center;
        font-size: 0.7rem;
        color: #999;
        margin-bottom: 0.15rem;
    }
    .school-table tbody td[data-label="Рейтинг"],
    .school-table tbody td[data-label="Рейтинг по отзывам"] {
        order: 4;
        flex: 1;
        text-align: center;
        padding: 0.75rem 0.5rem;
        border-top: 1px solid #f0f0f0;
        font-weight: 700;
        font-size: 1.1rem;
        color: #333;
    }
    .school-table tbody td[data-label="Рейтинг"]::before,
    .school-table tbody td[data-label="Рейтинг по отзывам"]::before {
        display: block;
        width: 100%;
        text-align: center;
        font-size: 0.7rem;
        font-weight: 400;
        color: #999;
        margin-bottom: 0.15rem;
    }
    .school-table tbody td[data-label="Отзывов"],
    .school-table tbody td[data-label="Отзывов о школе"] {
        order: 5;
        flex: 1;
        text-align: center;
        padding: 0.75rem 0.5rem;
        border-top: 1px solid #f0f0f0;
        font-weight: 700;
        font-size: 1.1rem;
        color: #333;
    }
    .school-table tbody td[data-label="Отзывов"]::before,
    .school-table tbody td[data-label="Отзывов о школе"]::before {
        display: block;
        width: 100%;
        text-align: center;
        font-size: 0.7rem;
        font-weight: 400;
        color: #999;
        margin-bottom: 0.15rem;
    }

    .comments-content-container {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* ===== Публичный поиск (страница /search) ===== */
.search-page-form .input-group-lg .form-control {
    font-size: 1.1rem;
}

.search-serp-heading {
    font-weight: 600;
}

.search-serp-list {
    padding-left: 2rem;
}

.search-serp-item__link {
    color: #1a0dab;
    text-decoration: none;
}

.search-serp-item__link:hover {
    text-decoration: underline;
}

.search-serp-item__url {
    color: #006621;
    word-break: break-all;
}

.search-serp-item__snippet {
    line-height: 1.45;
}
