/* ============================================================
   NotifyMe - tema "blu titanio e grigio"
   Tutta la palette parte dalle variabili qui sotto: per cambiare tono basta ritoccare queste.
   ============================================================ */
:root {
    /* scala del blu titanio (dal più scuro al più chiaro) */
    --ti-900: #1b2733;
    --ti-800: #263544;
    --ti-700: #324559;
    --ti-600: #3e5c76;   /* colore principale */
    --ti-500: #52728f;
    --ti-400: #7a97b0;
    --ti-300: #a6bccd;
    --ti-200: #cddae5;
    --ti-100: #e5ecf2;
    --ti-50:  #f1f5f8;
    /* scala dei grigi (leggermente freddi) */
    --gr-900: #20262c;
    --gr-700: #44505b;
    --gr-600: #5d6975;
    --gr-500: #7b8691;
    --gr-300: #bcc5ce;
    --gr-200: #d9dfe5;
    --gr-100: #eaedf0;

    --bs-primary: var(--ti-600);   --bs-primary-rgb: 62, 92, 118;
    --bs-secondary: var(--gr-600); --bs-secondary-rgb: 93, 105, 117;
    --bs-info: var(--ti-200);      --bs-info-rgb: 205, 218, 229;
    --bs-dark: var(--ti-800);      --bs-dark-rgb: 38, 53, 68;
    --bs-light: var(--ti-50);      --bs-light-rgb: 241, 245, 248;
    --bs-body-color: #1f2a33;      --bs-body-color-rgb: 31, 42, 51;
    --bs-body-bg: #eef2f5;         --bs-body-bg-rgb: 238, 242, 245;
    --bs-secondary-color: rgba(31, 42, 51, .66);
    --bs-link-color: var(--ti-600);        --bs-link-color-rgb: 62, 92, 118;
    --bs-link-hover-color: var(--ti-800);  --bs-link-hover-color-rgb: 38, 53, 68;
    --bs-border-color: var(--gr-200);
    --bs-focus-ring-color: rgba(62, 92, 118, .28);
}

html { font-size: 15px; }
body { background: var(--bs-body-bg); color: var(--bs-body-color); }
.card { background: #fff; border-color: var(--gr-200); box-shadow: 0 2px 6px rgba(27, 39, 51, .08); }
tr[data-href] { cursor: pointer; }
.table { --bs-table-striped-bg: var(--ti-50); --bs-table-hover-bg: var(--ti-100); }
.table > thead th { color: var(--ti-800); }
.form-control:focus, .form-select:focus { border-color: var(--ti-400); box-shadow: 0 0 0 .25rem rgba(62, 92, 118, .22); }
.form-check-input:checked { background-color: var(--ti-600); border-color: var(--ti-600); }
.form-check-input:focus { border-color: var(--ti-400); box-shadow: 0 0 0 .25rem rgba(62, 92, 118, .22); }

/* ---------- pulsanti nei toni del tema */
.btn-primary { --bs-btn-color: #fff; --bs-btn-bg: var(--ti-600); --bs-btn-border-color: var(--ti-600);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--ti-700); --bs-btn-hover-border-color: var(--ti-700);
    --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--ti-800); --bs-btn-active-border-color: var(--ti-800);
    --bs-btn-focus-shadow-rgb: 62, 92, 118;
    --bs-btn-disabled-color: #fff; --bs-btn-disabled-bg: var(--ti-600); --bs-btn-disabled-border-color: var(--ti-600); }
.btn-outline-primary { --bs-btn-color: var(--ti-600); --bs-btn-border-color: var(--ti-600);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--ti-600); --bs-btn-hover-border-color: var(--ti-600);
    --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--ti-700); --bs-btn-active-border-color: var(--ti-700);
    --bs-btn-focus-shadow-rgb: 62, 92, 118; --bs-btn-disabled-color: var(--ti-600); --bs-btn-disabled-border-color: var(--ti-600); }
.btn-secondary { --bs-btn-color: #fff; --bs-btn-bg: var(--gr-600); --bs-btn-border-color: var(--gr-600);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--gr-700); --bs-btn-hover-border-color: var(--gr-700);
    --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--gr-900); --bs-btn-active-border-color: var(--gr-900);
    --bs-btn-focus-shadow-rgb: 93, 105, 117; --bs-btn-disabled-bg: var(--gr-600); --bs-btn-disabled-border-color: var(--gr-600); }
