/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background-color: #e9ecef;
    color: #212529;
    font-size: 14px;
    line-height: 1.5;
}

/* Header */
.header {
    background-color: #515963;
    color: white;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 50px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.menu-toggle {
    cursor: pointer;
    font-size: 20px;
    padding: 5px;
}

.menu-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.logo {
    font-weight: bold;
    font-size: 16px;
    letter-spacing: 1px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    font-size: 14px;
    color: #dee2e6;
}

.header-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 14px;
}

.header-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 50px;
    bottom: 0;
    width: 200px;
    background-color: #2c3136;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 999;
}

.sidebar.collapsed {
    transform: translateX(-200px);
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #2c3136;
    z-index: 1000;
    border-top: 1px solid #495057;
    padding: 5px 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.mobile-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 100%;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 5px;
    color: #dee2e6;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 0;
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
    color: #007bff;
    background: rgba(0, 123, 255, 0.1);
}

.mobile-nav-icon {
    font-size: 20px;
    margin-bottom: 2px;
}

.mobile-nav-text {
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

@media (max-width: 768px) {

    /* Hide desktop sidebar on mobile */
    .sidebar {
        display: none;
    }

    /* Show mobile bottom navigation */
    .mobile-bottom-nav {
        display: block;
    }

    /* Adjust main content for bottom nav */
    .main-content {
        margin-left: 0;
        padding-bottom: 100px;
        /* Increased even more for bottom nav */
    }

    /* Specific padding for calendar and other containers */
    .calendar-container,
    .dashboard-content,
    .data-table {
        margin-bottom: 30px;
        /* Extra margin for mobile scrolling */
        padding-bottom: 20px;
        /* Additional padding */
    }

    /* Calendar specific mobile adjustments */
    #calendario .calendar-container {
        padding-bottom: 40px;
        /* More padding for calendar section */
        margin-bottom: 30px;
    }

    /* Calendar content area specifically */
    #event-calendar {
        margin-bottom: 20px;
    }

    /* Ensure all content sections have proper mobile spacing */
    .content-section {
        padding-bottom: 30px;
        margin-bottom: 20px;
    }

    /* Hide menu toggle on mobile since we use bottom nav */
    .menu-toggle {
        display: none;
    }

    /* Force calendar section to have extra bottom space */
    #calendario {
        min-height: calc(100vh - 200px);
        /* Ensure enough space */
        padding-bottom: 50px !important;
    }

    /* Force calendar wrapper to have space */
    #calendario .inhouse-calendar,
    #calendario #event-calendar {
        margin-bottom: 40px !important;
    }
}

.sidebar-menu {
    list-style: none;
    padding: 10px 0;
}

.menu-item {
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #dee2e6;
    transition: all 0.2s ease;
    position: relative;
}

.menu-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
}

.menu-item.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-left: 3px solid #007bff;
}

.menu-icon {
    font-size: 16px;
}

/* Main Content */
.main-content {
    margin-left: 200px;
    margin-top: 50px;
    padding: 20px;
    min-height: calc(100vh - 50px);
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed~.main-content {
    margin-left: 0;
}

/* Content Sections */
.content-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Page Header */
.page-header {
    margin-bottom: 20px;
}

.breadcrumb {
    color: #6c757d;
    font-size: 12px;
    margin-bottom: 5px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 500;
    color: #212529;
}

/* Info Box */
.info-box {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 4px;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.info-icon {
    font-size: 18px;
    color: #0c5460;
}

.info-box p {
    color: #0c5460;
    margin: 0;
}

/* Controls Bar */
.controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
}

.search-box {
    flex: 1;
    max-width: 300px;
}

.search-box input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.search-box input:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.action-buttons {
    display: flex;
    gap: 10px;
}

/* Buttons */
.btn-primary {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.btn-info {
    background-color: #17a2b8;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.btn-info:hover {
    background-color: #138496;
}

/* Data Table */
.data-table {
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
    /* Force horizontal scroll when needed */
}

/* FORCE Azioni column to always be visible - RESPONSIVE SOLUTION */
#ricorsi .data-table {
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Desktop and tablet - use sticky column */
@media (min-width: 769px) {
    #ricorsi table {
        min-width: 1200px;
        /* Force table to be wide enough on desktop */
    }

    #ricorsi table th:last-child,
    #ricorsi table td:last-child {
        position: sticky !important;
        right: 0 !important;
        background: white !important;
        border-left: 2px solid #007bff !important;
        min-width: 150px !important;
        width: 150px !important;
        z-index: 10 !important;
        box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1) !important;
    }

    #ricorsi tbody tr:hover td:last-child {
        background: #f8f9fa !important;
    }
}

