/* --- START OF FILE css/app_shell.css (Blocco Body e Background) --- */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    color: #333;
    background-color: #0f2027;
    
    /* Il body occupa sempre e solo lo schermo fisico */
    width: 100vw;
    height: 100vh;
    overflow: hidden; 
    
    /* Forza il centraggio orizzontale del wrapper scalato */
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

#scaler-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
    overflow: hidden; 
    transform-origin: top center;
}

#vanta-bg {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100vw; 
    height: 100vh; 
    z-index: -2; 
    pointer-events: none;
    transform: none !important; /* Impedisce distorsioni dello sfondo vanta */
}

#bg-watermark {
    position: fixed;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 85vmin;
    max-width: 700px;
    height: auto;
    z-index: -1;
    opacity: 0.4;
    filter: blur(4px) grayscale(30%);
    mix-blend-mode: overlay;
    pointer-events: none;
}

main.container {
    display: flex;
    flex-direction: column;
    justify-content: center; /* Centra verticalmente (utile per login) */
    align-items: center;     /* Centra orizzontalmente */
    min-height: 100%;
    width: 100%;
    padding: 15px;
    box-sizing: border-box;
    position: relative;
    z-index: 5;
    perspective: 1000px;
}
/* Nasconde scrollbar per pulizia estetica */
#scaler-wrapper::-webkit-scrollbar {
    display: none;
}

.header {
    background-color: rgba(15, 32, 39, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    padding: 5px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
    overflow: visible !important;  /* ← aggiunta */
}

.header-center {
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

#header-logo {
    height: 75px;
    width: auto;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.6));
    animation: loginEntrance 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.header-text-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header h1 {
    margin: 0;
    font-family: 'Cinzel', serif;
    font-weight: 900;
    font-size: 1.6rem;
    letter-spacing: 4px;
    text-transform: uppercase;
    line-height: 1.1;
    background: linear-gradient(to bottom, #ffffff 10%, #bdc3c7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0px 4px 10px rgba(0, 0, 0, 0.6);
    animation: focus-in-expand 1s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
}

.header .motto {
    margin: 2px 0 0 0;
    font-family: 'Cinzel', serif;
    font-weight: 400;
    font-size: 0.8rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #c5a059;
    opacity: 0;
    animation: focus-in-expand 1s cubic-bezier(0.250, 0.460, 0.450, 0.940) 1s both;
}

#structure-name {
    position: absolute;
    left: 80px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 0.9rem;
    color: #c5a059;
    text-transform: none;
    max-width: 500px;
    letter-spacing: 0.5px;
    z-index: 20;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 900px) {
    #structure-name {
        display: none !important;
    }
}

#install-button {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(197, 160, 89, 0.1);
    color: #c5a059;
    border: 1px solid #c5a059;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 30;
    transition: all 0.3s ease;
    display: none;
    align-items: center;
    justify-content: center;
    padding-bottom: 3px;
}

#install-button:hover {
    background-color: #c5a059;
    color: #0f2027;
    box-shadow: 0 0 15px rgba(197, 160, 89, 0.6);
    transform: translateY(-50%) scale(1.1);
}

#user-display-name {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 0.9rem;
    color: #c5a059;
    text-transform: none;
    margin-right: 15px;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.user-info {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: row;
    align-items: center;
    z-index: 20;
    gap: 15px;
}

.theme-switch-mag {
  width: 145px !important; /* Allargato per ospitare i testi lunghi */
  height: 36px !important;
  border-radius: 10px !important;
  cursor: pointer;
  transition: all 0.3s ease;
  background: linear-gradient(to right, #77530a, #ffd277, #77530a, #77530a, #ffd277, #77530a) !important;
  background-size: 250% !important;
  background-position: left !important;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4) !important;
}

.theme-switch-mag:hover {
  background-position: right !important;
  box-shadow: 0 0 20px rgba(255, 210, 119, 0.4) !important;
}