.btn-outline-secondary { --bs-btn-color: var(--gr-600); --bs-btn-border-color: var(--gr-500);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--gr-600); --bs-btn-hover-border-color: var(--gr-600);
    --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--gr-700); --bs-btn-active-border-color: var(--gr-700);
    --bs-btn-focus-shadow-rgb: 93, 105, 117; --bs-btn-disabled-color: var(--gr-500); --bs-btn-disabled-border-color: var(--gr-300); }

/* badge e sfondi con il colore "info" (titanio chiaro: testo scuro) */
.text-bg-info { color: var(--ti-900) !important; background-color: var(--ti-200) !important; }
.text-bg-light { color: var(--ti-800) !important; background-color: var(--ti-50) !important; }
.text-bg-primary { background-color: var(--ti-600) !important; }
.text-bg-secondary { background-color: var(--gr-600) !important; }
.text-bg-dark { background-color: var(--ti-800) !important; }
.bg-primary { background-color: var(--ti-600) !important; }
.bg-secondary { background-color: var(--gr-600) !important; }
.bg-dark { background-color: var(--ti-800) !important; }
.text-primary { color: var(--ti-600) !important; }
.text-secondary { color: var(--gr-600) !important; }

/* ---------- card 3D della home */
.tile-3d { perspective: 900px; }
.tile {
    --rx: 0deg; --ry: 0deg; --lift: 0px; --mx: 30%; --my: 20%;
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem;
    height: 115px; border-radius: 1.2rem; color: var(--c, #fff); text-decoration: none; font-size: 1.3rem; font-weight: 700;
    letter-spacing: .02em; text-shadow: 0 2px 4px rgba(0,0,0,.45);
    transform-style: preserve-3d;
    transform: rotateX(var(--rx)) rotateY(var(--ry)) translateY(var(--lift));
    transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s;
    /* luce dall'alto a sinistra + ombra in basso: effetto rilievo */
    background-image:
        linear-gradient(155deg, rgba(255,255,255,.32) 0%, rgba(255,255,255,.06) 38%, rgba(0,0,0,.08) 60%, rgba(0,0,0,.38) 100%);
    border: 3px solid var(--c, rgba(255,255,255,.18));
    box-shadow:
        inset 0 2px 0 rgba(255,255,255,.45),      /* bordo superiore lucido */
        inset 0 -7px 0 rgba(0,0,0,.28),           /* spessore inferiore */
        inset 0 0 0 1px rgba(255,255,255,.06),
        0 8px 0 -1px rgba(0,0,0,.45),             /* lato della "piastrella" */
        0 22px 30px -6px rgba(0,0,0,.7),           /* ombra portata */
        0 40px 60px -20px rgba(0,0,0,.6);
}
/* le tessere della home: fondo scuro blu titanio/grigio; --c è il colore della tessera, usato per scritta, icona e bordo */
.tile-ti-1 { background-color: #2b3d4e; --c: #ffd25e; }   /* giallo */
.tile-ti-2 { background-color: #2f4a61; --c: #4fe0c4; }   /* turchese */
.tile-ti-3 { background-color: #34536e; --c: #7fd3ff; }   /* azzurro */
.tile-ti-4 { background-color: #3a5a76; --c: #8ff08f; }   /* verde */
.tile-gr-1 { background-color: #38434e; --c: #ff8080; }   /* corallo */
.tile-gr-2 { background-color: #3f4a56; --c: #ffa366; }   /* arancio */
.tile-gr-3 { background-color: #434e5a; --c: #ff94c2; }   /* rosa */
.tile-gr-4 { background-color: #313c47; --c: #c3a8ff; }   /* viola */
.tile-gr-5 { background-color: #3a4651; --c: #d4ec5c; }   /* lime */
/* tessera a tutta larghezza (prima riga): icona e scritta affiancate */
.tile.tile-largo { height: 115px; flex-direction: row; gap: 1.2rem; font-size: 1.6rem; }
.tile.tile-largo i { font-size: 2.1rem; }
/* riflesso che segue il puntatore */
.tile::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: radial-gradient(circle at var(--mx) var(--my), rgba(255,255,255,.35), rgba(255,255,255,0) 55%);
    opacity: .55; transition: opacity .25s; mix-blend-mode: overlay;
}
.tile i {
    font-size: 2.1rem; transform: translateZ(45px);
    filter: drop-shadow(0 8px 6px rgba(0,0,0,.45));
}
.tile span { transform: translateZ(28px); }
.tile:hover { --lift: -6px; color: var(--c, #fff); }
.tile:hover::after { opacity: 1; }
.tile:active {
    --lift: 3px; transition-duration: .08s;
    box-shadow:
        inset 0 2px 0 rgba(255,255,255,.35), inset 0 -3px 0 rgba(0,0,0,.28),
        0 3px 0 -1px rgba(0,0,0,.45), 0 8px 14px -4px rgba(0,0,0,.7);
}
@media (prefers-reduced-motion: reduce) { .tile { transition: none; } }

/* "Passa a ..." nel dettaglio dell'item: alto e largo, per toccarlo facilmente (anche dopo la scansione del QR) */
.btn-passa { min-height: 4rem; min-width: min(100%, 22rem); padding: .75rem 2rem; font-size: 1.25rem; font-weight: 600; }
.btn-passa i { font-size: 1.5rem; vertical-align: -2px; margin-right: .4rem; }

/* pulsante "indietro" accanto al titolo delle pagine: grande, facile da toccare */
.indietro { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; margin-right: .35rem;
    width: 2.8rem; height: 2.8rem; border-radius: 50%; color: var(--gr-600); text-decoration: none; transition: background-color .15s, color .15s; }
.indietro i { font-size: 2.4rem; line-height: 1; }
.indietro:hover { color: var(--ti-700); background-color: var(--ti-100); }

.table td, .table th { vertical-align: middle; }
.color-dot { display: inline-block; width: 1rem; height: 1rem; border-radius: 50%; vertical-align: middle; border: 1px solid #0006; }
.stat-card .display-6 { font-weight: 700; font-size: 1.6rem; line-height: 1.05; }
.stat-card .card-body { padding: .35rem .8rem; }
/* card della dashboard: fondo scuro, etichetta, numero e bordo dello stesso colore (--c), come le tessere della home */
.stat-card, .card-colore { border: 3px solid var(--c); }
.stat-card { background: #2f4a61; color: var(--c); }
.stat-card .small { color: var(--c); }
.stat-card .small:last-child { opacity: .8; }
.stat-giallo  { --c: #ffd25e; }
.stat-azzurro { --c: #7fd3ff; }
.stat-verde   { --c: #8ff08f; }
.stat-viola   { --c: #c3a8ff; }
.stat-arancio { --c: #ffa366; }
.stat-allarme { --c: #ff8080; }   /* crediti esauriti, email non partite */
.stat-card.stat-allarme { background: #4a2d36; }
.card-colore .card-header { background: #2f4a61; color: var(--c); font-weight: 600; border-bottom: 3px solid var(--c); }

/* ---------- riordino con drag & drop (tabelle di gestione) */
.maniglia { width: 2.2rem; text-align: center; cursor: grab; color: var(--gr-500); font-size: 1.25rem; touch-action: none; user-select: none; }
.maniglia:active { cursor: grabbing; }
tr.in-trascinamento > td { background: var(--ti-100) !important; box-shadow: inset 0 1px 0 var(--ti-400), inset 0 -1px 0 var(--ti-400); }

/* icona (wwwroot/img/icona.png) */
img.logo { height: 1.5em; width: auto; vertical-align: -0.35em; }
img.logo.logo-lg { height: 1.8em; vertical-align: -0.45em; margin-right: .15em; }

/* logo a scritta (wwwroot/img/logo.png) al posto del nome dell'app */
img.logo-scritta { height: 34px; width: auto; max-width: 100%; display: block; }
img.logo-scritta.logo-scritta-lg { height: auto; width: min(100%, 300px); margin: 0 auto; }

/* ---------- testata comune: casa + logo + nome app */
.testata-bar {
    background: #fff; border-bottom: 1px solid var(--gr-200); box-shadow: 0 2px 8px rgba(27, 39, 51, .08);
    min-height: 60px; padding-top: 6px; padding-bottom: 6px;
}
.testata-bar .nav-link { color: var(--gr-700); }
.testata-bar .nav-link:hover { color: var(--ti-600); }
.testata-bar .nav-link.active { color: var(--ti-600); font-weight: 600; }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--ti-600); --bs-dropdown-link-hover-bg: var(--ti-100); border-color: var(--gr-200); }
.testata { display: flex; align-items: center; gap: 10px; min-width: 0; }
.testata-home { font-size: 20px; line-height: 1; padding: 9px 12px; border-radius: 8px; flex: none; }
.testata-home.testata-home-logo { padding: 2px 5px; line-height: 1; border-radius: 6px; }
/* nessun effetto al passaggio del mouse (né al clic/focus) sul logo */
.testata-home.testata-home-logo,
.testata-home.testata-home-logo:hover,
.testata-home.testata-home-logo:focus,
.testata-home.testata-home-logo:focus-visible,
.testata-home.testata-home-logo:active {
    background: transparent; border-color: transparent; box-shadow: none; outline: 0;
}
.testata-home-logo img.logo-scritta { height: 26px; }
.testata-brand {
    display: flex; align-items: center; gap: 7px; min-width: 0;
    font-weight: 800; font-size: 20px; color: var(--ti-700); text-decoration: none; white-space: nowrap;
}
.testata-brand:hover { color: var(--ti-900); }
.testata-brand .logo { height: 32px; width: auto; vertical-align: middle; flex: none; }
.testata-brand .nome { overflow: hidden; text-overflow: ellipsis; }
/* nella testata il logo a scritta ha la versione a icona per gli schermi piccoli */
.testata img.logo-icona { display: none; height: 30px; width: auto; }
@media (max-width: 575.98px) {
    .testata-home { font-size: 17px; padding: 6px 10px; }
    .testata-brand { font-size: 18px; }
    .testata-brand .logo { height: 28px; }
    img.logo-scritta { height: 28px; }
    .testata img.logo-scritta { display: none; }
    .testata img.logo-icona { display: block; }
    /* con il pulsante home già a icona, quella accanto al nome dell'entità sarebbe doppia */
    .testata .testata-home ~ .testata-brand .logo { display: none; }
}

/* ---------- Pagina di accesso: campi azzurro-titanio chiaro, pulsante blu titanio */
.login-card .form-control { background-color: var(--ti-100); border-color: var(--ti-300); color: var(--ti-900); }
.login-card .form-control:focus { background-color: var(--ti-50); border-color: var(--ti-500); box-shadow: 0 0 0 .25rem rgba(62, 92, 118, .22); }
.login-card .form-control:-webkit-autofill,
.login-card .form-control:-webkit-autofill:hover,
.login-card .form-control:-webkit-autofill:focus { -webkit-box-shadow: 0 0 0 1000px #e5ecf2 inset; -webkit-text-fill-color: #1b2733; }
.login-card .form-floating > label { color: var(--ti-700); }
.login-card .form-floating > label::after { background-color: transparent !important; } /* niente riquadro bianco dietro l'etichetta */
.login-card .form-check-input:checked { background-color: var(--ti-600); border-color: var(--ti-600); }
.login-card .form-check-input:focus { border-color: var(--ti-500); box-shadow: 0 0 0 .25rem rgba(62, 92, 118, .22); }
.btn-titanio { --bs-btn-color: #fff; --bs-btn-bg: var(--ti-600); --bs-btn-border-color: var(--ti-600);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--ti-700); --bs-btn-hover-border-color: var(--ti-700);
    --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--ti-800); --bs-btn-active-border-color: var(--ti-800);
    --bs-btn-focus-shadow-rgb: 62, 92, 118; font-weight: 600; }

.login-entita { color: var(--ti-700); }

/* marchio dell'app nella pagina di accesso */
.login-marchio { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--ti-700); font-weight: 800; }

/* piè di pagina (in tutte le pagine; nascosto nelle stampe dei QR) */
.footer { padding: 12px 0; border-top: 1px solid var(--gr-200); background: #fff; text-align: center; }
.footer-icona { height: 14px; width: auto; vertical-align: -2px; margin-right: 6px; }

/* ---------- swipe a sinistra su una riga (wwwroot/js/swipe-riga.js): il pulsante compare a destra della riga */
tr[data-swipe-form] { touch-action: pan-y; }
tr[data-swipe-form] > td { background-color: var(--bs-table-bg, #fff); position: relative; }
.swipe-cestino { position: absolute; z-index: 5; border: 0; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
    color: #fff; background: #b02a37; font-size: .72rem; line-height: 1; overflow: hidden; }
.swipe-cestino i { font-size: 1.35rem; }
.swipe-cestino span { white-space: nowrap; }
.swipe-cestino.swipe-archivia { background: var(--ti-600); }
.swipe-cestino.swipe-ripristina { background: #2f7d5b; }