/* Mobile - disable sticky column and use simple responsive table */
@media (max-width: 768px) {
    #ricorsi table {
        min-width: 500px;
        /* Manageable width for mobile scroll */
        font-size: 12px;
    }

    #ricorsi table th:last-child,
    #ricorsi table td:last-child {
        position: static !important;
        background: transparent !important;
        border-left: none !important;
        min-width: 80px !important;
        width: auto !important;
        z-index: auto !important;
        box-shadow: none !important;
    }

    #ricorsi table th,
    #ricorsi table td {
        padding: 6px 4px;
        font-size: 11px;
    }
}

thead {
    background-color: #f8f9fa;
}

th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    font-size: 13px;
}

td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
    color: #212529;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Ensure Azioni column is always visible and has adequate width */
table th:last-child,
table td:last-child {
    min-width: 120px;
    width: auto;
    text-align: center;
    white-space: nowrap;
    position: sticky;
    right: 0;
    background: #f8f9fa;
    z-index: 2;
}

table tbody tr:hover td:last-child {
    background: #e9ecef;
}

/* Specific fixes for Controversie table Azioni column */
#ricorsi table th:nth-child(16),
#ricorsi table td:nth-child(16) {
    min-width: 120px !important;
    width: 120px !important;
    text-align: center;
    padding-left: 8px;
    padding-right: 8px;
    position: sticky !important;
    right: 0 !important;
    background: #f8f9fa !important;
    z-index: 3 !important;
    border-left: 2px solid #dee2e6;
}

#ricorsi tbody tr:hover td:nth-child(16) {
    background: #e9ecef !important;
}

/* Make action buttons more compact */
.btn-sm {
    padding: 4px 8px;
    font-size: 11px;
    margin: 1px;
}

/* Aggressive table responsiveness - hide columns but keep Azioni visible */
@media (max-width: 1400px) {

    #ricorsi table th:nth-child(n+12):not(:last-child),
    #ricorsi table td:nth-child(n+12):not(:last-child) {
        display: none;
    }
}

@media (max-width: 1300px) {

    #ricorsi table th:nth-child(n+10):not(:last-child),
    #ricorsi table td:nth-child(n+10):not(:last-child) {
        display: none;
    }
}

/* Status Indicators */
.status-active {
    color: #28a745;
    font-size: 20px;
}

.status-inactive {
    color: #dc3545;
    font-size: 20px;
}

/* Pagination */
.pagination {
    padding: 15px;
    text-align: center;
    color: #6c757d;
    font-size: 13px;
    background-color: #f8f9fa;
}

/* Dashboard Specific */
.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.welcome-card {
    background-color: white;
    border-radius: 4px;
    padding: 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.welcome-icon {
    font-size: 48px;
    background-color: #f8f9fa;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-text h2 {
    font-size: 24px;
    margin-bottom: 5px;
    color: #212529;
}

.welcome-text p {
    color: #6c757d;
    margin: 0;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.dashboard-card {
    background-color: white;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dashboard-card h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #212529;
}

.card-content {
    color: #6c757d;
    min-height: 100px;
}

/* Chart container styling */
.chart-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    padding: 10px;
}

.chart-container canvas {
    max-width: 100%;
    max-height: 280px;
}

/* Developer info section */
.developer-info {
    margin-top: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 4px;
    text-align: center;
    border-top: 3px solid #007bff;
}

.developer-info p {
    margin-bottom: 8px;
    color: #495057;
}

.developer-info strong {
    color: #212529;
}

.developer-info .copyright {
    font-size: 12px;
    color: #6c757d;
    margin-top: 10px;
}

.release-info {
    text-align: center;
    color: #6c757d;
    font-size: 12px;
    margin-top: 20px;
}

/* EventCalendar Integration */
.calendar-container {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

.calendar-controls {
    margin-bottom: 20px;
}

.calendar-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.calendar-view-options {
    display: flex;
    align-items: center;
    gap: 8px;
}

.calendar-view-options label {
    font-weight: 500;
    color: #495057;
}

.calendar-view-options select {
    padding: 6px 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background-color: white;
}

.event-type-filters {
    display: flex;
    align-items: center;
    gap: 15px;
}

.event-type-filters label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: #495057;
    cursor: pointer;
}

.event-type-filters input[type="checkbox"] {
    margin: 0;
}

/* EventCalendar Customization */
#event-calendar {
    background-color: white;
    border-radius: 6px;
}

