body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    margin: 0;
    padding: 0;
}

.login-container {
    width: 90%;
    max-width: 350px;
    margin: 50px auto;
    background: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.login-container h2 {
    text-align: center;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
}

.form-group input {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
}

button {
    width: 100%;
    padding: 10px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

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

/* Navigation Bar */
.main-nav {
    background-color: #333;
    color: white;
    padding: 0 10px;
}

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

.nav-brand a {
    color: white;
    text-decoration: none;
    font-size: 1rem;
    font-weight: bold;
    white-space: nowrap;
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    height: 100%;
}

.nav-menu li {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    padding: 0 15px;
    height: 100%;
    display: flex;
    align-items: center;
    transition: background 0.3s;
}

.nav-menu a:hover {
    background-color: #444;
}

/* Submenu */
.submenu {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #444;
    list-style: none;
    padding: 0;
    min-width: 200px;
    z-index: 1000;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.submenu a {
    padding: 10px 15px;
}

.nav-menu li.has-submenu:hover .submenu,
.nav-menu li.has-submenu.active-submenu .submenu {
    opacity: 1;
    visibility: visible;
}

/* Lang nav inside menu */
.lang-nav {
    display: flex;
    align-items: center;
    border-left: 1px solid #555;
    margin-left: 10px;
}

.lang-nav a {
    padding: 0 5px;
    font-size: 0.8rem;
}

/* Nav Toggle (Hamburger) */
.nav-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    background: transparent;
    border: none;
}

.nav-toggle .bar {
    width: 25px;
    height: 3px;
    background-color: white;
    margin: 3px 0;
    transition: 0.3s;
}

.welcome-page {
    text-align: center;
    margin-top: 50px;
}

.logo {
    max-width: 80%;
    width: 250px;
    height: auto;
    margin-bottom: 20px;
}

/* Detail Pages */
.detail-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.detail-group {
    flex: 1 1 300px;
    display: flex;
    flex-direction: column;
}

.detail-group label {
    font-weight: bold;
    color: #555;
    font-size: 0.8em;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.detail-group span {
    font-size: 1em;
    color: #333;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #eee;
    min-height: 1.2em;
}

.detail-group.full-width {
    flex: 1 1 100%;
}

.detail-content {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #eee;
    border-left: 4px solid #007bff;
    min-height: 50px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

@media (max-width: 600px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Filters */
.filters-container {
    background: #f8f9fa;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.filters-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-size: 0.85rem;
    font-weight: bold;
    color: #555;
}

.filter-group input {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
}

.filter-group input[type="text"] {
    min-width: 200px;
}

.filter-group input[type="date"], .datepicker {
    width: 130px;
}

.filter-actions {
    display: flex;
    gap: 5px;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    font-size: 1.2rem;
    cursor: pointer;
    border: 1px solid #ccc;
    background-color: #f8f9fa;
    color: #333;
    border-radius: 4px;
    transition: all 0.2s;
    text-decoration: none;
    vertical-align: middle;
}

.btn-icon:hover {
    background-color: #e2e6ea;
    border-color: #dae0e5;
    color: #007bff;
}

.btn-icon.btn-primary {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.btn-icon.btn-primary:hover {
    background-color: #0069d9;
    border-color: #0062cc;
    color: white;
}

.btn-icon.btn-success {
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}

.btn-icon.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
    color: white;
}

.btn-icon.btn-secondary {
    background-color: #6c757d;
    color: white;
    border-color: #6c757d;
}

.btn-icon.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
    color: white;
}

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

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

.btn-filter {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

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

.btn-clear {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-block;
}

.btn-clear:hover {
    background-color: #5a6268;
}

@media (max-width: 768px) {
    .filters-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group input {
        width: 100% !important;
    }
    
    .filter-actions {
        margin-top: 10px;
    }
}

.lang-selector {
    text-align: right;
    padding: 10px;
}

.error-message {
    color: red;
    text-align: center;
    margin-bottom: 10px;
}

.captcha-flex {
    display: flex;
    align-items: center;
    gap: 10px;
}

.captcha-flex img {
    border: 1px solid #ccc;
    height: 40px;
}

.captcha-flex input {
    flex: 1;
    min-width: 100px;
}

/* Data Listing Styles */
.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.data-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Desktop Table Simulation */
@media (min-width: 769px) {
    .data-header {
        display: flex;
        background-color: #333;
        color: white;
        font-weight: bold;
        padding: 10px;
        border-radius: 5px 5px 0 0;
    }
    
    .data-row {
        display: flex;
        background-color: white;
        padding: 10px;
        border-bottom: 1px solid #eee;
        transition: background 0.2s;
        align-items: center;
    }
    
    .data-row:hover {
        background-color: #f9f9f9;
    }
    
    .col {
        flex: 1;
        padding: 0 5px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .col-id { flex: 0 0 60px; }
    .col-actions { flex: 0 0 80px; text-align: center; }
}

/* Mobile Card Layout */
@media (max-width: 768px) {
    .data-header {
        display: none;
    }
    
    .data-row {
        background-color: white;
        padding: 15px;
        border-radius: 8px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .col {
        display: flex;
        justify-content: space-between;
    }
    
    .col::before {
        content: attr(data-label);
        font-weight: bold;
        color: #666;
        margin-right: 10px;
    }
    
    .col-id {
        border-bottom: 1px solid #eee;
        padding-bottom: 5px;
        margin-bottom: 5px;
        font-size: 0.9rem;
    }
    
    .col-actions {
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid #eee;
        display: flex;
        justify-content: flex-end;
        gap: 10px;
    }
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .nav-brand {
        flex: 1;
        display: flex;
        align-items: center;
    }

    .nav-toggle {
        display: flex;
        flex-direction: column;
        align-items: flex-end; /* Allinea le barre a destra */
        justify-content: center;
        padding: 5px;
        z-index: 1001;
        cursor: pointer;
        background: transparent;
        border: none;
        margin-left: auto; /* Garantisce la posizione a destra nel container */
    }

    .nav-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 40px;
        left: 0;
        background-color: #333;
        z-index: 1000;
        height: auto;
        padding-top: 10px;
        box-shadow: 0 5px 10px rgba(0,0,0,0.2);
    }

    .nav-menu li {
        width: 100%;
        height: auto;
        display: block; /* Sotto l'altro */
    }

    .nav-menu a {
        padding: 10px 15px;
        border-bottom: 1px solid #444;
        width: 100%;
        display: block;
        height: auto;
    }

    .nav-menu.active {
        display: flex;
    }

    .submenu {
        position: static;
        background-color: #222;
        width: 100%;
        display: none;
        opacity: 1;
        visibility: visible;
        box-shadow: none;
        transition: none;
    }

    .submenu li {
        padding-left: 20px;
        width: 100%;
    }

    .submenu a {
        border-bottom: 1px solid #333;
        font-size: 0.9rem;
    }

    .has-submenu.open .submenu {
        display: block;
    }

    .lang-nav {
        border-left: none;
        margin-left: 0;
        padding: 10px;
        justify-content: center;
        display: flex;
        flex-direction: row !important;
        flex-wrap: nowrap;
        width: 100%; /* Occupa tutta la larghezza per centrare i link */
    }

    .lang-nav a {
        border-bottom: none !important;
        width: auto !important;
        padding: 5px 10px;
        display: inline-flex !important;
        height: auto !important;
    }

    .login-container {
        margin-top: 20px;
        padding: 15px;
    }
    
    .captcha-flex {
        flex-direction: column;
        align-items: stretch;
    }

    .captcha-flex img {
        width: 100%;
        height: auto;
        max-width: 150px;
        margin: 0 auto;
    }
}