.theme-switch-inner {
  width: calc(100% - 4px) !important;
  height: calc(100% - 4px) !important;
  border-radius: 8px !important;
  background-color: #141e30 !important; /* Default: Blu Notte */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #ffd277 !important;
  font-weight: 700;
  font-family: 'Cinzel', serif;
  font-size: 0.8rem !important;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* EFFETTO TRANSIZIONE CROMATICA INTERNA */
/* Quando siamo in Dark (default), l'hover mostra il Glaciale */
body:not(.glacial-theme) .theme-switch-mag:hover .theme-switch-inner {
    background-color: #b3e5fc !important; /* Colore Icy/Glaciale */
    color: #141e30 !important; /* Testo scuro per contrasto su ghiaccio */
}

body:not(.glacial-theme) .theme-switch-mag:hover .theme-icon-svg {
    stroke: #141e30 !important;
}

/* Quando saremo in Glacial, l'hover mostrerà il Dark */
body.glacial-theme .theme-switch-mag:hover .theme-switch-inner {
    background-color: #141e30 !important;
    color: #ffd277 !important;
}

.theme-icon-svg {
  width: 14px !important;
  height: 14px !important;
  stroke: #ffd277;
  transition: all 0.4s ease;
}

.theme-switch-mag:hover .theme-icon-svg {
  transform: rotate(45deg) scale(1.1);
}
/* --- Styling Logout Luxury (Cornice Oro e Cuore Blu) --- */
.logout-mag-gold {
  width: 110px !important;
  height: 36px !important;
  border-radius: 10px !important;
  cursor: pointer;
  transition: all 0.3s ease;
  /* GRADIENTE ORO METALLICO ESTERNO */
  background: linear-gradient(to right, #77530a, #ffd277, #77530a, #77530a, #ffd277, #77530a) !important;
  background-size: 250% !important;
  background-position: left !important;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4) !important;
}

.logout-mag-gold:hover {
  background-position: right !important;
  box-shadow: 0 0 20px rgba(255, 210, 119, 0.4) !important;
  transform: translateY(-1px);
}

.logout-mag-inner {
  width: calc(100% - 4px) !important;
  height: calc(100% - 4px) !important;
  border-radius: 8px !important;
  /* BLU ISTITUZIONALE INTERNO (Match headers tabelle) */
  background-color: #141e30 !important; 
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #ffd277 !important; /* Testo Oro Chiaro */
  font-weight: 700;
  font-family: 'Cinzel', serif;
  font-size: 0.8rem !important;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: background-color 0.3s ease;
}

.logout-mag-inner svg {
  width: 16px !important;
  height: 16px !important;
  fill: #ffd277 !important; /* Omino Oro */
}

.logout-mag-gold:hover .logout-mag-inner {
  background-color: #1c2a38 !important; /* Schiarisce leggermente il blu all'hover */
}

/* Badge utente header */
#user-badge-header {
    font-size: 0.8rem !important;
    width: auto !important;
    max-width: none !important;
    cursor: default !important;
    pointer-events: auto !important;
}
#user-badge-header .logout-mag-inner {
    width: calc(100% - 2px) !important;
    height: calc(100% - 2px) !important;
    border-radius: 9px !important;
}
#user-badge-header:hover {
    transform: translateY(-50%) translateY(-1px) !important;
    box-shadow: 0 0 20px rgba(255, 210, 119, 0.4) !important;
}

/* Pulizia residui vecchi test */
#logout-button, .logout-profile, .logout-profile-blue { display: none !important; }

.tabs-container {
    display: flex;
    justify-content: center;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.2);
    margin-bottom: 15px;
    position: relative;
    z-index: 5;
}

