:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #64748b;
    --danger-color: #ef4444;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html {
    overflow-y: scroll;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #e5e5e5 0%, #4b83a2 100%);
}
.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.login-box h1 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 10px;
    font-size: 2.5rem;
}
.login-box h2 {
    text-align: center;
    color: var(--secondary-color);
    font-size: 1.2rem;
    margin-bottom: 30px;
    font-weight: normal;
}
.navbar {
    background: white;
    box-shadow: var(--shadow);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.nav-brand {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    transition: opacity 0.2s;
}
.nav-brand:hover {
    opacity: 0.8;
}
.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}
.nav-menu a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.2s;
}
.nav-menu a:hover,
.nav-menu a.active {
    color: var(--primary-color);
}
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}
.page-header h1 {
    font-size: 2rem;
    color: var(--text-color);
}
.card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.06);
}
.card h2{
    margin-bottom: 20px;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-align: center;
}
.stat-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
}
.stat-label {
    color: var(--secondary-color);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.form-group {
    margin-bottom: 1.5rem;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}
.form-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--secondary-color);
}
.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}
.btn-primary {
    background: var(--primary-color);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-hover);
}
.btn-secondary {
    background: var(--secondary-color);
    color: white;
}
.btn-green{
    background: #5db758;
    color: white;
}
.btn-green:hover{
    background: #5bcf55;
}
.btn-danger {
    background: var(--danger-color);
    color: white;
}
.btn-info {
    background: #0891b2;
    color: white;
}
.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}
.btn-block {
    width: 100%;
}
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
}
.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
}
.table th {
    font-weight: 600;
    color: #374151;
    background: linear-gradient(to bottom, #f9fafb, #f3f4f6);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid #d1d5db;
}
.table tbody tr:nth-child(odd) {
    background: #ffffff;
}
.table tbody tr:nth-child(even) {
    background: #fafbfc;
}
.table tbody tr:hover {
    background: #eff6ff;
    transition: background-color 0.2s ease;
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.1);
}
.table tbody tr:last-child td {
    border-bottom: none;
}
.table-eventi th:nth-child(1),
.table-eventi td:nth-child(1) {
    width: 25%;
    word-wrap: break-word;
}
.table-eventi th:nth-child(2),
.table-eventi td:nth-child(2) {
    width: 12%;
    white-space: nowrap;
}
.table-eventi th:nth-child(3),
.table-eventi td:nth-child(3) {
    width: 20%;
    word-wrap: break-word;
}
.table-eventi th:nth-child(4),
.table-eventi td:nth-child(4) {
    width: 8%;
    text-align: center;
}
.table-eventi th:nth-child(5),
.table-eventi td:nth-child(5) {
    width: 10%;
    text-align: center;
    white-space: nowrap;
}

.table-eventi th:nth-child(6),
.table-eventi td:nth-child(6) {
    width: 10%;
    text-align: center;
}

.table-eventi th:nth-child(7),
.table-eventi td:nth-child(7) {
    width: 12%;
    min-width: 120px;
}
.table-actions {
    display: flex;
    gap: 0.4rem;
    justify-content: flex-start;
}

.table-actions .btn {
    margin: 0;
}
.btn-icon {
    width: 32px !important;
    min-width: 32px !important;
    height: 32px;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    position: relative;
    flex-shrink: 0;
}
.btn-icon:hover {
    transform: translateY(-1px);
}

.btn-icon i {
    font-size: 14px;
    margin: 0 !important;
}
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    font-size: 0.65rem;
    font-weight: 500;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge-success {
    background: linear-gradient(135deg, #e6ffed 0%, #d1fae5 100%);
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.badge-warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    color: #92400e;
    border: 1px solid #fde68a;
}
.badge-secondary {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    color: #475569;
    border: 1px solid #e2e8f0;
}
.badge-primary {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: #1e40af;
    border: 1px solid #bfdbfe;
}
.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}
.alert-error {
    background: #fee2e2;
    color: var(--danger-color);
}
.alert-success {
    background: #dcfce7;
    color: var(--success-color);
}
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}
.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 0;
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}
.close {
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    color: var(--secondary-color);
}
.close:hover {
    color: var(--text-color);
}
.modal-content form {
    padding: 1.5rem;
}
.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}
.event-info {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}
.event-info h2 {
    margin-bottom: 0.5rem;
}
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}
.detail-item label {
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 0.25rem;
}
.form-group {
    position: relative;
}
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-top: 0.25rem;
    box-shadow: var(--shadow-lg);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: block;
    border: 0;
}
.search-result-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
}
.search-result-item:hover {
    background: #f8fafc;
}
.search-result-item.no-results {
    color: var(--secondary-color);
    font-style: italic;
    cursor: default;
}
.search-result-item.no-results:hover {
    background: white;
}
.selected-volontari {
    margin-top: 2rem;
}
.selected-volontari h4 {
    margin-bottom: 1rem;
}
.volontario-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #e1edf9;
    border-radius: 6px;
    margin-bottom: 1rem;
}
.volontario-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.ore-input {
    width: 80px;
}
.section {
    margin-top: 3rem;
}
.section h2 {
    margin-bottom: 1rem;
}
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}
.ranking-container {
    background: white;
    border-radius: 8px;
    padding: 1rem;
}
.ranking-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #f8fafc;
    border-radius: 6px;
    transition: transform 0.2s;
}
.ranking-item:hover {
    transform: translateX(5px);
    background: #f1f5f9;
}
.ranking-position {
    width: 40px;
    text-align: center;
    font-size: 1.25rem;
}
.position-number {
    font-weight: 600;
    color: var(--secondary-color);
}
.ranking-info {
    flex: 1;
    margin-left: 1rem;
}
.volunteer-name {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
    transition: width 0.5s ease;
}

.volunteer-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
}

.ore-badge, .eventi-badge {
    color: var(--secondary-color);
}

.ore-badge i, .eventi-badge i {
    margin-right: 0.25rem;
}

.no-data {
    text-align: center;
    color: var(--secondary-color);
    padding: 2rem;
    font-style: italic;
}
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: -0.5rem;
    padding: 0.5rem;
}

.table {
    min-width: 800px;
}
.table-eventi td {
    line-height: 1.5;
}
.table-eventi td:nth-child(1),
.table-eventi td:nth-child(3) {
    word-break: break-word;
    hyphens: auto;
}
.table .badge {
    margin-top: 0.25rem;
}
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.site-footer {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    margin-top: 4rem;
    padding: 3rem 0 2rem;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
}

.footer-logo h3 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.footer-logo p {
    font-size: 0.9rem;
    color: #cbd5e1;
    margin: 0;
}

.footer-info {
    text-align: right;
}
.footer-info p {
    margin: 0.25rem 0;
    color: #e2e8f0;
    font-size: 0.9rem;
}
.footer-info p:first-child {
    font-weight: 500;
}
@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-info {
        text-align: center;
    }
    
    .site-footer {
        margin-top: 2rem;
        padding: 2rem 0 1.5rem;
    }
    .table{
        min-width: unset;
    }
}