/*
:root {
    --bg-main: #1a252f;
    --bg-panel: #2c3e50;
    --bg-card: #25313c;
    --bg-modal: #344555;
    --bg-input: #2b6a94;
    --bg-code: #1e1e1e;
    --bg-overlay: rgba(0, 0, 0, 0.85);
    --bg-float-btn: rgba(52, 73, 94, 0.7);

    --accordion-bg: #1a252f;
    --accordion-header-bg: #2c3e50;
    --accordion-header-hover: #34495e;
    --accordion-border: #34495e;

    --text-light: #ffffff;
    --text-muted: #bdc3c7;
    --text-code: #d4d4d4;

    --primary: #3498db;
    --primary-hover: #2980b9;
    --secondary: #7f8c8d;
    --success: #27ae60;
    --success-light: #2ecc71;
    --danger: #c0392b;
    --danger-light: #e74c3c;
    --warning: #f39c12;
    --warning-light: #f1c40f;
    --accent: #e67e22;

    --border-main: #34495e;
    --border-light: #4a5c6d;
    --shadow-main: rgba(0, 0, 0, 0.5);
    --shadow-text: rgba(0, 0, 0, 0.8);
    --shadow-text-dark: rgba(0, 0, 0, 0.9);
    --shadow-box: rgba(0, 0, 0, 0.3);
}
*/

/* Base & Reset */
body,
html {
    margin: 0;
    padding: 0;
    background: var(--bg-main);
    overflow: hidden;
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    user-select: none;
    color: var(--text-light);
}

h2 {
    margin: 0;
    color: var(--primary);
    font-size: 1.5em;
}

h3 {
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.2em;
}

/* Utilities */
.d-flex {
    display: flex;
}

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-1 {
    gap: 5px;
}

.gap-2 {
    gap: 10px;
}

.flex-1 {
    flex: 1;
}

.flex-2 {
    flex: 2;
}

.flex-3 {
    flex: 3;
}

.w-100 {
    width: 100%;
}

.m-0 {
    margin: 0;
}

.mt-2 {
    margin-top: 10px;
}

.mt-4 {
    margin-top: 20px;
}

.mb-3 {
    margin-bottom: 15px;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-muted);
}

.text-small {
    font-size: 0.9em;
}

/* Layout Structure */
.app-container {
    height: calc(100dvh - 40px);
    width: 100vw;
    position: relative;
    transition: height 0.3s;
    overflow-y: auto;
}

.app-container.with-topbar {
    height: calc(100dvh - 100px);
}

.dashboard-container {
    display: flex;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

#topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    background: var(--bg-panel);
    padding: 0 20px;
    border-bottom: 2px solid var(--border-main);
    box-shadow: 0 2px 10px var(--shadow-main);
    position: relative;
    z-index: 100;
    box-sizing: border-box;
}

.topbar-left {
    flex: 0 1 auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 65%;
}

.topbar-center {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: bold;
}

.topbar-right {
    flex: 0 1 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 15px;
}

#topbar a {
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.2s;
}

#topbar a:visited {
    color: var(--text-light);
}

#topbar a:hover {
    color: var(--text-light);
    text-decoration: underline;
}

#site-title-display {
    font-size: 1.2em;
    font-weight: bold;
    letter-spacing: 0.5px;
    color: var(--text-light);
    text-shadow: 0px 1px 3px var(--shadow-text-dark);
}

.sidebar {
    width: 250px;
    background: var(--bg-panel);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    border-right: 2px solid var(--border-main);
    overflow-y: auto;
}

.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background: var(--bg-main);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border-main);
    padding-bottom: 15px;
}

.tab-section {
    display: none;
}

.tab-section.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Buttons */
.btn {
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 4px;
    color: var(--text-light);
    font-size: 0.9em;
    font-weight: bold;
}

.btn-primary {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--secondary);
}

.btn-success {
    background: var(--success);
}

.btn-danger {
    background: var(--danger);
}

.btn-warning {
    background: var(--warning);
}

.btn-dark {
    background: var(--border-main);
}

.btn-sm {
    font-size: 0.8em;
    padding: 6px 10px;
}

.admin-btn-float {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 100;
    padding: 10px 15px;
    background: var(--bg-float-btn);
    color: var(--text-light);
    cursor: pointer;
    border-radius: 20px;
    border: none;
    font-weight: bold;
    box-shadow: 0 4px 10px var(--shadow-box);
    border: 1px solid var(--border-light);
}