/* EventCalendar theme overrides */
.ec {
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

.ec-header-toolbar {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 15px;
}

.ec-button {
    background-color: #007bff;
    border-color: #007bff;
    color: white;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 14px;
}

.ec-button:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

.ec-button.ec-button-active {
    background-color: #0056b3;
    border-color: #004085;
}

.ec-day-head {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
}

.ec-day.ec-today {
    background-color: #e7f1ff !important;
}

.ec-event {
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid #007bff;
}

.ec-event:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.ec-event.event-eventi {
    border-left-color: #007bff;
    background-color: #e7f1ff;
    color: #0056b3;
}

.ec-event.event-ricorsi {
    border-left-color: #dc3545;
    background-color: #ffe6e6;
    color: #721c24;
}

.ec-event.event-scadenze {
    border-left-color: #fd7e14;
    background-color: #fff3cd;
    color: #856404;
}

.ec-event.event-promemoria {
    border-left-color: #6f42c1;
    background-color: #f3e5f5;
    color: #5a1a72;
}

/* Event Sidebar */
.event-sidebar {
    position: fixed;
    right: 0;
    top: 80px;
    width: 400px;
    height: calc(100vh - 80px);
    background-color: white;
    border-left: 1px solid #dee2e6;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.event-sidebar[style*="block"] {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

.sidebar-header h3 {
    margin: 0;
    color: #212529;
    font-size: 18px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background-color: #e9ecef;
    color: #495057;
}

.sidebar-content {
    padding: 20px;
}

.event-detail-card {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e9ecef;
}

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.event-header h4 {
    margin: 0;
    color: #212529;
    flex: 1;
    margin-right: 10px;
}

.event-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.event-badge.event-eventi {
    background-color: #e7f1ff;
    color: #007bff;
}

.event-badge.event-ricorsi {
    background-color: #ffe6e6;
    color: #dc3545;
}

.event-info {
    margin-bottom: 20px;
}

.info-row {
    margin-bottom: 12px;
    line-height: 1.5;
}

.info-row strong {
    color: #495057;
    display: inline-block;
    min-width: 100px;
}

.event-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Responsive Calendar */
@media (max-width: 768px) {
    .calendar-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .event-type-filters {
        justify-content: center;
        flex-wrap: wrap;
    }

    .event-sidebar {
        width: 100%;
        top: 60px;
        height: calc(100vh - 60px);
    }

    .fc-toolbar {
        flex-direction: column;
        gap: 10px;
    }

    .fc-toolbar-chunk {
        display: flex;
        justify-content: center;
    }
}

/* Responsive calendar */
@media (max-width: 768px) {
    .calendar-day {
        min-height: 60px;
        font-size: 14px;
    }

    .day-number {
        font-size: 14px;
    }

    .calendar-header {
        flex-direction: column;
        text-align: center;
    }

    .calendar-header h2 {
        order: -1;
        margin-bottom: 10px;
    }

    .event-indicators {
        max-height: 30px;
    }

    .month-year-picker {
        flex-direction: column;
        gap: 8px;
    }

    .calendar-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Calendar Help Styles */
.calendar-help {
    max-width: 500px;
}

.shortcut-list {
    margin-bottom: 20px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f8f9fa;
}

.shortcut-item:last-child {
    border-bottom: none;
}

.shortcut-item kbd {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    padding: 4px 6px;
    font-size: 12px;
    font-family: monospace;
    margin-right: 10px;
    min-width: 30px;
    text-align: center;
}

.shortcut-item span {
    flex: 1;
}

.feature-list {
    line-height: 1.6;
    padding-left: 20px;
}

.feature-list li {
    margin-bottom: 8px;
}

/* Button info style */
.btn-info {
    background-color: #17a2b8;
    color: white;
    border: 1px solid #17a2b8;
}

.btn-info:hover {
    background-color: #138496;
    border-color: #117a8b;
}

/* Modal Enhancements */
.modal-content {
    max-width: 95vw;
    max-height: 90vh;
    overflow: auto;
}

/* Ricorso Detail Container */
.ricorso-detail-container {
    width: 100%;
    max-width: 1200px;
}

/* Tab Navigation */
.ricorso-tabs {
    display: flex;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 20px;
    background-color: #f8f9fa;
    border-radius: 6px 6px 0 0;
}

.tab-button {
    background: none;
    border: none;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    transition: all 0.2s ease;
    min-width: 120px;
}

.tab-button:hover {
    background-color: #e9ecef;
    color: #495057;
}

.tab-button.active {
    background-color: #007cba;
    color: white;
    border-bottom: 2px solid #007cba;
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Form Section Headers */
.form-section h3 {
    color: #007cba;
    font-size: 16px;
    font-weight: 600;
    margin: 20px 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #dee2e6;
}

.form-section h4 {
    color: #495057;
    font-size: 14px;
    font-weight: 600;
    margin: 15px 0 10px 0;
}

/* Search Section */
.search-section {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
}

/* Helper Text */
.helper-text {
    display: block;
    font-size: 11px;
    color: #6c757d;
    margin-top: 4px;
    font-style: italic;
}

/* Badge Styles for Parti */
.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 4px;
}

.badge-primary {
    background-color: #007cba;
    color: white;
}

.badge-secondary {
    background-color: #6c757d;
    color: white;
}

.badge-warning {
    background-color: #ffc107;
    color: #212529;
}

.badge-info {
    background-color: #17a2b8;
    color: white;
}

.badge-light {
    background-color: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

/* Button Styles */
.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
    line-height: 1.2;
    border-radius: 3px;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

/* Table Responsive */
.table-responsive {
    overflow-x: auto;
    margin-bottom: 15px;
}

.table-responsive .table {
    margin-bottom: 0;
    min-width: 800px;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    align-items: center;
    margin-top: 8px;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.1);
}

/* Form Actions Enhancement */
.form-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Form Sections */
.form-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.form-section h3 {
    color: #495057;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #dee2e6;
}

/* Legal Representative Section */
#legaleRappresentanteFields {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    margin-top: 15px;
    transition: all 0.3s ease;
}

#legaleRappresentanteFields h4 {
    color: #6c757d;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #dee2e6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#legaleRappresentanteFields .form-group {
    margin-bottom: 12px;
}

#legaleRappresentanteFields .form-group label {
    font-size: 13px;
    color: #6c757d;
    font-weight: 500;
}

