/* ===================================================================
   FILE: css/legal_pages.css
   Stili per pagine legali (Privacy, Termini, Cookie, Compliance)
   =================================================================== */

/* ========== RESET E BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.7;
    color: #333;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 0;
    margin: 0;
}

/* ========== CONTAINER PRINCIPALE ========== */
.legal-container {
    max-width: 1200px;
    margin: 40px auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* ========== HEADER ========== */
.legal-header {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    padding: 40px 50px;
    position: relative;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 20px;
    transition: color 0.2s;
}

.back-link:hover {
    color: #fff;
}

.legal-header h1 {
    font-size: 32px;
    margin-bottom: 10px;
    font-weight: 600;
}

.legal-header h1 i {
    margin-right: 12px;
}

.subtitle {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 15px;
}

.last-update {
    font-size: 13px;
    opacity: 0.8;
    border-top: 1px solid rgba(255,255,255,0.2);
    padding-top: 15px;
    margin-top: 15px;
}

/* ========== TABLE OF CONTENTS (INDICE) ========== */
.legal-toc {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 25px 50px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.legal-toc h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: #495057;
}

.legal-toc h3 i {
    margin-right: 8px;
}

.legal-toc ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 10px;
}

.legal-toc li {
    margin: 0;
}

.legal-toc a {
    color: #495057;
    text-decoration: none;
    font-size: 14px;
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.legal-toc a:hover {
    background: #e9ecef;
    color: #212529;
    transform: translateX(5px);
}

/* ========== CONTENUTO ========== */
.legal-content {
    padding: 50px;
}

.legal-content section {
    margin-bottom: 50px;
    scroll-margin-top: 80px; /* Per sticky TOC */
}

.legal-content h2 {
    font-size: 26px;
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid #2563eb;
    display: flex;
    align-items: center;
    gap: 12px;
}

.legal-content h2 i {
    color: #2563eb;
}

.legal-content h3 {
    font-size: 20px;
    color: #34495e;
    margin-top: 30px;
    margin-bottom: 15px;
}

.legal-content h4 {
    font-size: 17px;
    color: #555;
    margin-top: 20px;
    margin-bottom: 10px;
}

.legal-content p {
    margin-bottom: 15px;
    text-align: justify;
}

.legal-content ul,
.legal-content ol {
    margin: 15px 0;
    padding-left: 30px;
}

.legal-content li {
    margin-bottom: 10px;
}

/* ========== INFO BOX ========== */
.info-box {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 40px 30px; /* Aumentato padding */
    margin: 20px 0;
    border-radius: 6px;
    display: block; /* Layout verticale */
}

.info-box p {
    margin-bottom: 8px;
}

.info-box strong {
    color: #1976d2;
}

.warning-box {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 40px 30px; /* Aumentato padding */
    margin: 20px 0;
    border-radius: 6px;
    display: block; /* Layout verticale invece di flex */
}

.warning-box i.fa-exclamation-triangle {
    /* Icona nel titolo - gestita inline */
}

.warning-box strong {
    color: #f57c00;
}

/* ========== TABELLE ========== */
.legal-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

.legal-table thead {
    background: #2563eb;
    color: white;
}

.legal-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.legal-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #dee2e6;
}

.legal-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.legal-table tbody tr:hover {
    background: #e9ecef;
}

/* Badge tabelle */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-required {
    background: #fee;
    color: #c33;
}

.badge-optional {
    background: #d4edda;
    color: #155724;
}

/* ========== GRID LAYOUTS ========== */
.rights-grid,
.features-grid,
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.right-card,
.feature-card,
.contact-card {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s;
}

.right-card:hover,
.feature-card:hover,
.contact-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border-color: #2563eb;
}

.right-card i,
.feature-card i,
.contact-card i {
    font-size: 40px;
    color: #2563eb;
    margin-bottom: 15px;
}

.right-card h3,
.feature-card h3,
.contact-card h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #2c3e50;
}

.right-card p,
.feature-card p,
.contact-card p {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 15px;
}

.btn-right {
    display: inline-block;
    padding: 10px 20px;
    background: #2563eb;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-right:hover {
    background: #5568d3;
}

.contact-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

.contact-link:hover {
    text-decoration: underline;
}

.contact-card small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #6c757d;
}

