.library-card {
    transition: transform 0.2s;
}

.library-card:hover {
    transform: translateY(-2px);
}

.stat-box {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin: 5px;
}

.stat-number {
    font-size: 24px;
    font-weight: bold;
    color: #0d6efd;
}

.stat-label {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
}

.qr-container {
    text-align: center;
    padding: 20px;
}

.service-list {
    max-height: 300px;
    overflow-y: auto;
}

.visit-stats {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    padding: 15px;
    margin: 10px 0;
}

.type-badge-LR { background-color: #0d6efd; }
.type-badge-LA { background-color: #198754; }
.type-badge-LK { background-color: #6c757d; }
.type-badge-LS { background-color: #dc3545; }
.type-badge-LM { background-color: #dc3545; }
.type-badge-LN { background-color: #ffc107; color: #000; }
.type-badge-LW { background-color: #6c757d; }

.accordion-button {
    padding: 0.5rem 1rem;
}

.counter-badge {
    font-size: 0.7em;
    position: absolute;
    top: 5px;
    right: 5px;
}

/* Электронные читальные залы */
.equipment-icon-pc-hall {
    color: #17a2b8;
}

.pc-hall-badge {
    background-color: #17a2b8;
    color: white;
}

/* Иконки оснащения */
.equipment-icon {
    display: inline-block;
    margin: 0 2px;
    cursor: help;
}

.equipment-icon i {
    font-size: 1.1rem;
}

/* Легенда */
.legend-badge {
    cursor: help;
}

/* Бейдж услуг */
.services-badge {
    cursor: help;
    font-size: 0.85rem;
    padding: 0.35em 0.6em;
}

/* Адаптивность */
@media (max-width: 768px) {
    .equipment-icon i {
        font-size: 0.9rem;
    }

    .badge.bg-light.text-dark.border {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }

    .services-badge {
        font-size: 0.75rem;
    }
}

/* ============================================================
   Бейдж типа — прозрачный
   ============================================================ */

.type-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
    vertical-align: middle;
    line-height: 1.4;
    background-color: transparent !important;
    color: inherit !important;
    border: 1px solid currentColor;
}

.table-sm .type-badge {
    font-size: 0.72rem;
    padding: 2px 8px;
}

.list-group-item .type-badge {
    font-size: 0.8rem;
    padding: 3px 10px;
}

/* ============================================================
   Активный фильтр в статистике
   ============================================================ */

.list-group-item.active[class*="list-group-item-"] {
    color: inherit;
    background-color: inherit;
    border-color: inherit;
}

.list-group-item.active {
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.9),
                inset 0 0 0 4px rgba(13, 110, 253, 0.9);
    font-weight: 600;
    z-index: 2;
}

/* ============================================================
   Таблица — заголовки
   ============================================================ */

#libraryTable > thead > tr > th {
    background-color: #f8f9fa;
}

#libraryTable tbody tr .btn-outline-dark {
    background-color: rgba(255, 255, 255, 0.85);
}

#libraryTable tbody tr .btn-outline-dark:hover {
    background-color: #ffffff;
    color: #000;
}

/* ============================================================
   Таблица корпусов
   ============================================================ */

#library_stats .buildings-stats-table tbody tr {
    border-bottom: 1px solid #e9ecef;
}

#library_stats .buildings-stats-table tbody tr:last-child {
    border-bottom: none;
}

#library_stats .buildings-stats-table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #6c757d;
    font-weight: 600;
    padding: 0.35rem 0.5rem;
}

#library_stats .buildings-stats-table tbody td {
    padding: 0.4rem 0.5rem;
    vertical-align: middle;
}

/* ============================================================
   Кликабельные строки корпусов
   ============================================================ */

.buildings-stats-table tbody tr.building-row {
    transition: background-color 0.15s ease;
}

.buildings-stats-table tbody tr.building-row:hover {
    background-color: #f1f3f5;
}

.buildings-stats-table tbody tr.building-row.active-building-filter {
    background-color: #e7f1ff;
    box-shadow: inset 3px 0 0 0 #0d6efd;
}

.buildings-stats-table tbody tr.building-row.active-building-filter td {
    font-weight: 600;
}

/* ============================================================
   Кликабельное оснащение
   ============================================================ */

.equipment-filter-item {
    padding: 4px 8px;
    border-radius: 6px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.equipment-filter-item[role="button"]:hover {
    background-color: #f1f3f5;
    cursor: pointer;
}

.equipment-filter-item.active-equipment-filter {
    background-color: #e7f1ff;
    box-shadow: inset 0 0 0 1px #0d6efd;
    color: #0d6efd !important;
    font-weight: 600;
}

.equipment-filter-item.active-equipment-filter strong {
    color: #0d6efd;
}

/* ============================================================
   Dropdown фильтра услуг
   ============================================================ */

.services-dropdown-menu {
    min-width: 260px;
    max-width: 100%;
    padding: 0;
    overflow: hidden;
}

.services-dropdown-scroll {
    max-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
}

.services-dropdown-scroll::-webkit-scrollbar {
    width: 6px;
}

.services-dropdown-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.services-dropdown-scroll::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.services-dropdown-scroll::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.service-option {
    padding: 0.4rem 0.75rem;
    white-space: normal;
    line-height: 1.3;
}

.service-option.active {
    background-color: #0dcaf0 !important;
    color: #000 !important;
}

#servicesDropdown {
    text-align: left;
    padding: 0.4rem 0.75rem;
    display: flex !important;
    align-items: center;
}

