/* === FORMULARIO 2025 - STUDIO CATALDI === */

/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1e3a8a;
    --primary-dark: #1e293b;
    --accent-color: #dc2626;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-gray: #f3f4f6;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography per atti legali */
.legal-text {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 1.125rem;
    line-height: 1.8;
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.container-narrow {
    max-width: 900px;
}

/* Skip Link (Accessibilità) */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 0 0 0.25rem 0;
    z-index: 1000;
}

.skip-link:focus {
    top: 0;
}

/* Header */
header {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

/* Logo text-based */
.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--primary-dark);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.logo-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-left: 0.5rem;
    padding-left: 0.5rem;
    border-left: 1px solid var(--border-color);
}

/* Navigation */
.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
    align-items: center;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    font-size: 0.9375rem;
}

.nav-links a:hover {
    color: var(--primary-color);
}

.nav-links .active {
    color: var(--primary-color);
    position: relative;
}

.nav-links .active::after {
    content: '';
    position: absolute;
    bottom: -1.5rem;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--primary-color);
}

/* Mobile Menu */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
}

/* Main Content */
main {
    flex: 1;
    padding: 2rem 0 4rem;
}

/* Breadcrumb */
.breadcrumb {
    margin-bottom: 2rem;
    padding: 0.75rem 0;
}

.breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.breadcrumb li::after {
    content: "/";
    margin-left: 0.5rem;
    color: var(--text-muted);
}

.breadcrumb li:last-child::after {
    display: none;
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* Document Header */
.document-header {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.document-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.document-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Action Bar */
.action-bar {
    background-color: var(--bg-gray);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
}

.btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
}

.btn:hover {
    background-color: var(--bg-gray);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* Document Content */
.document-container {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.document-content {
    padding: 3rem;
}

/* Stili per l'atto */
.atto-header {
    text-align: center;
    margin-bottom: 3rem;
}

.tribunale, .intestazione-tribunale, .intestazione-suprema, .intestazione-autorita {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tipo-atto {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.atto-section {
    margin-bottom: 2rem;
}

.atto-section h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.atto-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--primary-dark);
}

.atto-section p {
    margin-bottom: 0.75rem;
}

.formula-text {
    background-color: var(--bg-secondary);
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem;
    margin: 1rem 0;
    border-radius: 0 0.375rem 0.375rem 0;
}

.formula-text p {
    margin-bottom: 0.5rem;
}

.formula-text p:last-child {
    margin-bottom: 0;
}

.nota-bene {
    background-color: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 0.375rem;
    padding: 1rem;
    margin: 1rem 0;
    font-size: 0.875rem;
}

.nota-bene strong {
    color: #d97706;
}

/* Content Wrapper */
.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    align-items: start;
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 5rem;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar::-webkit-scrollbar {
    display: none;
}

.sidebar-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.sidebar-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary-dark);
}

.sidebar-card ul {
    list-style: none;
    padding: 0;
}

.sidebar-card li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--bg-gray);
}

.sidebar-card li:last-child {
    border-bottom: none;
}

.sidebar-card a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    display: block;
    transition: color 0.2s;
}

.sidebar-card a:hover {
    color: var(--primary-color);
}

/* Intro Section */
.intro-section {
    margin-bottom: 2rem;
}

.lead {
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* Alert Boxes */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    margin: 1.5rem 0;
}

.alert-info {
    background-color: #e0f2fe;
    border: 1px solid #0284c7;
    color: #075985;
}

.alert-warning {
    background-color: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
}

.alert-danger {
    background-color: #fee2e2;
    border: 1px solid #ef4444;
    color: #991b1b;
}

.alert-success {
    background-color: #d1fae5;
    border: 1px solid #10b981;
    color: #065f46;
}

.alert ul {
    margin: 0.5rem 0 0 1.5rem;
    padding: 0;
}

.alert strong {
    display: block;
    margin-bottom: 0.5rem;
}

/* Guide Section */
.guide-section {
    margin-top: 3rem;
    padding-top: 3rem;
    border-top: 2px solid var(--border-color);
}

.guide-section h2 {
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
}