/* Legal Representative Section - Light Gray Styling */
.legale-rappresentante-section {
    background: #f8f9fa !important;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-top: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.legale-rappresentante-section h4 {
    color: #6c757d;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #dee2e6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.legale-rappresentante-section .form-group {
    margin-bottom: 15px;
}

.legale-rappresentante-section .form-group label {
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
    margin-bottom: 5px;
}

.legale-rappresentante-section input {
    background-color: #ffffff;
    border: 1px solid #ced4da;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.legale-rappresentante-section input:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    background-color: #ffffff;
}

/* Enhanced Form Groups */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
    font-size: 13px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #007cba;
    outline: 0;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.25);
}

.helper-text {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
}

/* Checkbox Groups */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Search Section */
.search-section {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
}

/* Parti List Table */
.parti-list {
    margin-top: 20px;
}

.parti-list .table {
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.parti-list .table th {
    background-color: #f8f9fa;
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    padding: 12px 8px;
    border-bottom: 2px solid #dee2e6;
}

.parti-list .table td {
    padding: 10px 8px;
    font-size: 13px;
    border-bottom: 1px solid #dee2e6;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
    margin-top: 30px;
}

/* Enhanced Form Rows */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ricorso-tabs {
        flex-direction: column;
    }

    .tab-button {
        min-width: auto;
        text-align: left;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-content {
        margin: 10px;
        max-width: calc(100vw - 20px);
    }
}

/* Existing styles continue below... */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
    color: #212529;
    margin: 0;
}

.close {
    font-size: 28px;
    cursor: pointer;
    color: #6c757d;
    line-height: 1;
}

.close:hover {
    color: #212529;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

/* Form Styles */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #495057;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
}

/* Responsive Design - Enhanced Mobile Support */

/* Large tablets and small laptops */
@media (max-width: 1200px) {
    .data-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Controversie table - hide most columns but keep essential ones including Azioni */
    #ricorsi table th:nth-child(n+8):not(:last-child),
    #ricorsi table td:nth-child(n+8):not(:last-child) {
        display: none !important;
    }

    /* Always show these essential columns */
    #ricorsi table th:nth-child(1),
    /* Tipo */
    #ricorsi table th:nth-child(2),
    /* Grado */
    #ricorsi table th:nth-child(4),
    /* Contribuente */
    #ricorsi table th:nth-child(10),
    /* Stato */
    #ricorsi table th:nth-child(16),
    /* Azioni - ALWAYS VISIBLE */
    #ricorsi table td:nth-child(1),
    #ricorsi table td:nth-child(2),
    #ricorsi table td:nth-child(4),
    #ricorsi table td:nth-child(10),
    #ricorsi table td:nth-child(16) {
        display: table-cell !important;
    }
}

