/* ----------------------------------------------------------------
   TEMA MANIERISMO BAROCCO - FOGLIO DI STILE MASTER
   ----------------------------------------------------------------
   Autore: Web Designer AI
   Versione: 2.0 (Aggiunta Viewer PDF)
*/

/* 1. IMPORTAZIONE FONT */
@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@400;700&family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400&display=swap');

/* 2. VARIABILI */
:root {
    /* Colori Principali */
    --gold-primary: #d4af37;
    --gold-dim: #8c7b50;
    --gold-glow: rgba(212, 175, 55, 0.4);
    
    /* Sfondi */
    --bg-dark: #0f0f12;
    --bg-card: rgba(20, 20, 25, 0.6);
    --bg-card-hover: rgba(25, 25, 30, 0.9);
    --bg-header: rgba(15, 15, 18, 0.8);
    --bg-input: rgba(0, 0, 0, 0.4);

    /* Testo */
    --text-main: #c5a059;
    --text-muted: #b0b0b0;
    --text-dark: #000000;

    /* Font */
    --font-display: 'Cinzel Decorative', cursive;
    --font-body: 'Cormorant Garamond', serif;
}

/* 3. RESET E BASE */
* {
    box-sizing: border-box;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 50% 0%, #2a2a2a 0%, var(--bg-dark) 60%),
        linear-gradient(0deg, #000000 0%, transparent 100%);
    overflow-x: hidden;
    font-size: 19px;
    line-height: 1.6;
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: #3a3a3a; border: 1px solid var(--gold-dim); }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

/* 4. TIPOGRAFIA */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    color: var(--gold-primary);
    font-weight: normal;
    margin-top: 0;
}

h1 {
    font-size: 3.5rem;
    text-shadow: 0 4px 10px rgba(0,0,0,0.8);
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

h2 { font-size: 2.2rem; margin-bottom: 20px; }
h3 { font-size: 1.6rem; border-bottom: 1px solid rgba(140, 123, 80, 0.2); padding-bottom: 15px; margin-bottom: 15px; }
p { color: var(--text-muted); margin-bottom: 20px; }
a { color: var(--gold-primary); text-decoration: none; }

/* 5. HEADER E NAVIGAZIONE */
header {
    text-align: center;
    padding: 60px 20px 40px;
    position: relative;
    border-bottom: 1px solid rgba(140, 123, 80, 0.2);
    background: var(--bg-header);
    backdrop-filter: blur(5px);
}

.subtitle {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--gold-dim);
    letter-spacing: 6px;
    text-transform: uppercase;
    margin-top: 10px;
}

/* Link di navigazione "Torna Indietro" (Sinistra) */
.back-nav {
    position: absolute;
    top: 30px;
    left: 40px;
    font-family: var(--font-display);
    color: var(--gold-dim);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0.7;
    z-index: 10;
}

.back-nav:hover {
    opacity: 1;
    color: var(--gold-primary);
    transform: translateX(-5px);
}

.back-nav::before {
    content: "←";
    font-size: 1.2rem;
}

/* Link di navigazione "Logout" (Destra) */
.logout-nav {
    position: absolute;
    top: 30px;
    right: 40px;
    font-family: var(--font-display);
    color: var(--gold-dim);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0.7;
    z-index: 10;
    cursor: pointer;
    border: none;
    background: transparent;
}

.logout-nav:hover {
    opacity: 1;
    color: #a00; /* Rosso scuro per indicare uscita */
    transform: translateX(5px);
}

.logout-nav::after {
    content: "⏻"; /* Simbolo Power o X */
    font-size: 1.2rem;
}

nav {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 30px;
    flex-wrap: wrap;
    opacity: 0.8;
}

nav a {
    color: var(--gold-dim);
    font-family: var(--font-display);
    font-size: 1rem;
    position: relative;
    padding-bottom: 5px;
}

nav a:hover { color: var(--gold-primary); }

/* 6. LAYOUT E GRIGLIA */
.main-content {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.portal-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-top: 40px;
}

@media (min-width: 700px) {
    .portal-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1100px) {
    .portal-grid { grid-template-columns: repeat(3, 1fr); }
}

.full-screen-center {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* 7. CARD */
.card, .login-box {
    background: var(--bg-card);
    border: 1px solid rgba(140, 123, 80, 0.3);
    position: relative;
}

.card {
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    height: 100%;
    cursor: default; 
}

.card::before, .login-box::before {
    content: "";
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: 1px solid transparent;
    background: 
        linear-gradient(to right, var(--gold-dim) 1px, transparent 1px) 0 0,
        linear-gradient(to bottom, var(--gold-dim) 1px, transparent 1px) 0 0,
        linear-gradient(to left, var(--gold-dim) 1px, transparent 1px) 100% 0,
        linear-gradient(to bottom, var(--gold-dim) 1px, transparent 1px) 100% 0,
        linear-gradient(to right, var(--gold-dim) 1px, transparent 1px) 0 100%,
        linear-gradient(to top, var(--gold-dim) 1px, transparent 1px) 0 100%,
        linear-gradient(to left, var(--gold-dim) 1px, transparent 1px) 100% 100%,
        linear-gradient(to top, var(--gold-dim) 1px, transparent 1px) 100% 100%;
    background-size: 15px 15px;
    background-repeat: no-repeat;
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.4s ease, background-size 0.4s ease;
}

.card:hover, .login-box:hover {
    background: var(--bg-card-hover);
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), 0 0 25px rgba(212, 175, 55, 0.2);
    border-color: rgba(212, 175, 55, 0.8);
}

.card:hover h3 {
    color: #fff;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.8);
    border-bottom-color: var(--gold-primary);
}

.card:hover::before, .login-box:hover::before {
    opacity: 1;
    background-size: 30px 30px;
}

.card-icon {
    font-size: 2.5rem;
    color: var(--gold-dim);
    margin-bottom: 15px;
    opacity: 0.8;
    transition: transform 0.5s ease;
}

.card:hover .card-icon {
    transform: scale(1.1);
    color: var(--gold-primary);
}

/* 8. LOGIN & FORM */
.login-box {
    padding: 50px;
    max-width: 500px;
    width: 100%;
    margin-top: 40px;
}

.quote-container {
    max-width: 700px;
    margin: 40px auto;
    text-align: center;
}

.quote-text {
    font-size: 1.4rem;
    font-style: italic;
    color: var(--text-muted);
    line-height: 1.6;
}

.quote-author {
    margin-top: 15px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--gold-dim);
}