/* ========== DEFINIZIONI ========== */
.definitions-list {
    margin: 20px 0;
}

.definitions-list dt {
    font-weight: 600;
    color: #2c3e50;
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.definitions-list dt i {
    color: #2563eb;
    font-size: 12px;
}

.definitions-list dd {
    margin-left: 25px;
    margin-top: 5px;
    color: #555;
}

/* ========== LISTE SPECIALI ========== */
.forbidden-list li,
.allowed-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}

.forbidden-list i {
    color: #e74c3c;
    font-size: 18px;
    flex-shrink: 0;
}

.allowed-list i {
    color: #27ae60;
    font-size: 18px;
    flex-shrink: 0;
}

/* ========== CHECKLIST ========== */
.checklist {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.checklist label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 15px;
}

.checklist input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

/* ========== ROLE DATA BOXES ========== */
.role-data {
    background: #f8f9fa;
    border-left: 4px solid #2563eb;
    padding: 20px;
    margin: 15px 0;
    border-radius: 6px;
}

.role-data h4 {
    color: #2563eb;
    margin-bottom: 10px;
}

/* ========== FOOTER ========== */
.legal-footer-page {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 30px;
}

.legal-footer-page p {
    margin-bottom: 10px;
}

.legal-footer-page a {
    color: #3498db;
    text-decoration: none;
}

.legal-footer-page a:hover {
    text-decoration: underline;
}

.copyright {
    font-size: 13px;
    opacity: 0.7;
    margin-top: 15px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .legal-container {
        margin: 20px 10px;
        border-radius: 8px;
    }
    
    .legal-header,
    .legal-content,
    .legal-toc {
        padding: 25px 20px;
    }
    
    .legal-header h1 {
        font-size: 24px;
    }
    
    .legal-content h2 {
        font-size: 22px;
    }
    
    .legal-toc ul {
        grid-template-columns: 1fr;
    }
    
    .rights-grid,
    .features-grid,
    .contact-grid {
        grid-template-columns: 1fr;
    }
    
    .legal-table {
        font-size: 13px;
    }
    
    .legal-table th,
    .legal-table td {
        padding: 10px 8px;
    }
}

@media (max-width: 480px) {
    .legal-header h1 {
        font-size: 20px;
    }
    
    .legal-content {
        padding: 20px 15px;
    }
    
    .legal-content h2 {
        font-size: 20px;
    }
    
    .legal-content h3 {
        font-size: 18px;
    }
}

/* ========== PRINT STYLES ========== */
@media print {
    .back-link,
    .legal-toc,
    .btn-right {
        display: none !important;
    }
    
    .legal-container {
        box-shadow: none;
        margin: 0;
    }
    
    .legal-header {
        background: #2563eb !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    section {
        page-break-inside: avoid;
    }
}

/* ========== CLASSI AGGIUNTIVE PER PRIVACY/COOKIE/TERMINI ========== */

/* Tabella conservazione dati */
.conservation-table {
    margin: 25px 0;
    overflow-x: auto;
}

.conservation-table table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border-radius: 8px;
    overflow: hidden;
}

.conservation-table thead {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
}

.conservation-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.conservation-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    font-size: 14px;
}

.conservation-table tr:last-child td {
    border-bottom: none;
}

.conservation-table tbody tr:hover {
    background: #f8f9fa;
}

/* Box finalità */
.finalita-box {
    background: #f8f9fa;
    border-left: 4px solid #2563eb;
    padding: 20px;
    margin: 20px 0;
    border-radius: 8px;
}

.finalita-box h4 {
    color: #2563eb;
    margin-bottom: 10px;
    font-size: 18px;
}

.finalita-box p {
    margin: 8px 0;
    font-size: 14px;
    color: #6c757d;
}

.finalita-box ul {
    margin: 10px 0;
    padding-left: 25px;
}

.finalita-box ul li {
    margin: 5px 0;
}

/* Grid diritti utente */
.rights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 25px 0;
}

.right-box {
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
}

.right-box:hover {
    border-color: #2563eb;
    box-shadow: 0 5px 20px rgba(37, 99, 235, 0.1);
    transform: translateY(-3px);
}

.right-box i {
    font-size: 36px;
    color: #2563eb;
    margin-bottom: 15px;
    display: block;
}

.right-box h4 {
    color: #333;
    margin-bottom: 10px;
    font-size: 18px;
}

