/* FILE: public/assets/css/app.css */
/* Stile di base EDHUB: pagine pubbliche/di accesso + layout applicativo
   (barra superiore, menu laterale, tema chiaro/scuro). Il design definitivo
   (colori di marca, loghi) arriva con il meccanismo di branding. */

:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --fg: #1b2a33;
    --muted: #6b7c86;
    --border: #e1e6ea;
    --primary: #0d6efd;
    --sidebar-bg: #ffffff;
    --sidebar-active-bg: #eef3ff;
    --topbar-bg: #ffffff;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #14181b;
        --surface: #1e2328;
        --fg: #e7ecef;
        --muted: #9aa7ad;
        --border: #30363c;
        --primary: #4d94ff;
        --sidebar-bg: #1a1e22;
        --sidebar-active-bg: #243044;
        --topbar-bg: #1a1e22;
    }
}

:root[data-theme="dark"] {
    --bg: #14181b;
    --surface: #1e2328;
    --fg: #e7ecef;
    --muted: #9aa7ad;
    --border: #30363c;
    --primary: #4d94ff;
    --sidebar-bg: #1a1e22;
    --sidebar-active-bg: #243044;
    --topbar-bg: #1a1e22;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.card, .navbar, .dropdown-menu {
    background: var(--surface);
    color: var(--fg);
}

.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
}

.error-page .code {
    font-size: 4rem;
    font-weight: 700;
    color: var(--primary);
}

.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, .08);
}

.auth-brand {
    font-size: 1.5rem;
}

/* --- Layout applicativo: barra superiore + menu laterale --- */

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border);
    height: 56px;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 0 1rem;
}

.app-topbar .brand {
    font-weight: 700;
    color: var(--fg);
    text-decoration: none;
    white-space: nowrap;
}

.app-topbar .search {
    flex: 1 1 auto;
    max-width: 420px;
}

.app-topbar .topbar-icons {
    display: flex;
    align-items: center;
    gap: .25rem;
    margin-left: auto;
}

.app-topbar .topbar-icons .btn {
    color: var(--muted);
}

.app-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 600;
    text-decoration: none;
}

.app-body {
    display: flex;
    min-height: calc(100vh - 56px);
}

.app-sidebar {
    width: 240px;
    flex: 0 0 240px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 1rem .5rem;
    overflow-y: auto;
}

.app-body.is-collapsed .app-sidebar {
    width: 64px;
    flex-basis: 64px;
}

.app-body.is-collapsed .app-sidebar .area-label,
.app-body.is-collapsed .app-sidebar .module-label {
    display: none;
}

.app-sidebar .area-label {
    text-transform: uppercase;
    font-size: .7rem;
    letter-spacing: .04em;
    color: var(--muted);
    padding: .75rem .75rem .25rem;
}

.app-sidebar .module-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem .75rem;
    border-radius: 8px;
    color: var(--fg);
    text-decoration: none;
}

.app-sidebar .module-link:hover {
    background: var(--sidebar-active-bg);
}

.app-sidebar .module-link.active {
    background: var(--sidebar-active-bg);
    color: var(--primary);
    font-weight: 600;
}

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    padding: 1.5rem;
}

.sidebar-empty {
    color: var(--muted);
    font-size: .85rem;
    padding: .5rem .75rem;
}

/* Il bootstrap.min.css incluso nel pacchetto non contiene le regole responsive
   di .offcanvas-md (rimosse da un tool di purge mai usato su un offcanvas):
   le ripristiniamo qui perché il menu laterale torni statico da md in su. */
@media (min-width: 768px) {
    .app-sidebar.offcanvas-md {
        position: static;
        z-index: auto;
        display: flex !important;
        visibility: visible !important;
        background-color: transparent;
        box-shadow: none;
        transform: none;
        transition: none;
    }

    .app-sidebar.offcanvas-md .offcanvas-body {
        display: flex;
        flex-grow: 1;
        padding: 0;
        overflow-y: visible;
    }
}

@media (max-width: 767.98px) {
    .app-sidebar {
        position: fixed;
        inset: 56px 0 0 auto;
        width: 80%;
        max-width: 300px;
        transform: translateX(100%);
        transition: transform .2s ease;
        z-index: 1040;
    }

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

    .app-body.is-collapsed .app-sidebar {
        width: 80%;
        flex-basis: auto;
    }

    .app-body.is-collapsed .app-sidebar .area-label,
    .app-body.is-collapsed .app-sidebar .module-label {
        display: block;
    }
}