/* Tablet and small desktop */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

    .welcome-card {
        padding: 20px;
    }

    .welcome-icon {
        width: 60px;
        height: 60px;
        font-size: 36px;
    }

    .calendar-toolbar {
        gap: 10px;
        padding: 10px;
    }

    /* Tablet-specific table improvements */
    .data-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 13px;
    }

    /* Hide more columns on tablets for Controversie */
    #ricorsi table th:nth-child(n+8),
    #ricorsi table td:nth-child(n+8) {
        display: none;
    }

    /* Show important columns on tablets */
    #ricorsi table th:nth-child(1),
    /* Tipo */
    #ricorsi table th:nth-child(2),
    /* Grado di giudizio */
    #ricorsi table th:nth-child(3),
    /* Data Notifica */
    #ricorsi table th:nth-child(4),
    /* Contribuente */
    #ricorsi table th:nth-child(5),
    /* Atto */
    #ricorsi table th:nth-child(10),
    /* Stato */
    #ricorsi table th:nth-child(16),
    /* Azioni */
    #ricorsi table td:nth-child(1),
    #ricorsi table td:nth-child(2),
    #ricorsi table td:nth-child(3),
    #ricorsi table td:nth-child(4),
    #ricorsi table td:nth-child(5),
    #ricorsi table td:nth-child(10),
    #ricorsi table td:nth-child(16) {
        display: table-cell !important;
    }

    /* Apply similar responsive rules to other tables */
    #anagrafe table th:nth-child(n+8),
    #anagrafe table td:nth-child(n+8) {
        display: none;
    }

    /* Always show Azioni for Anagrafe */
    #anagrafe table th:nth-child(12),
    /* Azioni */
    #anagrafe table td:nth-child(12) {
        display: table-cell !important;
    }

    /* Avvocati table is smaller, no changes needed */
}

/* Small laptops and large tablets */
@media (max-width: 1366px) and (min-width: 1025px) {

    /* Controversie table - reduce columns on smaller laptop screens */
    #ricorsi table th:nth-child(n+11),
    #ricorsi table td:nth-child(n+11) {
        display: none;
    }

    /* Always show Azioni */
    #ricorsi table th:nth-child(16),
    #ricorsi table td:nth-child(16) {
        display: table-cell !important;
    }

    /* Reduce font size slightly */
    table {
        font-size: 13px;
    }

    table th,
    table td {
        padding: 6px 8px;
    }
}

/* Mobile devices */
@media (max-width: 768px) {

    /* Header adjustments */
    .header {
        padding: 8px 15px;
        height: 45px;
    }

    .header-left {
        gap: 15px;
    }

    .logo {
        font-size: 18px;
    }

    .user-info {
        display: none;
        /* Hide user info on very small screens */
    }

    /* Main content */
    .main-content {
        margin-left: 0;
        margin-top: 45px;
        padding: 15px;
    }

    /* Sidebar */
    .sidebar {
        position: fixed;
        top: 45px;
        left: 0;
        width: 100%;
        height: calc(100vh - 45px);
        background: #343a40;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    /* Add overlay when sidebar is open on mobile */
    .sidebar.show::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }

    /* Dashboard specific */
    .dashboard-content {
        gap: 15px;
    }

    .welcome-card {
        padding: 15px;
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .welcome-icon {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }

    .welcome-text h2 {
        font-size: 20px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .dashboard-card {
        padding: 15px;
    }

    .dashboard-card h3 {
        font-size: 16px;
        margin-bottom: 10px;
    }

    .card-content {
        min-height: 80px;
        font-size: 13px;
    }

    /* Developer info */
    .developer-info {
        margin-top: 20px;
        padding: 15px;
        background-color: white;
        border-radius: 4px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        text-align: center;
    }

    .developer-info p {
        margin-bottom: 8px;
        font-size: 12px;
    }

    .developer-info .copyright {
        font-size: 11px;
    }

    /* Form and controls */
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .controls-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .search-box {
        max-width: none;
    }

    .action-buttons {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }

    .btn-primary,
    .btn-secondary {
        flex: 1;
        min-width: 0;
        font-size: 13px;
        padding: 8px 12px;
    }

    /* Tables */
    .data-table {
        overflow-x: auto;
        margin: 0 -15px;
        padding: 0 15px;
        -webkit-overflow-scrolling: touch;
        /* Smooth scrolling on iOS */
    }

    table {
        min-width: 400px;
        /* Further reduced for mobile */
        font-size: 12px;
        /* Smaller font for mobile */
        border-collapse: collapse;
        table-layout: fixed;
        /* Fixed layout for better control */
        width: 100%;
    }

    table th,
    table td {
        padding: 6px 4px;
        /* Reduced padding */
        white-space: nowrap;
        font-size: 11px;
        border: 1px solid #dee2e6;
    }

    /* Hide less critical columns on mobile */
    table th:nth-child(n+6),
    table td:nth-child(n+6) {
        display: none;
    }

    /* Controversie table - show only essential columns on mobile */
    #ricorsi table th:nth-child(n+4),
    #ricorsi table td:nth-child(n+4) {
        display: none;
    }

    /* Always show these essential columns for Controversie */
    #ricorsi table th:nth-child(1),
    /* Tipo */
    #ricorsi table th:nth-child(4),
    /* Contribuente - CHANGED from 2 to 4 */
    #ricorsi table th:nth-child(16),
    /* Azioni */
    #ricorsi table td:nth-child(1),
    #ricorsi table td:nth-child(4),
    /* Contribuente - CHANGED from 2 to 4 */
    #ricorsi table td:nth-child(16) {
        display: table-cell !important;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* HIDE the Grado di giudizio column specifically */
    #ricorsi table th:nth-child(2),
    #ricorsi table td:nth-child(2) {
        display: none !important;
    }

    /* Set specific widths for essential columns */
    #ricorsi table th:nth-child(1),
    #ricorsi table td:nth-child(1) {
        width: 25% !important;
        /* Tipo */
    }

    #ricorsi table th:nth-child(4),
    #ricorsi table td:nth-child(4) {
        width: 50% !important;
        /* Contribuente */
    }

    #ricorsi table th:nth-child(16),
    #ricorsi table td:nth-child(16) {
        width: 25% !important;
        /* Azioni */
    }

    #ricorsi table td:nth-child(16) {
        width: 20% !important;
        max-width: 100px;
    }

    /* Azioni */
    #ricorsi table td:nth-child(4),
    #ricorsi table td:nth-child(10),
    #ricorsi table td:nth-child(16) {
        display: table-cell !important;
    }

    /* Calendar */
    .calendar-container {
        padding: 15px;
        margin: 0 -15px;
    }

    .calendar-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 10px;
    }

    .calendar-toolbar>* {
        width: 100%;
        justify-content: center;
    }

    .calendar-view-options,
    .event-type-filters {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
    }

    .calendar-view-options select {
        flex: 1;
        max-width: 150px;
    }

    /* Stats grid mobile */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-item {
        padding: 8px;
    }

    .stat-item strong {
        font-size: 20px;
    }

    /* Event items */
    .event-item,
    .hearing-item {
        padding: 8px;
        margin-bottom: 8px;
        font-size: 13px;
        border-radius: 4px;
    }

    /* Modal adjustments */
    .modal-content {
        margin: 5% auto;
        width: 95%;
        max-width: none;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-header {
        padding: 15px;
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
    }

    .modal-body {
        padding: 15px;
        max-height: 70vh;
        overflow-y: auto;
    }

    /* Form improvements for mobile */
    .form-group {
        margin-bottom: 15px;
    }

    .form-group label {
        font-size: 14px;
        margin-bottom: 5px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
        /* Prevents zoom on iOS */
        padding: 12px;
        border-radius: 6px;
    }

    .form-row {
        gap: 10px;
    }
}