.right-box p {
    color: #6c757d;
    font-size: 14px;
    line-height: 1.6;
}

/* Grid contatti */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin: 25px 0;
}

.contact-box {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 25px;
    border: 1px solid #dee2e6;
}

.contact-box h4 {
    color: #2563eb;
    margin-bottom: 15px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.contact-box h4 i {
    font-size: 20px;
}

.contact-box p {
    margin: 8px 0;
    font-size: 14px;
    color: #495057;
}

.contact-box a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.contact-box a:hover {
    text-decoration: underline;
}

/* Tabella cookie */
.cookie-table {
    margin: 25px 0;
    overflow-x: auto;
}

.cookie-table table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border-radius: 8px;
    overflow: hidden;
}

.cookie-table thead {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.cookie-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.cookie-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    font-size: 14px;
}

.cookie-table code {
    background: #f1f3f5;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #d97706;
}

/* Grid browser */
.browser-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 25px 0;
}

.browser-box {
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.browser-box:hover {
    border-color: #2563eb;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.browser-box h4 {
    color: #333;
    margin-bottom: 12px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.browser-box h4 i {
    font-size: 24px;
}

.browser-box p {
    color: #6c757d;
    font-size: 14px;
    margin-bottom: 15px;
}

.browser-box a {
    display: inline-block;
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
}

.browser-box a:hover {
    text-decoration: underline;
}

/* Grid ruoli (termini) */
.role-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.role-box {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-left: 4px solid #2563eb;
    padding: 15px;
    border-radius: 8px;
}

.role-box h4 {
    color: #2563eb;
    margin-bottom: 8px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.role-box p {
    font-size: 13px;
    color: #6c757d;
}

/* Note informativa */
.note {
    background: #e7f3ff;
    border-left: 4px solid #0066cc;
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 6px;
    font-size: 14px;
    color: #004085;
}

.note i {
    color: #0066cc;
    margin-right: 8px;
}

/* Success box */
.success-box {
    background: #d4edda;
    border-left: 4px solid #28a745;
    padding: 20px;
    margin: 20px 0;
    border-radius: 8px;
    color: #155724;
}

.success-box i {
    color: #28a745;
    margin-right: 8px;
    font-size: 18px;
}

.success-box p {
    margin: 8px 0;
    font-size: 14px;
}

.success-box ul {
    margin: 10px 0;
    padding-left: 25px;
}

/* Responsive aggiuntivo */
@media (max-width: 768px) {
    .rights-grid,
    .contact-grid,
    .browser-grid,
    .role-grid {
        grid-template-columns: 1fr;
    }
    
    .conservation-table,
    .cookie-table {
        font-size: 12px;
    }
    
    .conservation-table th,
    .conservation-table td,
    .cookie-table th,
    .cookie-table td {
        padding: 8px 10px;
    }
}

/* ========== CLASSI AGGIUNTIVE PER LAYOUT DOPPIA TITOLARITÀ ========== */

/* Box introduzione DPA/Privacy con layout verticale pulito */
.warning-box h2,
.info-box h2 {
    margin: 0 0 20px 0 !important;
    text-align: center;
    font-size: 26px !important;
    color: inherit;
    border: none !important;
    padding: 0 !important;
}

.warning-box > p:first-of-type,
.info-box > p:first-of-type {
    text-align: left;
    margin: 0 0 45px 0;
    font-size: 17px;
    line-height: 1.6;
}

/* Card interne ai box */
.card-titolare,
.card-responsabile {
    padding: 30px;
    border-radius: 12px;
    border: 2px solid;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
}

.card-titolare h3,
.card-responsabile h3 {
    margin: 0 0 18px 0;
    text-align: left;
    font-size: 22px;
    font-weight: bold;
}

.card-titolare ul,
.card-responsabile ul {
    text-align: left;
    padding-left: 25px;
    font-size: 15px;
    line-height: 2;
}

/* Responsive per card */
@media (max-width: 768px) {
    .warning-box,
    .info-box {
        padding: 30px 20px;
    }
    
    .warning-box h2,
    .info-box h2 {
        font-size: 22px !important;
    }
    
    .warning-box > p:first-of-type,
    .info-box > p:first-of-type {
        font-size: 15px;
        margin-bottom: 30px;
    }
}
