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

:root {
    --primary-color: #003366;
    --primary-light: #004d99;
    --primary-dark: #002244;
    --secondary-color: #0069d9;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-gray: #f8f9fa;
    --medium-gray: #dee2e6;
    --dark-gray: #495057;
    --text-color: #212529;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.15);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

/* ===== NAVIGATION ===== */
.navbar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    padding: 1rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
    transition: var(--transition);
}

.nav-brand:hover {
    transform: scale(1.05);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    position: relative;
}

.nav-link:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-2px);
}

.nav-link.btn-login {
    background: var(--success-color);
}

.nav-link.btn-logout {
    background: var(--danger-color);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 0.5rem;
}

.nav-toggle span {
    width: 25px;
    height: 3px;
    background: white;
    margin: 3px 0;
    border-radius: 2px;
    transition: var(--transition);
}

.user-info {
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    margin-left: 1rem;
}

/* ===== CONTAINER E LAYOUT ===== */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.content-wrapper {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: var(--transition);
}

.content-wrapper:hover {
    box-shadow: var(--shadow-hover);
}

/* ===== TIPOGRAFIA ===== */
h1 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-weight: 600;
    font-size: 2.2rem;
}

h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

h3 {
    color: var(--primary-dark);
    margin-bottom: 0.8rem;
    font-size: 1.4rem;
}

/* ===== BOTTONI ===== */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--secondary-color);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
    margin: 0.25rem;
}

.btn:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-success {
    background: var(--success-color);
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: var(--danger-color);
}

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

.btn-warning {
    background: var(--warning-color);
    color: var(--text-color);
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* ===== TABELLE ===== */
.table-responsive {
    overflow-x: auto;
    margin: 1rem 0;
}

.tbl {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.tbl th {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    padding: 1rem 0.75rem;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.tbl td {
    padding: 1rem 0.75rem;
    border-bottom: 1px solid var(--medium-gray);
    transition: var(--transition);
}

.tbl tr:hover td {
    background: var(--light-gray);
}

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

.win {
    color: var(--success-color);
    font-weight: bold;
}

.loss {
    color: var(--danger-color);
    font-weight: bold;
}

.tbl .tot {
    background: var(--light-gray);
    font-weight: bold;
}

/* ===== FORM ===== */
fieldset {
    border: 2px solid var(--medium-gray);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin: 1rem 0;
    background: white;
}

legend {
    color: var(--primary-color);
    font-weight: bold;
    padding: 0 1rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-gray);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--medium-gray);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    background: white;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(0,105,217,0.1);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

/* ===== MESSAGGI ===== */
.err, .error {
    background: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--danger-color);
    margin: 1rem 0;
}

.success {
    background: #d4edda;
    color: #155724;
    padding: 1rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--success-color);
    margin: 1rem 0;
}

.info {
    background: #cce7ff;
    color: #004085;
    padding: 1rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--secondary-color);
    margin: 1rem 0;
}

/* ===== STATISTICHE ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
    display: block;
}

.stat-label {
    color: var(--dark-gray);
    font-weight: 500;
    margin-top: 0.5rem;
}

/* ===== FOOTER ===== */
.footer {
    background: var(--primary-color);
    color: white;
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 3rem;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablet */
@media (max-width: 1024px) {
    .container {
        padding: 0 1rem;
    }
    
    .content-wrapper {
        padding: 1.5rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1rem;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background: var(--primary-color);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding-top: 2rem;
        transition: var(--transition);
        z-index: 999;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .nav-toggle.active span:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
    }
    
    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .nav-toggle.active span:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
    }
    
    .container {
        margin: 1rem auto;
    }
    
    .content-wrapper {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .tbl {
        font-size: 0.9rem;
    }
    
    .tbl th,
    .tbl td {
        padding: 0.5rem 0.25rem;
    }
    
    .btn {
        width: 100%;
        margin: 0.25rem 0;
    }
    
    .btn-small {
        width: auto;
        display: inline-block;
    }
    
    fieldset {
        padding: 1rem;
    }
    
    .user-info {
        display: none;
    }
}

/* Mobile piccolo */
@media (max-width: 480px) {
    .nav-container {
        padding: 0 0.5rem;
    }
    
    .nav-brand {
        font-size: 1.2rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .tbl {
        font-size: 0.8rem;
    }
    
    .table-responsive {
        margin: 0.5rem 0;
    }
}

/* ===== UTILITA' ===== */
.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; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }

/* Animazioni */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* Loading spinner */
.spinner {
    border: 4px solid var(--medium-gray);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 2s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* --- Search filters ------------------------------------------------ */
.filter-form { 
    display:flex; flex-wrap:wrap; gap:0.75rem; 
    align-items:flex-end; 
    margin-bottom:1rem;
}

.filter-form .filter-sm { width:110px; }
.filter-form .filter-md { width:150px; }
.filter-form .filter-lg { width:200px; }

@media (max-width:768px) {          /* mobile: torna a colonna */
    .filter-form { flex-direction:column; align-items:stretch; }
    .filter-form .filter-sm,
    .filter-form .filter-md,
    .filter-form .filter-lg { width:100%; }
}
.footer{
    margin-top:30px;padding:12px 0;background:#003366;color:#fff;
    text-align:center;font-size:.9rem;line-height:1.4;
}
.footer a{color:#9dfdff;text-decoration:none}