#servicesDropdown > i.bi-list-check {
    flex: 0 0 auto;
    font-size: 1rem;
}

#servicesDropdown > span.text-truncate {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#servicesDropdown .badge {
    flex: 0 0 auto;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.3em 0.55em;
    line-height: 1;
    vertical-align: middle;
}

#servicesDropdown .flex-grow-1 {
    flex: 1 1 auto;
}

#servicesDropdown > i.bi-chevron-down {
    flex: 0 0 auto;
    font-size: 0.85rem;
    opacity: 0.7;
    transition: transform 0.15s ease;
}

#servicesDropdown[aria-expanded="true"] > i.bi-chevron-down {
    transform: rotate(180deg);
}

@media (max-width: 768px) {
    .services-dropdown-menu {
        min-width: 100%;
    }

    #servicesDropdown > span.text-truncate {
        max-width: 50%;
    }
}

/* ============================================================
   Модалка деталей зала — секции-панели (компактно)
   ============================================================ */

.hall-details {
    font-size: 0.88rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0;
}

.hall-section {
    padding: 0;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.hall-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    margin: 0;
    padding: 8px 14px;
    background: #eef1f4;
    border-bottom: 1px solid #d0d7de;
    border-left: 3px solid #0d6efd;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    color: #212529;
    line-height: 1.2;
}

.hall-section-title i {
    font-size: 0.95rem;
    color: #0d6efd !important;
}

/* Отступы для содержимого панели — компактные */
.hall-section > *:not(.hall-section-title) {
    margin-left: 14px;
    margin-right: 14px;
}

.hall-section > .row,
.hall-section > .table-responsive,
.hall-section > .services-table-wrap,
.hall-section > .text-center,
.hall-section > p {
    margin-top: 10px;
    margin-bottom: 10px;
}

.hall-section > .row:last-child,
.hall-section > .table-responsive:last-child,
.hall-section > .services-table-wrap:last-child,
.hall-section > .text-center:last-child,
.hall-section > p:last-child {
    margin-bottom: 12px;
}

/* Строка "метка: значение" — компактнее */
.info-row {
    display: flex;
    padding: 3px 0;
    align-items: baseline;
    border-bottom: 1px dashed #f1f3f5;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    flex: 0 0 130px;
    color: #6c757d;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 700;
    line-height: 1.3;
}

.info-value {
    flex: 1 1 auto;
    color: #212529;
    font-size: 0.88rem;
    word-break: break-word;
    line-height: 1.3;
}

.info-value code {
    background: #e7f1ff;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.82rem;
    color: #0d6efd;
    font-weight: 600;
}

/* ============================================================
   Оснащение — чипы внутри панели (компактно)
   ============================================================ */

.hall-section > .row.g-2 {
    margin: 10px 14px 12px 14px;
}

.equipment-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #6c757d;
    transition: all 0.15s ease;
    line-height: 1.2;
}

.equipment-chip.available {
    background: #d1e7dd;
    border-color: #a3cfbb;
    color: #0f5132;
    font-weight: 500;
}

.equipment-chip i {
    font-size: 0.9rem;
    flex: 0 0 auto;
}

/* ============================================================
   Таблица услуг с описаниями (компактно)
   ============================================================ */

.services-table-wrap {
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #dee2e6;
    margin: 10px 14px 12px 14px;
}

.services-table {
    font-size: 0.84rem;
    margin: 0;
}

.services-table thead th {
    background: #eef1f4;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #495057;
    font-weight: 700;
    padding: 7px 10px;
    border-bottom: 1px solid #dee2e6;
}

.services-table tbody td {
    padding: 7px 10px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f3f5;
}

.services-table tbody tr.service-row:hover {
    background-color: #f8f9fa;
}

.services-table tbody tr:last-child td {
    border-bottom: none;
}

.service-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: #0d6efd;
    color: #fff;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
}

.service-name {
    font-weight: 600;
    color: #212529;
    line-height: 1.3;
}

.service-desc-row td {
    padding: 0 !important;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.service-desc-block {
    padding: 10px 14px;
    background: #e7f1ff;
    border-left: 3px solid #0d6efd;
    margin: 0 10px 10px 10px;
    border-radius: 6px;
    font-size: 0.83rem;
    color: #212529;
    line-height: 1.45;
}

/* ============================================================
   Кликабельный бейдж бронирования
   ============================================================ */

.booking-link {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.booking-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(25, 135, 84, 0.4);
    color: #fff;
}

.booking-link:active {
    transform: translateY(0);
}

/* ============================================================
   Адаптив модалки
   ============================================================ */

@media (max-width: 768px) {
    .hall-details {
        gap: 8px;
    }

    .hall-section {
        border-radius: 6px;
    }

    .hall-section-title {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .hall-section > *:not(.hall-section-title) {
        margin-left: 12px;
        margin-right: 12px;
    }

    .info-label {
        flex: 0 0 100px;
        font-size: 0.7rem;
    }

    .info-value {
        font-size: 0.82rem;
    }

    .services-table {
        font-size: 0.78rem;
    }

    .services-table thead th,
    .services-table tbody td {
        padding: 6px 8px;
    }

    .equipment-chip {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
}

/* ============================================================
   Ссылка-телефон в таблице залов — контраст на любом фоне
   ============================================================ */

#libraryTable tbody tr .phone-link,
#libraryTable tbody tr .phone-link i {
    color: inherit !important;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

#libraryTable tbody tr .phone-link:hover {
    opacity: 0.8;
}