.sidebar-btn {
    background: transparent;
    color: var(--text-light);
    border: none;
    padding: 15px 20px;
    text-align: left;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: background 0.2s, border-left 0.2s;
    border-left: 4px solid transparent;
}

.sidebar-btn:hover {
    background: var(--border-main);
}

.sidebar-btn.active {
    background: var(--bg-main);
    border-left: 4px solid var(--primary);
    color: var(--primary);
}

.sidebar-btn-danger {
    margin-top: auto;
    border-top: 1px solid var(--border-main);
    color: var(--danger-light);
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--secondary);
    padding: 10px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1em;
    transition: color 0.2s;
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: var(--text-light);
    border-bottom: 2px solid var(--primary);
    margin-bottom: -1px;
}

/* =========================================
   FOOTER LAYOUT
   ========================================= */
#footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 40px;
    background: var(--bg-panel);
    border-top: 1px solid var(--border-main);
    padding: 0 20px;
    box-sizing: border-box;
    font-size: 0.85em;
    color: var(--text-muted);
    position: relative;
    z-index: 100;
}

/* Flexbox a 3 colonne */
.footer-left { flex: 1; }
.footer-center { flex: 2; text-align: center; }
.footer-right { 
    flex: 1; 
    display: flex; 
    justify-content: flex-end; 
    align-items: center; 
}

.privacy-footer-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    font-size: 1em;
    padding: 0;
    transition: color 0.2s;
}

.privacy-footer-btn:hover {
    color: var(--text-light);
    text-decoration: underline;
}

/* Forms & Inputs */
input:not([type="color"]):not([type="checkbox"]) {
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--secondary);
    border-radius: 4px;
    background: var(--bg-input);
    color: var(--text-light);
    font-size: 1em;
}

input.input-inline {
    background: var(--bg-main);
    border: 1px solid var(--border-main);
    padding: 10px;
}

input[type="color"] {
    height: 38px;
    width: 40px;
    padding: 0;
    cursor: pointer;
    border: none;
    margin: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-label {
    color: var(--text-muted);
    font-size: 0.9em;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.9em;
    white-space: nowrap;
}

.gestione-form-bar {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
    background: var(--bg-card);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 0.95em;
    color: var(--text-light);
}

.setting-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin: 0;
    accent-color: var(--success);
}

.input-dark {
    width: 100%;
    padding: 10px;
    background: var(--bg-main);
    color: var(--text-light);
    border: 1px solid var(--border-main);
    box-sizing: border-box;
    border-radius: 4px;
}

.input-label {
    color: var(--text-muted);
    font-size: 0.9em;
    display: block;
    margin-bottom: 5px;
}

/* Tables & Grids */
table {
    width: 100%;
    text-align: left;
    border-collapse: collapse;
    font-size: 0.9em;
}

th,
td {
    padding: 10px;
    border-bottom: 1px solid var(--border-main);
}

.admin-table-wrapper {
    max-height: 350px;
    overflow-y: auto;
    background: var(--bg-main);
    border-radius: 6px;
    padding: 10px;
    margin-top: 15px;
}

.gestione-table-wrapper {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 15px;
}

.table-cell-actions {
    text-align: right;
    white-space: nowrap;
}

.sys-info-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
}

.sys-info-table th,
.sys-info-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-main);
    text-align: left;
}

.sys-info-table th {
    color: var(--primary);
    width: 30%;
    font-weight: normal;
}

.sys-info-table tr:last-child td,
.sys-info-table tr:last-child th {
    border-bottom: none;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border-bottom: 3px solid var(--primary);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-value {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--text-light);
    margin: 10px 0;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-modal);
    padding: 25px;
    border-radius: 8px;
    width: 95%;
    max-width: 600px;
    box-shadow: 0 5px 15px var(--shadow-main);
    max-height: 85dvh;
    overflow-y: auto;
    display: block;
}

.modal-sm {
    max-width: 350px;
}

.modal-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.modal-page-content {
    max-width: 600px;
    width: 100%;
}

.modal-header-title {
    color: var(--primary);
    border-bottom: 1px solid var(--border-main);
    padding-bottom: 10px;
    margin-top: 0;
}

.modal-code-content {
    max-width: 90%;
    width: 100%;
    height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-img-content {
    max-width: 400px;
    width: 100%;
}

/* Radial Core Elements */
#radial-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.radial-svg {
    position: absolute;
    width: 100%;
    height: 100%;
}

.radial-slice {
    cursor: pointer;
    transition: filter 0.2s;
}

