/* ============================================================
   GestionalePro — style.css
   ============================================================ */
:root {
    --gp-primary: #c0392b;
    --gp-primary-dark: #962d22;
    --gp-sidebar: #1f2733;
    --gp-sidebar-hover: #2c3849;
    --gp-sidebar-active: #c0392b;
    --gp-accent: #f4c542;
    --gp-bg: #f3f4f6;
    --gp-border: #dfe3e8;
    --gp-text: #2b2f36;
}

* { box-sizing: border-box; }

body {
    font-family: 'Barlow', system-ui, sans-serif;
    background: var(--gp-bg);
    color: var(--gp-text);
    margin: 0;
    font-size: 14px;
}

h1, h2, h3, h4, h5, .titolo-pagina, .navbar-brand {
    font-family: 'Barlow Condensed', sans-serif;
    letter-spacing: .3px;
}

/* ---------- Layout ---------- */
.gp-wrapper { display: flex; min-height: 100vh; }

.gp-sidebar {
    width: 240px;
    background: var(--gp-sidebar);
    color: #c8d0db;
    flex-shrink: 0;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    overflow-y: auto;
    transition: transform .25s ease;
    z-index: 1040;
}
.gp-sidebar .brand {
    padding: 18px 20px;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.gp-sidebar .brand .brand-txt > span { color: var(--gp-accent); }
.gp-pin {
    background: none;
    border: none;
    color: #6b7888;
    font-size: 15px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color .15s ease, transform .15s ease;
}
.gp-pin:hover { color: #c8d0db; }
.sidebar-pinned .gp-pin { color: var(--gp-accent); transform: rotate(45deg); }
.gp-sidebar .nav-section {
    padding: 14px 20px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #6b7888;
}
.gp-sidebar a.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: #c8d0db;
    text-decoration: none;
    font-size: 14px;
    border-left: 3px solid transparent;
}
.gp-sidebar a.nav-item i { width: 20px; text-align: center; }
.gp-sidebar a.nav-item:hover { background: var(--gp-sidebar-hover); color: #fff; }
.gp-sidebar a.nav-item.active {
    background: var(--gp-sidebar-hover);
    border-left-color: var(--gp-accent);
    color: #fff;
}

.gp-main {
    flex: 1;
    margin-left: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    transition: margin-left .25s ease;
}

.gp-topbar {
    background: #fff;
    border-bottom: 1px solid var(--gp-border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky; top: 0; z-index: 1030;
}
.gp-topbar .titolo-pagina {
    font-size: 22px;
    font-weight: 600;
    color: var(--gp-primary);
    text-transform: uppercase;
    margin: 0;
}
.gp-content { padding: 24px; flex: 1; }

/* ---------- KPI cards ---------- */
.kpi-card {
    background: #fff;
    border: 1px solid var(--gp-border);
    border-radius: 10px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    height: 100%;
}
.kpi-card .icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: #fff;
    flex-shrink: 0;
}
.kpi-card .valore { font-size: 26px; font-weight: 700; font-family: 'Barlow Condensed', sans-serif; line-height: 1; }
.kpi-card .etichetta { font-size: 12px; color: #7a8290; text-transform: uppercase; letter-spacing: .5px; }
.bg-grad-red   { background: linear-gradient(135deg,#e74c3c,#c0392b); }
.bg-grad-blue  { background: linear-gradient(135deg,#3498db,#2471a3); }
.bg-grad-green { background: linear-gradient(135deg,#27ae60,#1e8449); }
.bg-grad-amber { background: linear-gradient(135deg,#f39c12,#d68910); }
.bg-grad-purple{ background: linear-gradient(135deg,#8e44ad,#6c3483); }
.bg-grad-teal  { background: linear-gradient(135deg,#16a085,#117a65); }

/* ---------- Card / tabelle ---------- */
.gp-card {
    background: #fff;
    border: 1px solid var(--gp-border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}
table.dataTable tbody tr { cursor: default; }
table.dataTable thead th {
    font-family: 'Barlow Condensed', sans-serif;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: .4px;
    background: #f7f8fa;
}
.btn-primary { background: var(--gp-primary); border-color: var(--gp-primary); }
.btn-primary:hover { background: var(--gp-primary-dark); border-color: var(--gp-primary-dark); }
.text-primary, a { color: var(--gp-primary); }

.badge-ruolo { font-size: 11px; }

/* righe documento */
.tabella-righe input, .tabella-righe select { font-size: 13px; }
.tabella-righe td { vertical-align: middle; padding: 4px; }
.riga-tot { background: #f7f8fa; font-weight: 600; }

.riga-nuova { animation: rigaNuovaFlash 1.6s ease; }
@keyframes rigaNuovaFlash {
    0%   { background-color: #fff3b0; }
    100% { background-color: transparent; }
}

.stato-aperto    { color: #d68910; font-weight: 600; }
.stato-fatturato { color: #1e8449; font-weight: 600; }
.stato-annullato { color: #7a8290; }

/* login */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg,#1f2733,#2c3849);
    padding: 20px;
}
.login-box {
    background: #fff;
    border-radius: 14px;
    padding: 38px 34px;
    width: 100%; max-width: 400px;
    box-shadow: 0 18px 50px rgba(0,0,0,.3);
}
.login-box .brand {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 32px; font-weight: 700;
    text-align: center; margin-bottom: 4px;
    text-transform: uppercase;
}
.login-box .brand span { color: var(--gp-primary); }

/* viewer: nascondi pulsanti scrittura */
body.ruolo-viewer .solo-admin,
body.ruolo-matricole .solo-admin { display: none !important; }

/* ---------- Sidebar a scomparsa (burger) su tutte le risoluzioni ---------- */
.gp-burger {
    display: inline-block;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--gp-primary);
}

/* nascosta di default: si apre solo col burger */
.gp-sidebar { transform: translateX(-100%); }
.gp-sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.35); }
.gp-main { margin-left: 0; }

/* velo scuro dietro alla sidebar aperta */
.gp-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 1035;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
}
.gp-backdrop.show { opacity: 1; pointer-events: auto; }

/* ---------- Sidebar agganciata (docked): spinge il contenuto ---------- */
.sidebar-pinned .gp-sidebar { transform: translateX(0); box-shadow: none; }
.sidebar-pinned .gp-main { margin-left: 240px; }
.sidebar-pinned .gp-backdrop { display: none; }
.sidebar-pinned .gp-burger { display: none; }

/* su schermi stretti l'aggancio non si applica: sempre a scomparsa */
@media (max-width: 991px) {
    .sidebar-pinned .gp-sidebar { transform: translateX(-100%); }
    .sidebar-pinned .gp-sidebar.open { transform: translateX(0); }
    .sidebar-pinned .gp-main { margin-left: 0; }
    .sidebar-pinned .gp-backdrop { display: block; }
    .sidebar-pinned .gp-burger { display: inline-block; }
    .gp-pin { display: none; }
}
