/*
 * foglio di stile principale dell'applicazione AccreditaMe WEB.
 * include tutti gli stili grafici, la palette di colori istituzionale SSC Napoli (blu e azzurro),
 * la formattazione dei componenti, delle tabelle, dell'overlay di caricamento e della modifica inline.
 */

:root {
    --primary-color: #0A1451;
    --secondary-color: #A1B8CC;
    --napoli-blue: #0080ff;
    --napoli-blue-hover: #0066cc;
    --bg-lightgrey: #f9f9f9;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.body-class {
    height: 100%;
    align-items: center;
    padding-top: 40px;
    padding-bottom: 40px;
    background-color: #f5f5f5;
}

.form-signin {
    width: 100%;
    max-width: 330px;
    padding: 15px;
    margin: auto;
    box-sizing: border-box;
}

.form-signin .form-floating:focus-within {
    z-index: 2;
}

.form-signin input[type="text"],
.form-signin input[type="username"] {
    margin-bottom: -1px;
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
}

.form-signin input[type="password"] {
    margin-bottom: 10px;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.alert-fixed {
    position: fixed;
    top: 0px;
    left: 0px;
    width: 100%;
    z-index: 9999;
    border-radius: 0px;
}

#btn-back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: none;
    border-radius: 100%;
}

.no-underline {
    text-decoration: none;
}

.card-homepage {
    max-width: 18rem;
    cursor: pointer;
}

.card-homepage:hover {
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}

.icon-card-badge {
    top: 10px;
    right: 15px;
}

.bg-lightgrey {
    background-color: var(--bg-lightgrey);
}

footer {
    background-color: #efefef;
    padding-top: 15px;
    padding-bottom: 15px;
    margin-top: auto;
    text-align: center;
}

.primary-color-ops {
    color: var(--primary-color);
}

.secondary-color-ops {
    color: var(--secondary-color);
}

.error-message {
    color: #dc3545;
    margin-left: 3px;
}

.title-section {
    font-size: 1.25rem;
    font-weight: 700;
    color: #555555;
}

.card-section {
    background: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.1);
    padding: 2rem;
    margin-bottom: 2rem;
}

.section-title {
    font-weight: 600;
    font-size: 1.15rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 0.5rem;
    color: var(--primary-color);
}

/* tabelle responsive */
.table-responsive {
    max-height: 500px;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive table th,
.table-responsive table td {
    white-space: nowrap;
    vertical-align: middle;
}

/* overlay di caricamento globale */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
}

.loading-box {
    background: #ffffff;
    padding: 30px 40px;
    border-radius: 12px;
    text-align: center;
    min-width: 250px;
    max-width: 90vw;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.2);
}

/* stili per tabella accrediti e preview badge */
.accrediti-table-wrapper {
    max-height: 280px;
    min-height: 160px;
}

.row-accredito-focus {
    outline: 2px solid currentColor;
    outline-offset: -2px;
}

.badge-preview-wrapper {
    max-width: 440px;
    min-height: 480px;
    width: 100%;
}

.badge-preview-img {
    max-height: 550px;
    object-fit: contain;
}

.badge-no-image-box {
    min-height: 400px;
}

/* stili per la riga in modifica */
.table-row-editing {
    background-color: #eaf3fb !important;
}

.table-row-editing td {
    background-color: transparent !important;
}

.table-row-editing .form-control {
    border: 1.5px solid var(--napoli-blue);
    background-color: #ffffff;
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
}

.table-row-editing .form-control:focus {
    border-color: var(--napoli-blue-hover);
    box-shadow: 0 0 0 0.2rem rgba(0, 128, 255, 0.25);
}

/* celle interattive con cursore e highlight hover */
.cell-clickable {
    cursor: pointer;
}

.cell-clickable:hover {
    background-color: #f0f7ff !important;
    color: var(--napoli-blue-hover);
}

/* pulsanti per le azioni nella tabella accrediti e report */
.btn-action-save,
.btn-action-cancel,
.btn-action-edit,
.btn-action-delete,
.btn-action-reactivate {
    padding: 0.2rem 0.45rem;
    font-size: 0.8rem;
    line-height: 1.2;
    border-radius: 0.25rem;
}