.radial-slice:hover {
    filter: brightness(1.2);
}

.block-label-wrapper {
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: none;
    text-align: center;
}

.block-label-text {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-light);
    text-shadow: 2px 2px 8px var(--shadow-text);
}

/* Markdown & Code Editors */
.md-toolbar {
    display: flex;
    gap: 5px;
    background: var(--bg-panel);
    padding: 8px;
    border: 1px solid var(--border-main);
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    flex-wrap: wrap;
}

.md-btn {
    background: var(--bg-main);
    color: var(--text-light);
    border: 1px solid var(--border-main);
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: bold;
    transition: background 0.2s, color 0.2s;
}

.md-btn:hover {
    background: var(--primary);
    color: var(--text-light);
}

.md-textarea {
    border-radius: 0 0 4px 4px !important;
    margin-top: 0 !important;
}

.md-separator {
    border-left: 1px solid var(--border-main);
    margin: 0 5px;
}

.editor-row {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    align-items: flex-start;
}

.editor-col {
    flex: 1;
    text-align: left;
}

.editor-col-2 {
    flex: 2;
    text-align: left;
}

.action-bar {
    display: flex;
    gap: 5px;
}

.help-text {
    color: var(--secondary);
    font-size: 0.85em;
    display: block;
    margin-top: 5px;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.code-title {
    margin: 0;
    color: var(--accent);
}

.code-filename {
    font-family: monospace;
    color: var(--text-muted);
}

.code-textarea {
    flex: 1;
    width: 100%;
    background: var(--bg-code);
    color: var(--text-code);
    font-family: 'Courier New', Courier, monospace;
    border: 1px solid var(--border-main);
    padding: 15px;
    resize: none;
    font-size: 14px;
    white-space: pre;
    overflow: auto;
    box-sizing: border-box;
}

.code-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}

/* Miscellaneous */
.url-text {
    font-size: 0.9em;
    color: var(--text-muted);
    display: block;
}

.stats-text {
    font-size: 0.85em;
}

.color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 5px;
}

.img-status {
    color: var(--warning);
    display: none;
    margin-top: 5px;
    font-size: 0.9em;
}

/* Drag & Drop */
.draggable-row {
    cursor: grab;
    transition: background-color 0.2s;
}

.draggable-row:active {
    cursor: grabbing;
}

.draggable-row.dragging {
    opacity: 0.5;
    background: var(--bg-panel);
}

.drag-handle {
    cursor: grab;
    padding-right: 10px;
    color: var(--secondary);
    font-weight: bold;
    user-select: none;
    font-size: 1.2em;
}

.drag-over-top {
    border-top: 2px solid var(--primary) !important;
}

.drag-over-bottom {
    border-bottom: 2px solid var(--primary) !important;
}

/* Notifications */
.notification-container-fixed {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.toast-notification {
    background: var(--bg-panel);
    color: var(--text-light);
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-width: 250px;
    pointer-events: auto;
    animation: slideUp 0.3s ease-out forwards;
    border-left: 5px solid var(--primary);
}

.toast-success {
    border-color: var(--success-light);
}

.toast-error {
    border-color: var(--danger-light);
}

.toast-warning {
    border-color: var(--warning-light);
}

.toast-fade-out {
    animation: fadeOut 0.5s ease-out forwards;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* Container generico per i riquadri del blog */
.blog-container-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* =========================================
   PORTFOLIO LAYOUT
   ========================================= */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    padding: 40px 20px;
    max-width: 1400px;
    margin: 0 auto;
    align-content: start;
}

.portfolio-card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    /* Bordo spostato in alto e colore base di default */
    border-top: 5px solid var(--primary); 
    border-bottom: none;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 15px var(--shadow-main);
    position: relative; /* Necessario per il badge in absolute */
}

.portfolio-card:hover {
    transform: translateY(-15px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6);
}

.portfolio-img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-main);
}

.portfolio-body {
    padding: 30px;
    text-align: center;
}

.portfolio-title {
    font-size: 1.6em;
    font-weight: bold;
    margin-bottom: 15px;
    color: var(--text-light);
    letter-spacing: 1px;
}

.portfolio-text {
    color: var(--text-muted);
    font-size: 1em;
    line-height: 1.7;
}