/* Very small screens (phones in portrait) */
@media (max-width: 480px) {
    .header {
        padding: 5px 10px;
        font-size: 14px;
    }

    .header-left .logo {
        font-size: 16px;
    }

    .header-right {
        font-size: 12px;
    }

    .header-btn {
        padding: 5px 8px;
        font-size: 12px;
    }

    .main-content {
        padding: 10px;
        margin-top: 45px;
    }

    .page-header h1 {
        font-size: 22px;
    }

    .breadcrumb {
        font-size: 12px;
    }

    .dashboard-card {
        padding: 12px;
    }

    .dashboard-card h3 {
        font-size: 16px;
    }

    .welcome-card {
        padding: 12px;
        flex-direction: column;
        text-align: center;
    }

    .welcome-icon {
        margin-bottom: 10px;
    }

    .welcome-text h2 {
        font-size: 18px;
    }

    .welcome-text p {
        font-size: 13px;
    }

    .calendar-container {
        padding: 10px;
    }

    .action-buttons {
        flex-direction: column;
        gap: 5px;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        margin-bottom: 0;
        font-size: 14px;
    }

    .search-box input {
        font-size: 14px;
    }

    .controls-bar {
        flex-direction: column;
        gap: 10px;
    }

    .search-box {
        width: 100%;
    }

    .info-box {
        padding: 10px;
        font-size: 13px;
    }

    .developer-info {
        padding: 10px;
        font-size: 12px;
    }

    .stats-grid {
        gap: 8px;
    }

    .stat-item {
        padding: 6px;
    }

    .stat-item strong {
        font-size: 18px;
    }

    /* Sidebar improvements for very small screens */
    .sidebar {
        width: 100%;
        left: -100%;
    }

    .sidebar.show {
        left: 0;
    }

    .menu-item {
        padding: 12px 15px;
    }

    /* Table improvements for very small screens */
    .data-table {
        font-size: 12px;
        margin: 0 -10px;
        padding: 0 10px;
    }

    table {
        min-width: 600px;
    }

    table th,
    table td {
        padding: 6px 4px;
        font-size: 11px;
    }

    /* Hide even more columns on very small screens */
    .data-table table th:nth-child(n+5),
    .data-table table td:nth-child(n+5) {
        display: none;
    }

    /* Controversie-specific mobile improvements */
    #ricorsi .data-table {
        font-size: 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #ricorsi table {
        min-width: 100%;
        border-collapse: collapse;
        table-layout: fixed;
        width: 100%;
    }

    #ricorsi table th,
    #ricorsi table td {
        padding: 8px 4px;
        font-size: 11px;
        border: 1px solid #dee2e6;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        line-height: 1.3;
        vertical-align: top;
    }

    /* FORCE hide ALL columns except Tipo, Contribuente, and Azioni */
    #ricorsi table th:nth-child(2),
    #ricorsi table th:nth-child(3),
    #ricorsi table th:nth-child(5),
    #ricorsi table th:nth-child(6),
    #ricorsi table th:nth-child(7),
    #ricorsi table th:nth-child(8),
    #ricorsi table th:nth-child(9),
    #ricorsi table th:nth-child(10),
    #ricorsi table th:nth-child(11),
    #ricorsi table th:nth-child(12),
    #ricorsi table th:nth-child(13),
    #ricorsi table th:nth-child(14),
    #ricorsi table th:nth-child(15),
    #ricorsi table td:nth-child(2),
    #ricorsi table td:nth-child(3),
    #ricorsi table td:nth-child(5),
    #ricorsi table td:nth-child(6),
    #ricorsi table td:nth-child(7),
    #ricorsi table td:nth-child(8),
    #ricorsi table td:nth-child(9),
    #ricorsi table td:nth-child(10),
    #ricorsi table td:nth-child(11),
    #ricorsi table td:nth-child(12),
    #ricorsi table td:nth-child(13),
    #ricorsi table td:nth-child(14),
    #ricorsi table td:nth-child(15) {
        display: none !important;
    }

    /* Set specific widths for the 3 visible columns: Tipo, Contribuente, Azioni */
    #ricorsi table th:nth-child(1),
    #ricorsi table td:nth-child(1) {
        width: 25% !important;
        /* Tipo */
    }

    #ricorsi table th:nth-child(4),
    #ricorsi table td:nth-child(4) {
        width: 50% !important;
        /* Contribuente */
    }

    #ricorsi table th:nth-child(16),
    #ricorsi table td:nth-child(16) {
        width: 25% !important;
        /* Azioni */
        text-align: center;
    }

    /* General mobile table improvements to prevent overlap */
    .data-table table td {
        max-width: none;
        word-break: break-word;
        hyphens: auto;
    }

    /* Action buttons mobile improvements */
    .data-table .btn-sm {
        padding: 10px 12px;
        font-size: 12px;
        min-width: 40px;
        min-height: 40px;
        margin: 2px;
        border-radius: 4px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Make action buttons more touch-friendly for Controversie */
    #ricorsi .btn-sm {
        padding: 6px 8px;
        font-size: 10px;
        min-height: 30px;
        min-width: 30px;
        margin: 1px;
        border-radius: 3px;
        display: inline-block;
    }

    /* Ensure all action buttons are visible in mobile */
    #ricorsi table td:nth-child(16) {
        white-space: nowrap !important;
        overflow: visible !important;
        text-overflow: unset !important;
        padding: 4px 2px !important;
    }

    #ricorsi table td:nth-child(16) .btn-sm {
        width: auto !important;
        margin: 1px !important;
        padding: 4px 6px !important;
        font-size: 9px !important;
        min-height: 28px !important;
        min-width: 28px !important;
    }

    /* Touch-friendly improvements */
    .menu-toggle {
        padding: 8px;
        border-radius: 4px;
        background: rgba(255, 255, 255, 0.1);
        min-width: 35px;
        min-height: 35px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
    }

    .menu-toggle:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    /* Better spacing for touch */
    .sidebar-menu .menu-item {
        min-height: 48px;
        padding: 12px 20px;
        font-size: 15px;
    }

    .action-buttons button {
        min-height: 44px;
        padding: 10px 15px;
        font-size: 14px;
    }

    /* Ensure readable text on small screens */
    .card-content {
        font-size: 13px;
        line-height: 1.4;
    }

    .data-table table {
        border-collapse: separate;
        border-spacing: 0;
    }

    .data-table table th,
    .data-table table td {
        border-left: 1px solid #dee2e6;
        border-bottom: 1px solid #dee2e6;
    }

    .data-table table th:first-child,
    .data-table table td:first-child {
        border-left: none;
    }
}

