/* CSS Aggiornato */

/* Stili generali */
.container {
    margin-top: 2rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* Stili per gli header */
h1 {
    border: 2px #eee solid;
    color: #800020; /* Borgogna */
    text-align: center;
    padding: 10px;
}

h2.subtitle {
    font-size: 1.25rem;
    color: #000;
    text-align: center;
    margin-top: 10px;
    margin-bottom: 20px;
}

/* Stili per i pulsanti */
.btn-primary, .btn-primary:focus {
    color: #fff;
    background-color: #0008ff;
    border-color: #0008ff;
}

.btn-primary:hover {
    background-color: #0007e6;
    border-color: #0007e6;
}

.btn-secondary, .btn-secondary:focus {
    color: #fff;
    background-color: #777;
    border-color: #777;
}

.btn-secondary:hover {
    background-color: #666;
    border-color: #666;
}

.btn-outline-secondary, .btn-outline-secondary:focus {
    color: #2c3e50;
    border-color: #2c3e50;
}

.btn-outline-secondary:hover {
    color: white;
    background-color: #2c3e50;
}

.btn-link, .btn-link:focus {
    color: #3498db;
    text-decoration: underline;
}

.btn-link:hover {
    color: #2980b9;
}

.btn-back-to-all, .btn-back-to-all:focus {
    color: #fff;
    background-color: #563c7d;
    border-color: #563c7d;
}

.btn-back-to-all:hover {
    background-color: #452d63;
    border-color: #452d63;
}

/* Stili per i gruppi di input */
.form-group {
    margin-bottom: 1rem;
}

.input-group-append .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group .input-group-append .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Stili per il testo */
.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 1.5rem;
}

/* Stili per i messaggi flash */
.alert {
    margin-top: 20px;
    padding: 15px;
    border-radius: 4px;
    background-color: #f8f9fa;
    border: 1px solid #e2e3e5;
    color: #6c757d;
    box-shadow: none;
}

.alert-success {
    background-color: #e9f6ec;
    border-color: #d4edda;
    color: #3c763d;
}

.alert-danger {
    background-color: #fbeae9;
    border-color: #f5c6cb;
    color: #a94442;
}

/* Stili per il badge */
.badge-tag {
    display: inline-block;
    background-color: #007bff;
    color: #fff;
    padding: 0.2em 0.4em;
    font-size: 0.9em;
    font-weight: 500;
    border-radius: 0.2em;
    margin-right: 0.3em;
    margin-bottom: 0.2em;
    line-height: 1;
    vertical-align: middle;
}

/* Stili per il modal dell'immagine */
#image-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    padding-top: 100px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.9);
}

#image-modal .modal-content {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    animation: zoom 0.6s;
}

#image-modal .close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    z-index: 1050; /* Assicura che la X sia sopra l'immagine */
}

#image-modal .close:hover,
#image-modal .close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

/* Stili specifici per il container */
.table-container {
    padding: 0;
    width: 100%;
    margin-bottom: 1rem;
}

.table {
    width: 100%;
    margin-bottom: 1rem;
}

.image-container {
    width: 300px;
    height: 300px;
    overflow: hidden;
}

.image {
    max-width: 100%;
    max-height: 100%;
    display: block;
    cursor: pointer;
    transition: 0.3s;
}

.image:hover {
    opacity: 0.7;
}

/* Stili per la barra di navigazione */
.navbar .nav-link .fas {
    margin-right: 0.5rem;
    color: #343a40; /* Colore grigio scuro per le icone */
}

.navbar .nav-link .fa-sign-out-alt {
    margin-right: 0;
}

.navbar .nav-link {
    display: flex;
    align-items: center;
    color: #343a40; /* Colore grigio scuro per i link */
}

.navbar .nav-item {
    margin-left: 0.5rem;
}

/* Gestione del layout per dispositivi mobili */
@media (max-width: 576px) {
    .navbar .ml-auto {
        margin-left: auto !important;
        display: flex;
    }

    .navbar .d-flex.align-items-center {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between;
    }

    .navbar .d-lg-flex {
        display: none !important;
    }

    .navbar .nav-link {
        padding: 0.5rem;
    }

    .d-flex {
        display: flex !important;
        flex-direction: column;
    }

    .justify-content-around {
        justify-content: center;
    }

    .form-group.d-flex button,
    .form-group.d-flex a {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .table {
        width: 100%;
        margin-bottom: 0;
        display: flex;
        flex-direction: column;
    }

    .table thead {
        display: none;
    }

    .table tbody,
    .table tbody tr {
        display: block;
        width: 100%;
    }

    .table tbody tr {
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 0.25rem;
        padding: 0.75rem;
        background-color: #fff;
        box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
    }

    .table tbody tr td {
        display: block;
        padding: 0.5rem 1rem;
        text-align: right; /* Allinea il contenuto delle celle a destra */
        word-break: break-word; /* Gestisce il testo lungo andando a capo */
        border-top: 1px solid #dee2e6; /* Aggiunge un bordo superiore per ogni cella */
    }

    .table tbody tr td::before {
        content: attr(data-label); /* Utilizza l'attributo data-label per il contenuto del before */
        font-weight: bold;
        display: block;
        margin-bottom: 0.5rem;
    }

    .table tbody tr td img {
        width: auto;
        max-width: 100%;
        height: auto;
    }
}

/* Specifiche per la gestione dei pulsanti nella pagina dei dettagli del link */
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.button-group button,
.button-group a {
    flex: 1;
}

@media (max-width: 576px) {
    .button-group {
        flex-direction: column;
    }

    .button-group button,
    .button-group a {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* Pulsanti solo su desktop */
.desktop-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 1rem;
}

@media (max-width: 576px) {
    .desktop-buttons {
        display: none;
    }
}

/* Pulsanti solo su mobile */
.mobile-buttons {
    display: none;
}

@media (max-width: 576px) {
    .mobile-buttons {
        display: flex;
        flex-direction: column;
    }

    .mobile-buttons button,
    .mobile-buttons a {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* Stili per troncare l'URL con "..." */
.table td a {
    word-break: break-all; /* Gestisce il testo lungo andando a capo */
    overflow-wrap: break-word; /* Aggiunge il supporto per le parole lunghe */
    display: inline-block;
    max-width: 100%;
    text-align: left; /* Allinea il testo del link a sinistra */
    vertical-align: middle;
}

/* Gestione del layout per dispositivi mobili */
@media (max-width: 576px) {
    .table {
        width: 100%;
        margin-bottom: 0;
        display: block;
        overflow-x: auto; /* Abilita lo scroll orizzontale */
    }

    .table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 0.25rem;
        padding: 0.75rem;
        background-color: #fff;
    }

    .table tbody tr td {
        display: block;
        padding: 0.5rem 1rem;
        text-align: right; /* Allinea il contenuto delle celle a destra */
        word-break: break-word; /* Gestisce il testo lungo andando a capo */
        border-top: 1px solid #dee2e6; /* Aggiunge un bordo superiore per ogni cella */
    }

    .table tbody tr td::before {
        content: attr(data-label); /* Utilizza l'attributo data-label per il contenuto del before */
        font-weight: bold;
        display: block;
        margin-bottom: 0.5rem;
    }

    .table tbody tr td img {
        width: auto;
        max-width: 100%;
        height: auto;
    }
}