.guide-section h3 {
    color: var(--primary-color);
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.guide-section h4 {
    color: var(--text-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.guide-content {
    line-height: 1.7;
}

.guide-content ul, .guide-content ol {
    margin-left: 2rem;
    line-height: 1.8;
}

.guide-content li {
    margin-bottom: 0.5rem;
}

/* Tables */
.table-contributo, .table-termini, .table-bordered {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.table-contributo th, .table-contributo td,
.table-termini th, .table-termini td,
.table-bordered th, .table-bordered td {
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    text-align: left;
}

.table-contributo th, .table-termini th, .table-bordered th {
    background-color: var(--bg-gray);
    font-weight: 600;
}

.table-contributo tr:nth-child(even),
.table-striped tbody tr:nth-child(odd) {
    background-color: var(--bg-secondary);
}

/* Box Informativi */
.info-box, .motivo-box {
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

.motivo-box {
    border-left: 4px solid var(--primary-color);
}

.info-box h4, .motivo-box h4 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: var(--primary-dark);
}

/* Disclaimer */
.disclaimer {
    background-color: #fef2f2;
    border: 1px solid #ef4444;
    color: #991b1b;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-top: 2rem;
}

/* Footer */
footer {
    background-color: var(--primary-dark);
    color: #e5e7eb;
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: white;
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #d1d5db;
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #374151;
    color: #9ca3af;
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
        order: -1;
    }
}

@media (max-width: 768px) {
    /* Layout principale mobile */
    .content-wrapper {
        display: flex !important;
        flex-direction: column !important;
        overflow: visible !important;
        height: auto !important;
    }
    
    .main-content {
        order: -1 !important;
        width: 100% !important;
    }
    
    .sidebar {
        order: 1 !important;
        width: 100% !important;
        margin-top: 3rem !important;
        margin-bottom: 100px !important;
        padding-bottom: 120px !important;
        position: static !important;
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
    }
    
    main {
        overflow: visible !important;
        height: auto !important;
        min-height: auto !important;
    }
    
    body {
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }
    
    .footer, footer {
        position: relative !important;
    }
    
    /* Navigazione mobile */
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--bg-primary);
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--shadow-md);
        border-bottom: 1px solid var(--border-color);
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .nav-links.active {
        display: flex;
    }
    
    .nav-links .active::after {
        display: none;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .logo-subtitle {
        display: none;
    }
    
    /* Adattamenti contenuto */
    .document-title {
        font-size: 1.5rem;
    }
    
    .document-content {
        padding: 1.5rem;
    }
    
    .document-meta {
        gap: 1rem;
        font-size: 0.75rem;
    }
    
    .action-bar {
        justify-content: center;
    }
    
    .action-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
	
	
	/* Aggiungi queste righe nella media query mobile */
html {
    overflow-x: hidden !important;
    overflow-y: visible !important;
}

.container {
    min-height: auto !important;
    height: auto !important;
}

/* Forza tutto il contenuto a essere visibile */
* {
    max-height: none !important;
    overflow: visible !important;
}

		
}


/* Eccezione solo per la sidebar su desktop che deve mantenere lo scroll */
@media (min-width: 769px) {
    .sidebar {
        max-height: calc(100vh - 6rem) !important;
        overflow-y: auto !important;
    }
}


@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .document-header {
        padding: 1rem;
    }
    
    .document-content {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .table-contributo, .table-termini {
        font-size: 0.875rem;
    }
    
    .table-contributo th, .table-contributo td,
    .table-termini th, .table-termini td {
        padding: 0.5rem;
    }
}

/* Print Styles */
@media print {
    header, footer, .action-bar, .sidebar, .breadcrumb, 
    .guide-section, .disclaimer, .intro-section {
        display: none !important;
    }
    
    body {
        background-color: white;
    }
    
    .content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .document-container {
        box-shadow: none;
        border: none;
    }
    
    .document-content {
        padding: 0;
    }
    
    .legal-text {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    .atto-section {
        page-break-inside: avoid;
    }
    
    .atto-section[style*="page-break-before"] {
        page-break-before: always;
    }
    
    .alert, .nota-bene {
        border: 2px solid #000 !important;
        padding: 0.5rem !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .nota-bene {
        background-color: #f0f0f0 !important;
    }
    
    .info-box {
        border: 2px solid #000 !important;
        background-color: #f9f9f9 !important;
    }
}

/* Loading Spinner */
.spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.hidden { display: none; }
.font-bold { font-weight: 600; }
.text-small { font-size: 0.875rem; }
.text-muted { color: var(--text-secondary); }

/* Focus Styles per Accessibilità */
a:focus, button:focus, input:focus, textarea:focus, select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Animazioni */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Evidenziazione Campi */
.highlight-field {
    background-color: #fef3c7;
    transition: background-color 0.3s ease;
}