@media (max-width: 600px) {
    .portfolio-grid {
        grid-template-columns: 1fr; 
        gap: 25px;
        padding: 20px 15px;
    }

    .portfolio-card {
        margin: 0;
    }

    .portfolio-img {
        height: 200px;
    }

    .portfolio-title {
        font-size: 1.3em;
    }

    #topbar {
        padding: 0 10px;
    }
    
    #site-title-display {
        font-size: 1em;
    }
}

/* Badge della Categoria */
.category-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 5px 12px;
    border-radius: 20px;
    color: var(--text-light); /* Rispetta il contrasto del tema */
    font-size: 0.75em;
    font-weight: bold;
    text-transform: uppercase;
    z-index: 10;
    box-shadow: 0 2px 5px var(--shadow-box);
}

/* Utilities pulite */
.d-none { display: none !important; }
.pt-4 { padding-top: 24px; }
.color-picker-input {
    width: 100%;
    padding: 0;
    margin: 0;
    height: 40px;
    border: 1px solid var(--border-main);
    cursor: pointer;
}

/* Media Gallery Grid */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.media-card {
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-main);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
}

.media-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px var(--shadow-main);
}

.media-preview {
    width: 100%;
    height: 130px;
    object-fit: cover;
    background: var(--bg-panel);
    cursor: zoom-in;
    border-bottom: 1px solid var(--border-main);
}

.media-info {
    padding: 10px;
}

.media-name {
    font-size: 0.8em;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 8px;
}

.media-actions {
    display: flex;
    gap: 5px;
}

.media-actions .btn {
    flex: 1;
    padding: 5px;
    font-size: 0.75em;
}

.modal-text-content {
    font-size: 0.9em;
    color: var(--text-muted);
    line-height: 1.6;
    text-align: left;
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 10px;
}

.modal-text-content h3 {
    color: var(--primary);
    margin-bottom: 5px;
    margin-top: 20px;
    text-align: left;
}

.modal-text-content h3:first-child {
    margin-top: 0;
}

.modal-text-content p {
    margin-top: 0;
    margin-bottom: 15px;
}

.modal-text-content b {
    color: var(--text-light);
}

/* Sidebar Toggle Button (nascosto su desktop) */
.sidebar-toggle-btn {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2em;
}

/* Modifiche Sidebar per Mobile */
@media (max-width: 768px) {
    .sidebar-toggle-btn { display: block; }

    .sidebar {
        position: fixed;
        left: -250px; /* Nascosta a sinistra */
        top: 0;
        bottom: 0;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 5px 0 15px var(--shadow-main);
    }

    .sidebar.open {
        left: 0; /* Entra in campo */
    }

    .main-content {
        padding-top: 70px; /* Spazio per il tasto hamburger */
    }

    /* Overlay per chiudere il menu cliccando fuori */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    .sidebar-overlay.open { display: block; }
}

/* Sidebar Link Style (perché ora sono <a>) */
.sidebar-btn {
    text-decoration: none;
    display: block;
}

/* =========================================
   GDPR COOKIE BANNER
   ========================================= */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-panel);
    padding: 15px 25px;
    box-shadow: 0 -5px 20px var(--shadow-main);
    z-index: 10001;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    border-top: 3px solid var(--primary);
    gap: 20px;
}

.cookie-banner-text {
    flex: 1;
    font-size: 0.9em;
    color: var(--text-muted);
    line-height: 1.5;
}

.cookie-banner-btn {
    white-space: nowrap;
}

@media (max-width: 600px) {
    .cookie-banner {
        flex-direction: column;
        text-align: center;
        padding: 20px 15px;
    }
    .cookie-banner-btn {
        width: 100%;
    }
    .cookie-banner-btn .btn {
        width: 100%;
    }
}

/* Codice Inline nel testo (Markdown) */
p > code {
    background: var(--bg-code);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    border: 1px solid var(--border-main);
}

/* =========================================
   ACCORDION SYSTEM
   ========================================= */
.accordion-item {
    border: 1px solid var(--border-light);
    border-top: 5px solid var(--primary);
    margin-bottom: 15px;
    border-radius: 12px;
    background: var(--accordion-bg);
    overflow: hidden;
    box-shadow: 0 4px 15px var(--shadow-box);
}

.accordion-header {
    padding: 15px 20px;
    cursor: pointer;
    background: var(--accordion-header-bg);
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s;
    user-select: none;
}

.accordion-content {
    display: none;
    padding: 20px;
    border-top: 1px solid var(--border-light);
}
.accordion-header:hover {
    background: var(--accordion-header-hover);
}


.acc-icon {
    font-size: 1.2em;
    font-family: monospace;
    color: var(--primary);
}