.form-group {
    margin-bottom: 25px;
    text-align: left;
    position: relative;
}

.form-label {
    display: block;
    color: var(--gold-dim);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    font-family: var(--font-display);
    transition: color 0.3s ease;
}

.form-input {
    width: 100%;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid #444;
    border-bottom: 2px solid var(--gold-dim);
    color: var(--gold-primary);
    font-family: var(--font-body);
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--gold-primary);
    background: rgba(0,0,0,0.6);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.1);
}

.form-group:focus-within .form-label {
    color: var(--gold-primary);
    text-shadow: 0 0 5px var(--gold-glow);
}

/* Checkbox */
.form-options {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
    font-size: 0.9rem;
    color: #8c7b50;
    font-family: 'Cormorant Garamond', serif;
}

.checkbox-container { display: flex; align-items: center; cursor: pointer; user-select: none; }
.checkbox-input { display: none; }
.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 1px solid #8c7b50;
    margin-right: 10px;
    display: flex; /* Modificato per centrare il contenuto */
    align-items: center; /* Modificato per centrare verticalmente */
    justify-content: center; /* Modificato per centrare orizzontalmente */
    position: relative;
    transition: all 0.3s ease;
    background: rgba(0,0,0,0.3);
}
.checkbox-input:checked + .checkbox-custom { background: #d4af37; border-color: #d4af37; box-shadow: 0 0 10px rgba(212, 175, 55, 0.4); }
.checkbox-input:checked + .checkbox-custom::after {
    content: '⚜';
    color: #000;
    font-size: 14px;
    font-weight: bold;
}
.checkbox-label:hover { color: #d4af37; }


/* BUTTON STYLES */
.card-btn, .login-btn {
    padding: 12px 30px;
    border: 1px solid var(--gold-dim);
    background: transparent;
    font-family: var(--font-display);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--gold-dim);
    text-decoration: none;
    cursor: pointer;
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
    display: inline-block;
    min-width: 150px;
    text-align: center;
}

.login-btn { width: 100%; margin-top: 10px; }

.card-btn:hover, .login-btn:hover {
    background: var(--gold-primary);
    color: #000;
    border-color: var(--gold-primary);
    box-shadow: 0 0 15px var(--gold-glow);
}

.btn-loading {
    color: transparent !important;
    pointer-events: none;
    position: relative;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-top: -10px;
    margin-left: -10px;
    border: 2px solid var(--gold-dim);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 9. VIEWER PDF (Nuovo) */
.pdf-viewer {
    width: 100%;
    height: 800px;
    border: 1px solid var(--gold-dim);
    background: #1a1a1a;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
    margin-bottom: 30px;
}

/* Footer & Extras */
.ornament {
    font-size: 2rem;
    color: var(--gold-dim);
    margin: 20px 0;
    display: block;
    text-align: center;
}

footer {
    text-align: center;
    padding: 50px;
    border-top: 1px solid rgba(140, 123, 80, 0.2);
    margin-top: 80px;
    color: #555;
    font-size: 0.9rem;
}

/* RESPONSIVE */
@media (max-width: 600px) {
    h1 { font-size: 2.5rem; }
    .portal-grid { grid-template-columns: 1fr; gap: 30px; }
    .login-box { padding: 30px; }
    .back-nav { top: 20px; left: 20px; font-size: 0.8rem; }
    .logout-nav { top: 20px; right: 20px; font-size: 0.8rem; }
    header { padding-top: 80px; }
    .pdf-viewer { height: 500px; } /* Meno alto su mobile */
}