.btn-action-save {
    background-color: var(--napoli-blue);
    border-color: var(--napoli-blue);
    color: #ffffff;
}

.btn-action-save:hover {
    background-color: var(--napoli-blue-hover);
    border-color: var(--napoli-blue-hover);
    color: #ffffff;
}

.btn-action-cancel {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #ffffff;
}

.btn-action-cancel:hover {
    background-color: #5a6268;
    border-color: #545b62;
    color: #ffffff;
}

.btn-action-edit {
    border-color: var(--napoli-blue);
    color: var(--napoli-blue);
    background-color: transparent;
}

.btn-action-edit:hover {
    background-color: var(--napoli-blue);
    color: #ffffff;
}

.btn-action-delete {
    border-color: #dc3545;
    color: #dc3545;
    background-color: transparent;
}

.btn-action-delete:hover {
    background-color: #dc3545;
    color: #ffffff;
}

.report-row-annullato {
    background-color: #f8d7da !important;
    color: #721c24 !important;
}

.report-row-annullato td {
    background-color: transparent !important;
    color: #721c24 !important;
}

.btn-action-reactivate {
    border-color: #198754;
    color: #198754;
    background-color: transparent;
}

.btn-action-reactivate:hover {
    background-color: #198754;
    color: #ffffff;
}

.report-table-wrapper {
    min-height: 320px;
    max-height: 520px;
    scrollbar-gutter: stable;
}

#reportTable {
    table-layout: fixed;
    min-width: 70rem;
}

#reportTable th,
#reportTable td {
    white-space: normal;
    overflow-wrap: anywhere;
}

#reportTable th:first-child { width: 2.5rem; }
#reportTable th:nth-child(2) { width: 7rem; }
#reportTable th:nth-child(6) { width: 6.5rem; }
#reportTable th:nth-child(11) { width: 6rem; }
#reportTable th:last-child { width: 13rem; }

#reportTable .report-actions-heading,
#reportTable .action-col {
    position: sticky;
    right: 0;
    z-index: 2;
    white-space: nowrap;
}

#reportTable .report-actions-heading { z-index: 3; }
#reportTable .action-col { background-color: var(--bs-table-bg, #fff); }
#reportTable .report-row-annullato .action-col { background-color: #f8d7da !important; }

.servizi-table-wrapper {
    max-height: 480px;
}

/* ==========================================================================
   adattamento responsive per schermi piccoli (mobile e tablet)
   ========================================================================== */

/* tablet e smartphone (< 992px) */
@media (max-width: 991.98px) {
    .badge-preview-wrapper {
        min-height: 280px;
        max-height: 400px;
    }
    
    .badge-no-image-box {
        min-height: 240px;
        padding: 2rem !important;
    }

    .badge-preview-img {
        max-height: 380px;
    }
}

/* smartphone e tablet piccoli (< 768px) */
@media (max-width: 767.98px) {
    /* previene auto-zoom su iOS Safari */
    .form-control, .form-select {
        font-size: 16px;
    }

    .card-section {
        padding: 1.25rem 1rem;
        margin-bottom: 1.25rem;
    }

    .accrediti-table-wrapper {
        max-height: 260px;
    }

    .badge-preview-wrapper {
        min-height: 200px;
        max-height: 300px;
    }

    .badge-no-image-box {
        min-height: 180px;
        padding: 1.5rem !important;
    }

    .badge-preview-img {
        max-height: 280px;
    }

    /* dimensione touch-target per pulsanti azione */
    .btn-action-save,
    .btn-action-cancel,
    .btn-action-edit,
    .btn-action-delete,
    .btn-action-reactivate {
        min-width: 30px;
        min-height: 30px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0.25rem 0.45rem;
    }
}

/* smartphone piccoli (< 576px) */
@media (max-width: 575.98px) {
    .container-fluid, .container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .card-homepage {
        max-width: 100%;
    }

    .bg-lightgrey.p-4 {
        padding: 1.25rem 0.85rem !important;
    }

    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-body {
        padding: 1.25rem 0.85rem !important;
    }

    .modal-footer {
        padding: 0.75rem 0.85rem !important;
        flex-direction: column-reverse;
        gap: 0.5rem;
    }

    .modal-footer > * {
        width: 100% !important;
        margin: 0 !important;
    }
}
