/* Estensioni funzionali del core, caricate dopo Bootstrap Italia. */
.icon-xs {
    width: 16px;
    height: 16px;
}

.min-w-0 {
    min-width: 0;
}

.intranet-core-brand-logo {
    width: auto;
    height: 100px;
}

/* Bootstrap Italia applica lo sfondo dell'accesso a ogni button nell'header slim. */
body[data-intranet-framework-profile="bi-v2"]
    .it-header-slim-right-zone
    .dropdown-menu
    .intranet-core-user-menu-logout {
    display: flex;
    align-items: center;
    min-height: 44px;
    color: var(--cbi-link);
    background-color: transparent;
}

body[data-intranet-framework-profile="bi-v2"]
    .it-header-slim-right-zone
    .dropdown-menu
    .intranet-core-user-menu-logout:is(:hover, :focus-visible) {
    color: var(--cbi-link-hover);
    background-color: var(--cbi-primary-subtle);
    text-decoration: underline;
}

.avatar.rsu-avatar-female {
    background-color: #a2195b;
}

/* Gestione accessi */
.access-admin-nav {
    display: flex;
    align-items: stretch;
    gap: 1.5rem;
    padding: 1rem 1rem 0;
    background-color: #f5f8fb;
    border: 1px solid #d8e2ec;
    border-radius: 4px;
}

.access-admin-nav__heading {
    flex: 0 0 170px;
    padding: 0.25rem 0 1rem;
}

.access-admin-nav__tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(145px, 1fr));
    flex: 1;
    margin: 0;
    border-bottom: 0;
}

.access-admin-nav__tabs .nav-item {
    min-width: 0;
}

.access-admin-nav__tabs .nav-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 64px;
    padding: 0.65rem 0.8rem;
    color: #33475b;
    border: 0;
    border-bottom: 4px solid transparent;
    border-radius: 0;
}

.access-admin-nav__tabs .nav-link:hover {
    color: var(--cbi-link-hover);
    background-color: #eaf2f8;
}

.access-admin-nav__tabs .nav-link.active {
    color: var(--cbi-link-hover);
    background-color: var(--cbi-surface);
    border-bottom-color: var(--cbi-primary);
}

.access-admin-nav__label,
.access-admin-nav__description {
    display: block;
    letter-spacing: 0;
}

.access-admin-nav__label {
    font-weight: 600;
}

.access-admin-nav__description {
    margin-top: 0.1rem;
    color: #5c6f82;
    font-size: 0.78rem;
    line-height: 1.2;
}

.access-summary {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    border-top: 1px solid #c8d2dc;
    border-bottom: 1px solid #c8d2dc;
}

.access-summary--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.access-summary--four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.access-summary__item {
    min-width: 0;
    padding: 1rem 1.25rem;
    border-right: 1px solid #d8e2ec;
}

.access-summary__item:last-child {
    border-right: 0;
}

.access-summary__item strong {
    display: block;
    margin-top: 0.15rem;
    font-size: 1.75rem;
    line-height: 1;
}

.access-area-card {
    border: 1px solid #d8e2ec;
    border-top: 4px solid var(--cbi-primary);
    box-shadow: none;
}

.access-area-card .card-body {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.access-area-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 4px;
}

.access-area-card__icon--people {
    color: #0059b3;
    background-color: #e8f2fc;
}

.access-area-card__icon--permissions {
    color: #45620b;
    background-color: #edf3df;
}

.access-area-card__icon--services {
    color: #8c4a00;
    background-color: #fff0db;
}

.access-area-card__icon .icon {
    fill: currentColor;
}

.access-data-table th {
    white-space: nowrap;
}

.access-results {
    min-height: 180px;
    transition: opacity 150ms ease-in-out;
}

.access-results.is-loading {
    opacity: 0.55;
    pointer-events: none;
}

.access-role-group {
    padding-top: 0.75rem;
    border-top: 1px solid #d8e2ec;
}

.access-role-catalog {
    padding-top: 1rem;
    border-top: 3px solid var(--cbi-primary);
}

.access-role-inline-group + .access-role-inline-group {
    margin-top: 0.65rem;
}

.access-role-inline-group__label {
    display: block;
    margin-bottom: 0.25rem;
    color: #5c6f82;
    font-size: 0.78rem;
    font-weight: 600;
}

.access-role-groups-cell {
    min-width: 240px;
}

.access-section {
    min-width: 0;
    padding-bottom: 2rem;
    border-bottom: 1px solid #d8e2ec;
}

.access-choice {
    padding: 1rem;
    border: 1px solid #d8e2ec;
    border-radius: 4px;
    background-color: var(--cbi-surface);
}

.profile-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(100%, 180px);
    aspect-ratio: 1;
    overflow: hidden;
    border: 1px solid #c8d2dc;
    border-radius: 50%;
    background-color: #f2f7fb;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar .icon {
    width: 64px;
    height: 64px;
    fill: #5c6f82;
}

.profile-details dt {
    margin-bottom: 0.25rem;
    color: #5c6f82;
    font-size: 0.875rem;
    font-weight: 600;
}

.profile-details dd {
    margin-bottom: 0;
    overflow-wrap: anywhere;
}

.access-danger-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.25rem;
    border: 1px solid #d9364f;
    border-radius: 4px;
}

