/* ControlloPartecipate — DevExtreme Fluent Theme Styles */

/* === WCAG 2.1 AA Accessibility (commentato — da riattivare) ===
.skip-to-content {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    z-index: 9999;
    background: #0066CC;
    color: #fff;
    padding: 8px 16px;
    font-size: 14px;
    text-decoration: none;
    border-radius: 0 0 4px 0;
}
.skip-to-content:focus {
    position: fixed;
    left: 0;
    top: 0;
    width: auto;
    height: auto;
    overflow: visible;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

*:focus-visible {
    outline: 2px solid #0066CC;
    outline-offset: 2px;
}
.dx-widget *:focus-visible {
    outline: 2px solid #0066CC;
    outline-offset: 1px;
}
.dx-treeview .dx-treeview-item:focus-visible {
    outline: 2px solid #0066CC;
    outline-offset: -2px;
}
.dx-toolbar .dx-button:focus-visible {
    outline: 2px solid #0066CC;
    outline-offset: 2px;
}
=== Fine WCAG commentato === */

/* === Layout Shell (matches DemoFluent reference) === */
body, html {
    margin: 0;
    min-height: 100%;
    height: 100%;
}

#app-side-nav-outer-toolbar {
    flex-direction: column;
    display: flex;
    height: 100%;
    width: 100%;
}

.layout-header {
    flex: 0 0 auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    position: relative;
    z-index: 1505;
}

.dx-toolbar .dx-toolbar-item.menu-button {
    width: 60px;
    text-align: center;
    padding: 0;
}

.layout-body {
    background-color: #f2f2f2;
    flex: 1;
    height: 100%;
    min-height: 0;
}

.layout-body-hidden {
    visibility: hidden;
}

/* === ScrollView with footer === */
.with-footer > .dx-scrollable-wrapper > .dx-scrollable-container > .dx-scrollable-content {
    height: 100%;
}

.with-footer > .dx-scrollable-wrapper > .dx-scrollable-container > .dx-scrollable-content > .dx-scrollview-content {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

/* === Content area === */
.layout-body .content {
    flex-grow: 1;
    height: 100%;
    line-height: 1.5;
    margin: 20px 40px;
}

.layout-body .content h2 {
    font-size: 32px;
    line-height: 40px;
}

.layout-body .content-block {
    margin: 0 0 20px;
}

.layout-body .responsive-paddings {
    padding: 20px;
}

@media screen and (max-width: 600px) {
    .layout-body .content {
        margin: 20px;
    }
}

@media screen and (min-width: 1280px) {
    .layout-body .responsive-paddings {
        padding: 40px;
    }
}

/* === Content footer === */
.layout-body .content-footer {
    display: block;
    border-top: 1px solid rgba(0,0,0,.1);
    padding: 20px 40px 24px;
    margin: 0;
}

/* === Menu container / TreeView styling === */
.menu-container {
    height: 100%;
    width: 250px;
    background-color: #fff;
}

.menu-container .dx-widget {
    font-weight: 700;
    font-size: 14px;
    line-height: 24px;
}

.menu-container .dx-treeview {
    white-space: nowrap;
}

.menu-container .dx-treeview .dx-treeview-node[aria-level="2"] .dx-treeview-item {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.menu-container .dx-treeview .dx-treeview-item {
    padding-left: 0;
    flex-direction: row-reverse;
    border-radius: 0;
}

.menu-container .dx-treeview .dx-treeview-item .dx-icon {
    width: 60px !important;
    margin: 0 !important;
}

.menu-container .dx-treeview .dx-treeview-node {
    padding: 0 0 !important;
}

.menu-container .dx-treeview .dx-treeview-toggle-item-visibility {
    right: 10px;
    left: auto;
}

.menu-container .dx-treeview .dx-rtl .dx-treeview-toggle-item-visibility {
    left: 10px;
    right: auto;
}

.menu-container .dx-treeview .dx-treeview-node[aria-level="1"] {
    font-weight: bold;
}

.menu-container .dx-treeview .dx-treeview-node[aria-level="2"] .dx-treeview-item-content {
    font-weight: normal;
    padding: 0 60px;
}

/* === Drawer shrink shadow === */
#app-drawer.dx-drawer-shrink .dx-drawer-panel-content {
    box-shadow: rgba(0, 0, 0, 0.06) 0px 4px 4px 0px, rgba(0, 0, 0, 0.12) 0px 1px 2px 0px;
}

/* === dx-card (DevExtreme standard) === */
.dx-card {
    box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.24);
    border-radius: 4px;
    background-color: #fff;
    margin: 2px 2px 3px;
}

