/* ═══════════════════════════════════════════
   OPRS Portale — Design System
   Ordine degli Psicologi della Regione Siciliana
   ═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=Playfair+Display:wght@600;700&display=swap');

:root {
    /* Colori OPRS */
    --oprs-blu-scuro: #020381;
    --oprs-blu: #2874fc;
    --oprs-blu-medio: #004fce;
    --oprs-viola: #7a00df;
    --oprs-viola-scuro: #5a00a8;
    --oprs-ciano: #34e2e4;

    /* Neutri */
    --sfondo: #f0f2f5;
    --card: #ffffff;
    --bordo: #e2e5ea;
    --testo: #1a1d23;
    --testo-secondario: #5f6672;
    --testo-chiaro: #8b919d;

    /* Sidebar */
    --sidebar-w: 272px;
    --navbar-h: 68px;
}

* { box-sizing: border-box; }

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--sfondo);
    color: var(--testo);
    -webkit-font-smoothing: antialiased;
}

/* ═══ NAVBAR ═══ */
.portale-navbar {
    height: var(--navbar-h);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: #ffffff;
    border-bottom: 1px solid var(--bordo);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.portale-navbar .nav-logo img {
    height: 42px;
    transition: opacity 0.2s;
}

.portale-navbar .nav-logo img:hover {
    opacity: 0.85;
}

.portale-navbar .nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.portale-navbar .nav-user-info {
    text-align: right;
    line-height: 1.3;
}

.portale-navbar .nav-user-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--testo);
}

.portale-navbar .nav-user-role {
    font-size: 11px;
    color: var(--testo-chiaro);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.portale-navbar .nav-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #0066cc;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
}

.portale-navbar .nav-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 0 0 3px rgba(40, 116, 252, 0.2);
}

/* ═══ SIDEBAR ═══ */
.portale-sidebar {
    width: var(--sidebar-w);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    padding-top: var(--navbar-h);
    background: #0e1230;
    overflow-y: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.portale-sidebar::before {
    content: '';
    position: absolute;
    top: var(--navbar-h);
    left: 0;
    right: 0;
    height: 120px;
    background: transparent;
    pointer-events: none;
}

.portale-sidebar .sidebar-section {
    padding: 20px 0 8px;
}

.portale-sidebar .sidebar-label {
    padding: 0 24px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.3);
    margin-bottom: 8px;
}

.portale-sidebar a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 24px;
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 400;
    transition: all 0.2s ease;
    position: relative;
    border-left: 3px solid transparent;
    margin: 1px 0;
}

.portale-sidebar a:hover {
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.9);
}

.portale-sidebar a.active {
    background: rgba(40, 116, 252, 0.12);
    color: #ffffff;
    border-left-color: var(--oprs-blu);
    font-weight: 500;
}

.portale-sidebar a.active::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--oprs-blu);
    border-radius: 3px 0 0 3px;
}

.portale-sidebar a i {
    width: 20px;
    text-align: center;
    font-size: 15px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.portale-sidebar a:hover i,
.portale-sidebar a.active i {
    opacity: 1;
}

.portale-sidebar .sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 12px 24px;
}

/* ═══ CONTENT ═══ */
.portale-content {
    margin-left: var(--sidebar-w);
    padding-top: var(--navbar-h);
    min-height: 100vh;
}

.portale-content-inner {
    padding: 32px;
    max-width: 1280px;
}

/* ═══ FOOTER ═══ */
.portale-footer {
    margin-left: var(--sidebar-w);
    background: #1a1d23;
    padding: 20px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.portale-footer p {
    font-size: 12px;
    color: rgba(255,255,255,0.4);
}

.portale-footer a {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    transition: color 0.2s;
}

.portale-footer a:hover {
    color: #ffffff;
}

/* ═══ DROPDOWN ═══ */
.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04);
    min-width: 220px;
    z-index: 60;
    overflow: hidden;
    animation: dropdownIn 0.15s ease;
}

.user-dropdown.open {
    display: block;
}

@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-dropdown .dd-header {
    padding: 16px;
    background: #f8f9fb;
    border-bottom: 1px solid var(--bordo);
}

.user-dropdown .dd-header p {
    font-size: 13px;
    font-weight: 600;
    color: var(--testo);
}

.user-dropdown .dd-header span {
    font-size: 11px;
    color: var(--testo-chiaro);
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    color: var(--testo-secondario);
    text-decoration: none;
    font-size: 13px;
    transition: background 0.15s;
}

.user-dropdown a:hover {
    background: #f8f9fb;
    color: var(--testo);
}

.user-dropdown a.dd-logout {
    color: #dc2626;
    border-top: 1px solid var(--bordo);
}

.user-dropdown a.dd-logout:hover {
    background: #fef2f2;
}

/* ═══ TOAST ═══ */
.toast-container {
    position: fixed;
    top: calc(var(--navbar-h) + 16px);
    right: 24px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: 10px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    animation: toastIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 400px;
    backdrop-filter: blur(8px);
}

.toast.success { background: #059669; }
.toast.error { background: #dc2626; }
.toast.info { background: #0066cc; }

@keyframes toastIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}

/* ═══ MOBILE ═══ */
@media (max-width: 1023px) {
    .portale-sidebar {
        transform: translateX(-100%);
    }
    .portale-sidebar.open {
        transform: translateX(0);
    }
    .portale-content,
    .portale-footer {
        margin-left: 0;
    }
    .portale-content-inner {
        padding: 20px 16px;
    }
    .portale-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(10, 14, 39, 0.6);
        z-index: 35;
        backdrop-filter: blur(2px);
    }
    .portale-overlay.active {
        display: block;
    }
}

@media (min-width: 1024px) {
    .portale-overlay {
        display: none !important;
    }
}

/* ═══ UTILITA ═══ */
.oprs-card {
    background: var(--card);
    border-radius: 14px;
    border: 1px solid var(--bordo);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s;
}

.oprs-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.oprs-gradient-text {
    color: #0066cc;
}

.oprs-btn-primary {
    background: #0066cc;
    color: white;
    font-weight: 600;
    padding: 10px 24px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(2, 3, 129, 0.2);
}

.oprs-btn-primary:hover {
    box-shadow: 0 4px 16px rgba(2, 3, 129, 0.3);
    transform: translateY(-1px);
}

.oprs-section-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    color: var(--testo);
}