.access-table-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    white-space: nowrap;
}

@media (max-width: 991.98px) {
    .access-admin-nav {
        display: block;
    }

    .access-admin-nav__heading {
        padding-bottom: 0.5rem;
    }

    .access-admin-nav__tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .access-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .access-summary__item:nth-child(3) {
        border-right: 0;
    }

    .access-summary__item:nth-child(n + 4) {
        border-top: 1px solid #d8e2ec;
    }
}

@media (max-width: 575.98px) {
    .access-admin-nav {
        padding-right: 0.5rem;
        padding-left: 0.5rem;
    }

    .access-admin-nav__tabs .nav-link {
        min-height: 58px;
        padding: 0.55rem;
    }

    .access-admin-nav__description {
        display: none;
    }

    .access-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .access-summary__item,
    .access-summary__item:nth-child(3) {
        border-right: 1px solid #d8e2ec;
    }

    .access-summary__item:nth-child(even) {
        border-right: 0;
    }

    .access-summary__item:nth-child(n + 3) {
        border-top: 1px solid #d8e2ec;
    }

    .access-summary__item strong {
        font-size: 1.5rem;
    }

    .access-table-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .access-role-groups-cell {
        min-width: 210px;
    }

    .profile-avatar {
        margin-right: auto;
        margin-left: auto;
    }

    .access-danger-zone {
        align-items: stretch;
        flex-direction: column;
    }
}

/* TinyMCE */
.tinymce-editor {
    min-height: 400px;
}

.tox-tinymce {
    border: 1px solid var(--bs-border-color) !important;
    border-radius: var(--bs-border-radius) !important;
}

.tox .tox-toolbar {
    background-color: #f8f9fa !important;
    border-bottom: 1px solid var(--bs-border-color) !important;
}

.tox .tox-tbtn {
    color: var(--bs-body-color) !important;
}

.tox .tox-tbtn:hover {
    background-color: #e9ecef !important;
}

.tox .tox-tbtn--enabled {
    background-color: var(--cbi-primary) !important;
    color: var(--cbi-on-primary) !important;
}

.tox .tox-edit-area {
    background-color: var(--cbi-surface) !important;
}

.tox .tox-edit-area__iframe {
    background-color: var(--cbi-surface) !important;
}

/* Ricerca globale */
.search-results-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    background-color: #f8f9fa;
}

.search-results-container::-webkit-scrollbar {
    width: 8px;
}

.search-results-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.search-results-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.search-results-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.search-results-container #searchResultsList {
    padding: 0.75rem;
}

/* Chat */
.chat-widget {
    position: fixed;
    right: 1rem;
    bottom: 0;
    width: min(320px, calc(100vw - 2rem));
    background-color: var(--cbi-surface);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem 0.5rem 0 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    z-index: 1040;
}

.chat-widget.minimized .chat-body,
.chat-widget.minimized .chat-input {
    display: none;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--cbi-primary);
    color: var(--cbi-on-primary);
    padding: 0.4rem 0.6rem;
}

.chat-title {
    display: flex;
    align-items: center;
    font-weight: 600;
}

.chat-actions .btn {
    color: var(--cbi-on-primary);
}

.chat-body {
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
    background-color: #f8f9fa;
}

.chat-input {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-top: 1px solid #e9ecef;
    background-color: var(--cbi-surface);
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.msg {
    max-width: 80%;
    padding: 6px 10px;
    border-radius: 12px;
    font-size: 0.9rem;
}

.msg-in {
    align-self: flex-start;
    background: var(--cbi-surface);
    border: 1px solid #e9ecef;
}

.msg-out {
    align-self: flex-end;
    background: #dbeafe;
    border: 1px solid #bfdbfe;
}

.msg-system {
    align-self: center;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-size: 0.8rem;
}

.presence-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-left: 4px;
    border-radius: 50%;
    vertical-align: middle;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6);
}

.news-content {
    overflow-wrap: anywhere;
}

.news-content img,
.news-content video {
    max-width: 100%;
    height: auto;
}

.news-content table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}

.news-content th,
.news-content td {
    padding: 0.5rem;
    border: 1px solid #c5c7c9;
    vertical-align: top;
}

/* Visualizzatore log amministrativo */
.admin-log-filters {
    padding: 1.25rem 0;
    border-top: 1px solid #d9dadb;
    border-bottom: 1px solid #d9dadb;
}

.admin-log-table-wrapper {
    border-top: 1px solid #d9dadb;
}

.admin-log-table {
    min-width: 960px;
    table-layout: fixed;
}

.admin-log-table th,
.admin-log-table td {
    vertical-align: top;
}

.admin-log-date {
    width: 10rem;
}

.admin-log-level {
    width: 7rem;
}

.admin-log-channel,
.admin-log-user {
    width: 12rem;
}

.admin-log-break,
.admin-log-message {
    overflow-wrap: anywhere;
}

.admin-log-message {
    white-space: pre-wrap;
}

.admin-log-context {
    color: #5c6f82;
    font-size: 0.875rem;
    white-space: normal;
}

.admin-log-context div {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.admin-log-context dt {
    font-weight: 600;
}

.admin-log-context dt::after {
    content: ':';
}

.admin-log-context dd {
    margin: 0;
}

@media (prefers-reduced-motion: reduce) {
    .access-results {
        transition: none;
    }
}