/* Landscape orientation on small devices */
@media (max-width: 768px) and (orientation: landscape) {
    .main-content {
        margin-top: 40px;
    }

    .header {
        height: 40px;
        padding: 5px 15px;
    }

    .modal-content {
        margin: 2% auto;
        max-height: 95vh;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

    .btn-primary,
    .btn-secondary {
        border-width: 0.5px;
    }
}

/* Original responsive styles (preserved) */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-200px);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .controls-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: none;
    }

    .data-table {
        overflow-x: auto;
    }

    table {
        min-width: 800px;
    }
}

/* Additional styles for new features */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.stat-item {
    text-align: center;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.stat-item strong {
    display: block;
    font-size: 24px;
    color: #007bff;
    margin-bottom: 5px;
}

.stat-item span {
    font-size: 12px;
    color: #6c757d;
}

.event-item {
    padding: 10px;
    margin-bottom: 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #007bff;
}

.event-item strong {
    display: block;
    margin-bottom: 5px;
}

.event-item p {
    margin: 0 0 5px 0;
    color: #6c757d;
}

.event-item small {
    color: #6c757d;
    font-size: 11px;
}

.alert {
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* View Ricorso Styles */
.view-ricorso-container {
    max-width: 100%;
}

.view-section {
    margin-bottom: 25px;
}

.view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.view-item {
    display: flex;
    flex-direction: column;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #007bff;
}

.view-item label {
    font-weight: 600;
    color: #495057;
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.view-item span {
    font-size: 14px;
    color: #212529;
}

.note-content {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    white-space: pre-wrap;
    line-height: 1.6;
}

/* Status and Badge Styles */
.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-active {
    background-color: #d4edda;
    color: #155724;
}

.status-inactive {
    background-color: #f8d7da;
    color: #721c24;
}

.status-in-corso {
    background-color: #fff3cd;
    color: #856404;
}

.status-definitivo {
    background-color: #d4edda;
    color: #155724;
}

.status-annullato {
    background-color: #f8d7da;
    color: #721c24;
}

.status-sospeso {
    background-color: #e2e3e5;
    color: #383d41;
}

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

.esito-accoglimento {
    background-color: #d4edda;
    color: #155724;
}

.esito-rigetto {
    background-color: #f8d7da;
    color: #721c24;
}

.esito-parziale-accoglimento {
    background-color: #fff3cd;
    color: #856404;
}

.esito-inammissibilità {
    background-color: #e2e3e5;
    color: #383d41;
}

.esito-improcedibilità {
    background-color: #f1c0c7;
    color: #721c24;
}

.tipo-parte-badge {
    display: inline-block;
    padding: 2px 6px;
    background-color: #007bff;
    color: white;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

/* File Upload Styles */
.upload-section {
    background-color: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.upload-section input[type="file"] {
    margin: 10px 0;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: white;
    width: 100%;
}

.files-list {
    margin-top: 20px;
}

.helper-text {
    font-size: 11px;
    color: #6c757d;
    font-style: italic;
    margin-top: 5px;
}

/* Custom Tree Dropdown Styles */
.custom-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-header {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    background-color: white;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 40px;
}

.dropdown-header:hover {
    border-color: #0066cc;
}

.dropdown-arrow {
    font-size: 12px;
    transition: transform 0.2s;
}

.dropdown-header.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.dropdown-content.show {
    display: block;
}

.dropdown-loading {
    padding: 10px;
    text-align: center;
    color: #666;
}

.dropdown-section {
    border-bottom: 1px solid #f0f0f0;
}

.dropdown-section:last-child {
    border-bottom: none;
}

.section-header {
    padding: 8px 12px;
    background-color: #f8f9fa;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e9ecef;
}

.section-header:hover {
    background-color: #e9ecef;
}

.section-header.principal {
    background-color: #e3f2fd;
    color: #0066cc;
}

.section-header.region {
    background-color: #f1f8e9;
    color: #2e7d32;
}

.section-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}

.section-header.expanded .section-arrow {
    transform: rotate(90deg);
}

.section-cities {
    display: none;
    background-color: white;
}

.section-cities.show {
    display: block;
}

.city-item {
    padding: 8px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
}

.city-item:hover {
    background-color: #f8f9fa;
}

.city-item.selected {
    background-color: #e3f2fd;
    color: #0066cc;
    font-weight: 500;
}

.city-item:last-child {
    border-bottom: none;
}

/* Responsive adjustments for view */
@media (max-width: 768px) {
    .view-grid {
        grid-template-columns: 1fr;
    }

    .view-item {
        margin-bottom: 10px;
    }

    .dropdown-content {
        max-height: 250px;
    }
}

/* Loading spinner animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}