.dx-card.wide-card {
    border-radius: 0;
    margin-left: 0;
    margin-right: 0;
    border-right: 0;
    border-left: 0;
}

/* === Card (custom cp-card) === */
.cp-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 16px;
}

.cp-card-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
    font-weight: 600;
    font-size: 14px;
    background: #fafbfc;
    border-radius: 8px 8px 0 0;
}

.cp-card-body {
    padding: 16px;
}

.cp-card-body.text-center {
    text-align: center;
}

/* === KPI Grid === */
.cp-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.cp-kpi-tile {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.cp-kpi-tile h5 {
    margin: 0 0 8px;
    font-size: 14px;
    color: #555;
    font-weight: 600;
}

.cp-kpi-tile .cp-kpi-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

.cp-kpi-tile.border-success { border-left: 4px solid #5cb85c; }
.cp-kpi-tile.border-danger  { border-left: 4px solid #d9534f; }
.cp-kpi-tile.border-warning { border-left: 4px solid #f0ad4e; }
.cp-kpi-tile.border-info    { border-left: 4px solid #5bc0de; }
.cp-kpi-tile.border-primary { border-left: 4px solid #0078d4; }

.text-success { color: #5cb85c !important; }
.text-danger  { color: #d9534f !important; }
.text-warning { color: #f0ad4e !important; }
.text-info    { color: #5bc0de !important; }

/* === Badge === */
.cp-badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    border-radius: 4px;
    color: #fff;
    white-space: nowrap;
}

.cp-badge-success   { background-color: #5cb85c; }
.cp-badge-danger    { background-color: #d9534f; }
.cp-badge-warning   { background-color: #f0ad4e; color: #333; }
.cp-badge-info      { background-color: #5bc0de; }
.cp-badge-primary   { background-color: #0078d4; }
.cp-badge-secondary { background-color: #6c757d; }
.cp-badge-dark      { background-color: #333; }

/* === Alert === */
.cp-alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    border: 1px solid;
}

.cp-alert-danger {
    background-color: #fdf0ef;
    border-color: #f5c6cb;
    color: #842029;
}

.cp-alert-info {
    background-color: #e8f4f8;
    border-color: #b8daff;
    color: #0c5460;
}

/* === Grid Layout === */
.cp-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}

.cp-col   { flex: 1; min-width: 0; }
.cp-col-3 { flex: 0 0 calc(25% - 12px); min-width: 0; }
.cp-col-4 { flex: 0 0 calc(33.333% - 11px); min-width: 0; }
.cp-col-5 { flex: 0 0 calc(41.666% - 10px); min-width: 0; }
.cp-col-6 { flex: 0 0 calc(50% - 8px); min-width: 0; }
.cp-col-8 { flex: 0 0 calc(66.666% - 6px); min-width: 0; }

/* === Form === */
.cp-form-group {
    margin-bottom: 16px;
}

.cp-form-label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

/* === Footer === */
.cp-footer {
    background: #17324D;
    color: #ccc;
    padding: 24px;
    text-align: center;
    font-size: 13px;
}

.cp-footer h2 {
    font-size: 16px;
    color: #fff;
    margin: 0 0 4px;
}

.cp-footer p {
    margin: 0;
}

/* === Misc === */
h3 {
    margin: 0 0 16px;
    font-size: 1.4rem;
    font-weight: 600;
}

h5 {
    margin: 16px 0 12px;
    font-size: 1rem;
    font-weight: 600;
}

/* MasterDetail pre block */
pre.cp-pre {
    background: #f5f7fa;
    padding: 12px;
    border-radius: 4px;
    max-height: 300px;
    overflow: auto;
    font-size: 12px;
    margin: 0;
}

/* Link styled as action */
a.cp-action-link {
    color: #0078d4;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}

a.cp-action-link:hover {
    text-decoration: underline;
}

/* === Responsive === */
@media (max-width: 600px) {
    .cp-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .cp-row {
        flex-direction: column;
    }

    .cp-col-3, .cp-col-4, .cp-col-5, .cp-col-6, .cp-col-8 {
        flex: 1 1 100%;
    }
}
