/* Sidebar Responsive */
@media (max-width: 768px) {
    .sidebar {
        left: -100%;
        width: 80%;
    }
    .sidebar.active {
        left: 0;
    }
    .main-content {
        margin-left: 0 !important;
    }
    .grid-stats {
        grid-template-columns: 1fr 1fr !important;
    }
}

/* Fix per input su mobile */
input, select, button {
    font-size: 16px !important; /* Evita lo zoom automatico su iPhone */
}

.content-wrapper {
    padding: 15px;
}


/* =========================================
   RESET E VARIABILI 
   ========================================= */
:root {
    --sidebar-width: 260px;
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --bg-color: #f4f7f6;
    --white: #ffffff;
    --text-dark: #333;
    --text-light: #7f8c8d;
    --border-color: #e0e0e0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-dark);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* =========================================
   SIDEBAR (MENU LATERALE)
   ========================================= */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--primary-color);
    color: var(--white);
    position: fixed;
    left: 0;
    top: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar.hidden {
    left: calc(var(--sidebar-width) * -1);
}

.sidebar-header {
    padding: 20px;
    background: #1a252f;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.menu-links {
    list-style: none;
    padding: 15px 0;
    flex-grow: 1;
}

.menu-sep {
    padding: 20px 20px 5px;
    font-size: 0.7rem;
    color: #5d6d7e;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.menu-links li a {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    color: #bdc3c7;
    text-decoration: none;
    transition: all 0.2s;
    border-left: 4px solid transparent;
}

.menu-links li a:hover {
    background: #34495e;
    color: var(--white);
    border-left: 4px solid var(--accent-color);
}

.menu-links li a i {
    margin-right: 15px;
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

/* =========================================
   MAIN CONTENT
   ========================================= */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: all 0.3s ease;
    width: 100%;
}

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

/* Top Bar */
.top-bar {
    height: 65px;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 999;
}

.hamburger-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary-color);
    transition: transform 0.2s;
}

.hamburger-btn:hover {
    transform: scale(1.1);
}

.user-profile {
    display: flex;
    align-items: center;
    font-weight: 600;
}

.user-profile i {
    font-size: 1.5rem;
    margin-right: 10px;
    color: var(--accent-color);
}

/* =========================================
   CARDS E CONTENUTI
   ========================================= */
.content-wrapper {
    padding: 30px;
}

h2 {
    margin-bottom: 25px;
    color: var(--primary-color);
    font-weight: 700;
}

.card {
    background: var(--white);
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
}

.card h3 {
    margin-bottom: 20px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    color: var(--secondary-color);
}

.card h3 i {
    margin-right: 10px;
    color: var(--accent-color);
}

/* =========================================
   TABELLE
   ========================================= */
.table-container {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th {
    background: #f8f9fa;
    color: var(--text-light);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 15px;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

tr:hover {
    background-color: #f9fbff;
}

/* =========================================
   FORM E INPUT
   ========================================= */
form {
    width: 100%;
}

input, select, textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border 0.3s;
    outline: none;
}

input:focus, select:focus {
    border-color: var(--accent-color);
}

.btn-save {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    transition: opacity 0.2s;
    text-align: center;
}

.btn-save:hover {
    opacity: 0.9;
}

.btn-delete {
    background: var(--danger-color);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.btn-delete:hover {
    background: #c0392b;
}

/* =========================================
   BADGES E STATI
   ========================================= */
.role-badge {
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 20px;
    color: white;
    font-weight: bold;
    text-transform: uppercase;
}

.superadmin { background: #8e44ad; }
.manager { background: #2980b9; }
.client { background: #7f8c8d; }

.status-badge {
    padding: 5px 12px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: bold;
    text-decoration: none;
}

.active { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.inactive { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }

/* =========================================
   ALERTS
   ========================================= */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    text-align: center;
    font-weight: 600;
}

.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 992px) {
    .sidebar {
        left: calc(var(--sidebar-width) * -1);
    }
    .sidebar.active {
        left: 0;
    }
    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 600px) {
    .content-wrapper { padding: 15px; }
    .top-bar { padding: 0 15px; }
    .grid-form { grid-template-columns: 1fr !important; }
}