/* Author: Francesco Cucinotta <francesco.cucinotta@gmail.com>
 * Project: Praxisseminar OTH Regensburg
 *
 * CSS "chrome" base: token OTH, navbar, footer, skip-link, alert,
 * empty-state, mobile burger, print stylesheet.
 *
 * Estratto da core/templates/base.html per consentire caching browser
 * (Cache-Control 30 giorni dal vhost) e per abilitare in futuro la
 * rimozione di 'unsafe-inline' dalla CSP.
 */

:root {
    --oth-black: #000;
    --oth-gray: #666;
    --oth-light: #f8f8f8;
    --oth-border: #ddd;
    --oth-blue: #0066cc;
    /* Token unificati per status (derivati OTH, accessibili WCAG AA) */
    --status-success: #1f7a3f;
    --status-warning: #946400;
    --status-danger: #b3261e;
    --status-info: var(--oth-blue);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Skip link a11y (WCAG 2.4.1) */
.skip-link {
    position: absolute; top: -40px; left: 0; padding: 0.5rem 1rem;
    background: var(--oth-black); color: #fff; text-decoration: none;
    z-index: 10000; transition: top 0.15s ease-out;
}
.skip-link:focus { top: 0; outline: 2px solid var(--oth-blue); }

/* Focus visible globale uniforme */
:focus-visible {
    outline: 2px solid var(--oth-blue) !important;
    outline-offset: 2px !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    color: var(--oth-black);
    background: #fff;
    line-height: 1.6;
}

/* Navbar */
.nav-oth {
    background: #fff;
    border-bottom: 1px solid var(--oth-border);
    padding: 0;
}
.nav-oth .container {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 1rem 2rem;
}
.nav-brand {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--oth-black);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.nav-brand img {
    height: 45px;
    width: auto;
}
.nav-brand-divider {
    width: 1px;
    height: 35px;
    background: var(--oth-border);
    margin: 0 0.25rem;
}
.nav-links {
    display: flex;
    gap: 0;
    list-style: none;
    margin: 0;
    flex: 1;
}
.nav-links a {
    padding: 0.75rem 1.25rem;
    color: var(--oth-gray);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color 0.16s ease, border-bottom-color 0.16s ease, background 0.16s ease;
}
.nav-links a:hover,
.nav-links a.active {
    color: var(--oth-black);
    border-bottom-color: var(--oth-black);
}
.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--oth-light);
    border-radius: 4px;
    cursor: pointer;
}
.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--oth-black);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.9rem;
}
.user-info strong {
    display: block;
    font-size: 0.9rem;
    color: var(--oth-black);
}
.user-role {
    font-size: 0.75rem;
    color: var(--oth-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Main */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    min-height: calc(100vh - 180px);
}

/* Footer */
footer {
    background: var(--oth-black);
    color: #fff;
    padding: 1.5rem 2rem;
    margin-top: 4rem;
    text-align: center;
    font-size: 0.9rem;
}
footer a {
    color: #fff;
    text-decoration: underline;
}

/* Alerts */
.alert-oth {
    padding: 1rem;
    margin: 1rem 0;
    border-left: 3px solid;
    border-radius: 0;
}
.alert-success { background: #d4edda; border-color: var(--status-success); }
.alert-danger  { background: #f8d7da; border-color: var(--status-danger); }
.alert-warning { background: #fff3cd; border-color: var(--status-warning); }
.alert-info    { background: #d1ecf1; border-color: var(--status-info); }

/* Empty state riusabile */
.empty-state-oth {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--oth-light);
    border: 1px dashed var(--oth-border);
    border-radius: 8px;
    color: var(--oth-gray);
}
.empty-state-oth .empty-icon {
    font-size: 2.5rem;
    color: #b0b0b0;
    margin-bottom: 0.75rem;
    line-height: 1;
}
.empty-state-oth .empty-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--oth-black);
    margin-bottom: 0.4rem;
}
.empty-state-oth .empty-subtitle {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    max-width: 480px;
}
.empty-state-oth .empty-cta {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    background: var(--oth-black);
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
}
.empty-state-oth .empty-cta:hover { background: #333; }

/* Mobile — burger menu (drawer collassabile) */
@media (max-width: 768px) {
    .nav-oth .container {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
    }
    .nav-brand { flex: 1; }
    .nav-brand img { height: 32px; }
    .nav-brand-divider { display: none; }

    .nav-links {
        flex-direction: column;
        width: 100%;
        order: 3;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.25s ease-out;
    }
    .nav-oth[data-mobile-open="true"] .nav-links {
        max-height: 600px;
    }
    .nav-links a {
        border-bottom: none;
        border-left: 2px solid transparent;
        padding: 0.85rem 1rem;
    }
    .nav-links a:hover,
    .nav-links a.active {
        border-left-color: var(--oth-black);
        background: var(--oth-light);
    }
    .dropdown { order: 2; }
    main { padding: 1rem; }
}
@media (min-width: 769px) {
    .ds-burger { display: none !important; }
}

/* prefers-reduced-motion: rispetta preferenza utente WCAG 2.3.3 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Print: nasconde chrome, ottimizza per A4 */
@media print {
    body { background: #fff; color: #000; }
    nav.nav-oth, footer, .dropdown, .alert-oth, [data-autosave-indicator],
    .form-spinner-oth, .nav-user, button[type="submit"], .btn,
    #cookieBanner, .no-print {
        display: none !important;
    }
    main {
        max-width: 100%;
        margin: 0;
        padding: 0;
        min-height: auto;
    }
    a { color: #000; text-decoration: none; }
    a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #555; }
    table { page-break-inside: avoid; }
    thead { display: table-header-group; }
    tr { page-break-inside: avoid; }
    h1, h2, h3 { page-break-after: avoid; }
    .page-title, .section-title, .section-title-oth {
        font-size: 14pt;
        margin: 0.5cm 0;
    }
    @page { margin: 1.5cm; size: A4; }
}