.tab-button {
    padding: 10px 15px;
    border: none;
    background-color: transparent;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.4s ease;
    flex: 1;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.tab-button.active {
    color: #fff;
    border-bottom: 2px solid #4a90e2;
    background-color: rgba(255, 255, 255, 0.05);
    text-shadow: 0 0 15px rgba(74, 144, 226, 0.8);
}

.card {
    background: rgba(13, 20, 30, 0.75);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 15px;
    /* Applicazione bordo identico al Centro di Comando */
    border: 2px solid #c5a059 !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    color: #fff;
    transition: transform 0.3s ease;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform-style: preserve-3d;
    box-sizing: border-box;
}

.card:hover {
    transform: translateY(-2px);
}

.card.signed {
    border-left: 3px solid #f39c12;
}

.card.approved {
    border-left: 3px solid #27ae60;
}

.card h2,
.card h3 {
    margin: 0 0 10px 0;
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card p {
    margin: 5px 0 15px 0;
    color: #b0bec5;
    font-size: 0.9rem;
    line-height: 1.4;
}

.login-card {
    text-align: center;
    margin-top: 30px;
    /* Per il login manteniamo un limite per estetica */
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.login-card input,
.login-card select {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 0.9rem;
    color: #fff;
    transition: all 0.3s ease;
}

.login-card input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.login-card input:focus {
    outline: none;
    background: rgba(0, 0, 0, 0.5);
    border-color: #4a90e2;
    box-shadow: 0 0 25px rgba(74, 144, 226, 0.2);
}

.login-card div[style*=\"border-top\"] {
    margin-top: 25px !important;
    padding-top: 15px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.link-secondary {
    color: #90caf9;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: color 0.3s;
}

.link-secondary:hover {
    color: #fff;
    text-shadow: 0 0 10px rgba(144, 202, 249, 0.8);
}

.btn-approve {
    background-color: #27ae60;
    color: white;
    border: none;
    padding: 14px;
    width: 100%;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 15px;
    letter-spacing: 1px;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.btn-approve:hover {
    background-color: #2ecc71;
    transform: translateY(-1px);
}

.btn-approve:disabled {
    background-color: #7f8c8d;
    cursor: not-allowed;
    opacity: 0.6;
}

#loading {
    text-align: center;
    margin-top: 50px;
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Cinzel', serif;
    letter-spacing: 2px;
    font-size: 1rem;
}

.empty-state {
    background-color: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.6);
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    font-style: italic;
    border: 1px solid rgba(255, 255, 255, 0.05);
    max-width: 800px; /* Limite per messaggio home */
    margin-left: auto;
    margin-right: auto;
}

.pdf-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.pdf-modal-content {
    background: #1c2a38;
    width: 95%;
    height: 90%;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pdf-modal-header {
    padding: 12px;
    text-align: right;
    background: #121b24;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.pdf-embed-container {
    flex-grow: 1;
    background: #2c3e50;
}

.pdf-embed-container embed {
    width: 100%;
    height: 100%;
}

.pdf-modal-close-btn {
    background: #c0392b;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 6px;
    transition: 0.3s;
}

.pdf-modal-close-btn:hover {
    background: #e74c3c;
}

@keyframes loginEntrance {
    0% {
        opacity: 0;
        transform: scale(0.9);
        filter: blur(4px);
    }

    100% {
        opacity: 1;
        transform: scale(1);
        filter: blur(0px);
    }
}

.animate-entrance {
    animation: loginEntrance 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    will-change: transform, opacity, filter;
}

@keyframes focus-in-expand {
    0% {
        letter-spacing: -0.5em;
        filter: blur(12px);
        opacity: 0;
    }

    100% {
        filter: blur(0px);
        opacity: 1;
    }
}

@keyframes flip-2-hor-bottom-2 {
    0% {
        transform: translateY(0) rotateX(0);
        transform-origin: 50% 100%;
        opacity: 1;
    }

    100% {
        transform: translateY(100%) rotateX(-180deg);
        transform-origin: 50% 100%;
        opacity: 0;
    }
}

.flip-exit-bottom {
    animation: flip-2-hor-bottom-2 0.6s cubic-bezier(0.455, 0.030, 0.515, 0.955) both;
}

@keyframes flip-2-ver-left-2 {
    0% {
        transform: translateX(0) rotateY(0);
        transform-origin: 0% 50%;
        opacity: 1;
    }

    100% {
        transform: translateX(-100%) rotateY(-180deg);
        transform-origin: 0% 50%;
        opacity: 0;
    }
}

.flip-exit-left {
    animation: flip-2-ver-left-2 0.6s cubic-bezier(0.455, 0.030, 0.515, 0.955) both;
}

@-webkit-keyframes flip-vertical-bck {
    0% {
        -webkit-transform: translateZ(0) rotateY(0);
        transform: translateZ(0) rotateY(0);
        opacity: 1;
    }

    100% {
        -webkit-transform: translateZ(-260px) rotateY(-180deg);
        transform: translateZ(-260px) rotateY(-180deg);
        opacity: 0;
    }
}

@keyframes flip-vertical-bck {
    0% {
        -webkit-transform: translateZ(0) rotateY(0);
        transform: translateZ(0) rotateY(0);
        opacity: 1;
    }

    100% {
        -webkit-transform: translateZ(-260px) rotateY(-180deg);
        transform: translateZ(-260px) rotateY(-180deg);
        opacity: 0;
    }
}

.flip-exit-vertical {
    animation: flip-vertical-bck 0.6s cubic-bezier(0.455, 0.030, 0.515, 0.955) both;
}

@keyframes slide-out-bck-center {
    0% {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        opacity: 1;
    }

    100% {
        -webkit-transform: translateZ(600px);
        transform: translateZ(600px);
        opacity: 0;
    }
}

.animate-login-exit {
    animation: slide-out-bck-center 0.5s cubic-bezier(0.550, 0.085, 0.680, 0.530) both;
}

/* Regola universale per nascondere le barre di scorrimento su tutti i browser,
   mantenendo la piena funzionalità di scorrimento (mouse, touch, tastiera). */

/* Per browser basati su Webkit (Chrome, Safari, Edge, Opera) */
::-webkit-scrollbar {
    width: 0px;
    height: 0px;
    background: transparent; /* Fallback per browser più vecchi */
    display: none;
}

/* Per Firefox */
* {
    scrollbar-width: none;
}

/* Per Internet Explorer e versioni legacy di Edge */
* {
    -ms-overflow-style: none;
}

:fullscreen body {
    background-color: #050a10 !important;
}

:fullscreen #scaler-wrapper {
    height: 100vh !important;
    width: 100vw !important;
}

/* Supporto per browser Webkit (Safari/Chrome Mobile) */
:-webkit-full-screen #scaler-wrapper {
    height: 100vh !important;
    width: 100vw !important;
}






