/* Toggle collapse nella topbar */
.sidebar-collapse-btn.topbar-toggle {
    margin-right: 0.5rem;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.35rem;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    transition: background 0.18s, color 0.18s;
    box-shadow: none;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar-collapse-btn.topbar-toggle:hover,
.sidebar-collapse-btn.topbar-toggle:focus {
    background: rgba(255,255,255,0.12);
    color: #ffd700;
}

/* Pulsante toggle tema */
.theme-toggle-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.25rem;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    transition: background 0.18s, color 0.18s;
    box-shadow: none;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
.theme-toggle-btn:hover,
.theme-toggle-btn:focus {
    background: rgba(255,255,255,0.12);
    color: #3273dc;
}

.sidebar.collapsed {
    width: 60px;
    min-width: 60px;
    max-width: 60px;
    transition: width 0.2s;
}
.sidebar.collapsed .sidebar-text,
.sidebar.collapsed .sidebar-label {
    display: none !important;
}
.sidebar.collapsed .menu-list a {
    justify-content: center;
}
.sidebar.collapsed .icon {
    margin-right: 0;
}

.main-content {
    transition: margin-left 0.2s, width 0.2s;
}
body.has-sidebar > .sidebar.collapsed + .main-content {
    margin-left: 60px;
    width: calc(100vw - 60px);
}
body.has-sidebar > .sidebar.collapsed + .main-content + .global-footer {
    left: 60px;
    width: calc(100vw - 60px);
}
/* Footer globale */
.global-footer {
    position: fixed;
    left: var(--sidebar-width);
    bottom: 0;
    width: calc(100vw - var(--sidebar-width));
    height: 48px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid var(--border-color);
    z-index: 20;
    font-size: 0.98rem;
    box-shadow: 0 -1px 4px rgba(0,0,0,0.03);
}

.global-footer .footer-content {
    width: 100%;
    text-align: center;
}

@media (max-width: 768px) {
    .global-footer {
        left: 0;
        width: 100vw;
    }
}
/* Sidebar: migliora contrasto testo su hover/active */
/* Sidebar: testo sempre chiaro e contrastato su hover/active */
.sidebar .menu-list a:hover,
.sidebar .menu-list a:focus,
.sidebar .menu-list a.is-active,
.sidebar .menu-list li.is-active > a {
    color: #fff !important;
    background-color: #2563eb !important; /* blu più scuro per contrasto */
    text-shadow: 0 1px 2px rgba(0,0,0,0.18);
    outline: none;
}

/* Sidebar: testo sempre chiaro anche su link attivi */
.sidebar .menu-list a.is-active,
.sidebar .menu-list li.is-active > a {
    color: #fff !important;
    background-color: #1d4ed8 !important; /* ancora più scuro per active */
    text-shadow: 0 1px 2px rgba(0,0,0,0.22);
}
/* public/assets/css/theme.css */

/* Variabili CSS per tema scuro */
:root {
    --bg-primary: #f5f7fb;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --primary-color: #3273dc;
    --success-color: #48c774;
    --warning-color: #ffdd57;
    --danger-color: #f14668;
    --info-color: #3298dc;
    --topbar-height: 3.25rem;
    --sidebar-width: 250px;
    --sidebar-bg: #1f2937;
    --sidebar-hover: #374151;
    --sidebar-text: #f9fafb;
    --sidebar-border: #374151;
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --bg-card: #333333;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --border-color: #444444;
    --sidebar-bg: #2a2a2a;
    --sidebar-hover: #333333;
    --sidebar-text: #ffffff;
    --sidebar-border: #444444;
}

/* Override Bulma per tema scuro */
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}


body.app-layout.has-sidebar {
    padding-top: 0;
    padding-left: 0;
    margin: 0;
    width: 100vw;
    height: 100vh;
    overflow-x: hidden;
}

.navbar {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 40;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--sidebar-bg);
    padding: 1rem 0.5rem;
    overflow-y: auto;
    z-index: 30;
    transition: width 0.18s ease, transform 0.18s ease;
}

.main-content {
    margin-left: var(--sidebar-width);
    padding: 0;
    min-height: 100vh;
    width: calc(100vw - var(--sidebar-width));
    box-sizing: border-box;
    background: var(--bg-primary);
}

.main-content .section {
    padding: 2.5vw 2vw;
    min-height: 100vh;
}

.main-content .container {
    max-width: 100vw !important;
    width: 100vw;
    padding: 0;
}

.card {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.card-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.table {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.table th {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.table td {
    border-color: var(--border-color);
}

.table tr:hover {
    background-color: var(--bg-secondary);
}

.input, .textarea, .select select {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.input:focus, .textarea:focus, .select select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.125em rgba(50, 115, 220, 0.25);
}

.button.is-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.button.is-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.button.is-warning {
    background-color: var(--warning-color);
    border-color: var(--warning-color);
}

.button.is-danger {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
}

.button.is-info {
    background-color: var(--info-color);
    border-color: var(--info-color);
}

.notification {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.notification.is-danger {
    border-color: var(--danger-color);
}

.notification.is-success {
    border-color: var(--success-color);
}

.notification.is-warning {
    border-color: var(--warning-color);
}

.notification.is-info {
    border-color: var(--info-color);
}

.menu {
    background-color: var(--sidebar-bg);
}

.menu-list a {
    color: var(--sidebar-text);
}

.menu-list a:hover {
    background-color: var(--sidebar-hover);
}

.menu-list a.is-active {
    background-color: var(--primary-color);
    color: var(--sidebar-text);
}

.navbar-item.is-active {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.menu-label {
    color: var(--sidebar-text);
}

.theme-mode-select select {
    min-width: 110px;
}

.auth-theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 60;
}

.breadcrumb {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.breadcrumb a {
    color: var(--text-secondary);
}

.breadcrumb a:hover {
    color: var(--text-primary);
}

.modal-card {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.modal-card-head, .modal-card-foot {
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
}

/* Login page */
.login-page {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.login-page .box {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 768px) {
    body.app-layout.has-sidebar {
        padding-left: 0;
    }

    .sidebar {
        transform: translateX(-100%);
        z-index: 45;
    }

    .sidebar.is-active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding-top: 1rem;
    }

    .main-content .section {
        padding: 0.5rem;
    }

    .main-content .container {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }

    .navbar-burger {
        display: block;
    }
}

/* Sidebar overlay per mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 44;
    display: none;
}

.sidebar-overlay.is-active {
    display: block;
}