/* Menu laterale */

#public-sidebar {
    position: fixed;
    top: 60px;
    left: -250px;
    width: 250px;
    height: calc(100vh - 60px);
    background: var(--bg-panel);
    z-index: 90;
    transition: left 0.3s ease;
    border-right: 2px solid var(--border-main);
    box-shadow: 5px 0 15px rgba(0,0,0,0.5);
    overflow-y: auto;
}

#public-sidebar.open {
    left: 0;
}

.public-overlay {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    width: 100vw;
    height: calc(100vh - 60px);
    background: var(--bg-overlay);
    z-index: 80;
}

.public-overlay.open {
    display: block;
}

/* =========================================
   PAGINE TESTUALI E MARKDOWN
   ========================================= */
.markdown-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: 12px;
    box-shadow: 0 5px 15px var(--shadow-main);
    color: var(--text-light); /* Sostituisce il "white" hardcoded */
}

/* Adattamento per gli schermi dei telefoni */
@media (max-width: 768px) {
    .markdown-container {
        margin: 20px 15px;
        padding: 20px;
    }
}

.sidebar-separator {
    height: 1px;
    background: var(--border-main); /* Disegna una riga sottile */
    margin: 10px 20px; /* Dà un po' di respiro sopra e sotto */
}

/* =========================================
   BLOG MODULE STYLES
   ========================================= */
.blog-view-header {
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-main);
    padding-bottom: 20px;
}

.blog-meta {
    color: var(--text-muted);
    font-size: 0.9em;
}

.blog-summary {
    background: var(--bg-main);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid var(--border-main);
}

.blog-summary-title {
    color: var(--primary);
    font-weight: bold;
    display: block;
    margin-bottom: 10px;
}

.blog-section {
    margin-bottom: 40px;
}

.blog-editor-card {
    background: var(--bg-panel);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-main);
    margin-bottom: 20px;
}

.blog-drag-item {
    background: var(--bg-card);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-main);
    margin-bottom: 15px;
}

.blog-slug-wrapper {
    display: flex;
    gap: 10px;
}

.markdown-container a,
a.md-link,
.read-more-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.markdown-container a:hover,
a.md-link:hover,
.read-more-link:hover {
    color: var(--text-light);
    text-decoration: underline;
}

.read-more-link {
    display: inline-block;
    font-size: 0.95em;
    margin-top: 12px;
}

/* Badge stati blog */
.badge-status-0 { color: var(--secondary); font-weight: bold; } /* Nascosto */
.badge-status-1 { color: var(--warning); font-weight: bold; }   /* Attesa */
.badge-status-2 { color: var(--success); font-weight: bold; }   /* Approvato */
.badge-status-3 { color: var(--primary); font-weight: bold; }   /* Modificato */

/* Barra azioni nella lista */
.action-bar {
    display: flex;
    gap: 8px;
}

#scroll-progress-container {
    position: fixed;
    top: 60px; /* Allineato esattamente sotto la topbar */
    left: 0;
    width: 100%;
    height: 3px; /* 3 pixel per una visibilità ottimale, abbassa a 2 se lo vuoi più fine */
    background: transparent;
    z-index: 99; /* Z-index inferiore alla topbar (100) ma sopra il contenuto */
}

#scroll-progress-bar {
    height: 100%;
    background: var(--primary); /* Usa il colore principale del tema scelto */
    width: 0%; /* Parte da zero */
    transition: width 0.1s ease-out; /* Swooosh fluido dell'avanzamento */
}

#back-to-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px; 
    height: auto;
    cursor: pointer;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease, filter 0.3s ease;
    
    filter: drop-shadow(0 0 8px var(--text-light));
}

#back-to-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#back-to-top-btn:hover {
    filter: drop-shadow(0 0 15px var(--primary)) brightness(1.1);
    transform: translateY(-5px);
}

/* Standard per Firefox e Browser moderni */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--bg-main);
}

/* Metodo WebKit (Chrome, Safari, Edge, Opera) */
::-webkit-scrollbar {
    width: 20px; /* Larghezza della barra verticale */
    height: 20px; /* Altezza della barra orizzontale */
}

::-webkit-scrollbar-track {
    background: var(--bg-main); /* Colore del binario */
    border-radius: 20px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary); /* Colore della parte che trascini */
    border-radius: 20px;
    border: 2px solid var(--bg-main); /* Crea un po' di stacco dal bordo */
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent); /* Cambia colore (aura) al passaggio del mouse */
}