@import url('https://fonts.googleapis.com/css2?family=Raleway:ital,wght@0,100..900;1,100..900&display=swap');

/* ------------------------------------------------------------------------------------------------------------------ 
   INIZIO STRUTTURALI IMPORTANTI 
   ------------------------------------------------------------------------------------------------------------------ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Personalizzazione scrollbar */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ------------------------------------------------------------------------------------------------------------------ 
   CLASSI DEI FONT RALEWAY
   ------------------------------------------------------------------------------------------------------------------ */
.raleway-thin { font-family: "Raleway", sans-serif; font-weight: 100; font-style: normal; }
.raleway-extra-light { font-family: "Raleway", sans-serif; font-weight: 200; font-style: normal; }
.raleway-light { font-family: "Raleway", sans-serif; font-weight: 300; font-style: normal; }
.raleway-regular { font-family: "Raleway", sans-serif; font-weight: 400; font-style: normal; }
.raleway-medium { font-family: "Raleway", sans-serif; font-weight: 500; font-style: normal; }
.raleway-semi-bold { font-family: "Raleway", sans-serif; font-weight: 600; font-style: normal; }
.raleway-bold { font-family: "Raleway", sans-serif; font-weight: 700; font-style: normal; }
.raleway-extra-bold { font-family: "Raleway", sans-serif; font-weight: 800; font-style: normal; }
.raleway-black { font-family: "Raleway", sans-serif; font-weight: 900; font-style: normal; }

/* ------------------------------------------------------------------------------------------------------------------ 
   STILI DI BASE
   ------------------------------------------------------------------------------------------------------------------ */
body {
    font-family: "Raleway", sans-serif;
    background-color: #f0f0f0;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Spaziature verticali standard */
.spazio_10 { height: 10px; }
.spazio_25 { height: 25px; }
.spazio_50 { height: 50px; }
.spazio_70 { height: 70px; }

/* Stile per tag "strong" con sfondo grafico */
strong {
    font-weight: 700;
    background: url(../img/sfondo-parole.png);
    background-size: cover;
    background-repeat: no-repeat;
    color: #fff;
    padding: 0px 13px 0px 10px;
    transform: rotate(358deg) !important;
    display: inline-table;
    margin-right: 5px;
}

/* ------------------------------------------------------------------------------------------------------------------ 
   FORM ELEMENTS
   ------------------------------------------------------------------------------------------------------------------ */
/* Label dei form */
label.form-label {
    font-size: 12px;
    margin-bottom: 0px;
    color: #bbbbbb;
}

label.form-label.importante-label {
    color: #d3000d;
    text-transform: uppercase;
    font-size: 17px;
    font-weight: 600;
}

/* Bottoni primari */
button.btn.btn-primary {
    background: #d3000d;
    border: 0;
    border-radius: 40px;
    padding: 10px 30px 8px 30px;
    text-transform: uppercase;
}

button.com-a4 {
    padding: 0;
    margin: 0;
}
button.com-a4 svg {
    width: 30px !important;
    height: auto;
    padding: 0;
    margin: 0;
    background: #fff;
}
button.com-a4 svg:hover {
    background: #d3000d;
    color: #fff;
    border-radius: 5px;
}
button.com-a4-piu {
    margin: 0 0 0 30px;
    padding: 0;
}
button.com-a4-piu  svg {
    width: 30px !important;
    height: auto;
    padding: 0;
    margin: 0;
    background: #fff;
}
button.com-a4-piu svg:hover {
    background: #d3000d;
    color: #fff;
        border-radius: 103px;
}
button.com-a4-meno {
    margin: 0;
    padding: 0;
}
button.com-a4-meno svg {
    width: 30px !important;
    height: auto;
    padding: 0;
    margin: 0;
    background: #fff;
}
button.com-a4-meno  svg:hover {
    background: #d3000d;
    color: #fff;
        border-radius: 103px;
}

.btn-check:checked+.btn, .btn.active, .btn.show, .btn:first-child:active, :not(.btn-check)+.btn:active {
    border: 0 !important;
}
button#closeBackgroundModal {
    float: right;
    border-radius: 30px;
    background: #dfdfdf;
    border: 0;
    padding: 8px 25px 8px 25px;
    margin-left: -150px;
}
.reset-template {
    margin: 25px 0 0 0 !important;
    font-size: 14px;
}
button.pulsante-bucato {
    border: 2px solid #000000;
    border-radius: 100px;
    padding-left: 30px;
    padding-right: 30px;
    margin-right: 15px;
    color: #000000;
}
button.pulsante-bucato:hover {
   background: #d3000d;
    border: 0;
    border-radius: 40px;
    padding: 10px 32px 8px 32px;
    color: #fff;
}
button.pulsante-bucato-tratteggiato {
    border: 2px dashed #000000;
    border-radius: 100px;
    padding-left: 30px;
    padding-right: 30px;
    margin-right: 15px;
    color: #000000;
}
button.pulsante-bucato-tratteggiato:hover {
   background: #d3000d;
    border: 0;
    border-radius: 40px;
    padding: 10px 32px 8px 32px;
    color: #fff;
}


/* Range inputs */
.form-range {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    background: #d3000d;
    border-radius: 5px;
    outline: none;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #d3000d;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2);
}

.form-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #d3000d;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
}

.form-range:active::-webkit-slider-thumb {
    background: #c1000c;
}

/* Checkbox e Radio */
.form-check-input[type="radio"],
.form-check-input[type="checkbox"] {
    border-color: #d3000d;
}

.form-check-input[type="radio"]:checked,
.form-check-input[type="checkbox"]:checked {
    background-color: #d3000d;
    border-color: #d3000d;
}

.form-check-input:focus {
    border-color: #d3000d;
    box-shadow: 0 0 0 0.25rem rgba(211, 0, 13, 0.25);
}

.form-check-label {
    font-size: 12px;
    color: #333;
    font-weight: 500;
}

/* Input disabilitato */
input:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

#csv-form button {
    background: #d3000d;
    border: 0;
    border-radius: 40px;
    padding: 5px 20px 5px 20px;
    text-transform: uppercase;
    font-size: 14px;
}

.modal-footer button.btn.btn-secondary {
  background: #d3000d;
    border: 0;
    border-radius: 40px;
    padding: 10px 30px 8px 30px;
    text-transform: uppercase;
    font-size: 14px;
}

/* ------------------------------------------------------------------------------------------------------------------ 
   STILI SPECIFICI QR CODE
   ------------------------------------------------------------------------------------------------------------------ */
/* Container e selezione formato */
.selezione_formato {
    padding: 0 0 0 20%;
    margin-top: -18px;
}

#qrcode svg {
    border-radius: 5%;
    box-shadow: 0px 0px 20px #dddddd;
}

.zona-controlli {
    padding-left: 20px;
    padding-bottom: 10px;
}

/* Input color con posizione centrale */
input.selettore-centrale {
    margin: auto;
    width: 80px;
}

/* Sfondo della sezione principale */
.sfondo-pannello {
    padding: 35px 30px 40px 40px !important;
    background-image: url(../img/sfondo_qr_opa.png);
    background-repeat: no-repeat;
    background-position: bottom left;
    background-size: 380px;
}

/* ------------------------------------------------------------------------------------------------------------------ 
   GESTIONE LOGO
   ------------------------------------------------------------------------------------------------------------------ */
/* Visualizzazione anteprima logo */
img#logoPreview {
    font-size: 12px;
}

/* Container dei loghi predefiniti */
.logo-preview-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

/* Loghi singoli */
.logo-preview {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border: 2px solid #fff;
    border-radius: 4px;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
}

.logo-preview img {
    max-width: 100%;
    max-height: 100%;
}

.logo-preview.selected {
    border-color: #d3000d;
    background-color: #fff5f5;
}

/* Container scrollable del preset logo */
#presetLogosContainer {
    width: 100%;
    height: 70px;
    overflow: hidden;
    overflow-x: scroll;
    flex-direction: column;
    margin-bottom: -40px;
    z-index: 10;
    position: relative;
}

/* ------------------------------------------------------------------------------------------------------------------ 
   PANNELLO PERSONALIZZAZIONE QR
   ------------------------------------------------------------------------------------------------------------------ */
/* Toggle di espansione */
.toggle-icon {
    display: inline-block;
    transition: transform 0.3s ease;
    font-style: normal;
    font-size: 0.8em;
    margin-left: 5px;
}

.toggle-icon.rotated {
    transform: rotate(180deg);
}

#toggleCustomization {
    color: #d3000d;
    font-size: 0.9em;
    padding: 0px 12px;
    border: 0;
    border-radius: 0;
    transition: all 0.3s ease;
    display: inline-block;
    margin: 10px 0;
}

#toggleCustomization:hover {
    background-color: #fff5f5;
    text-decoration: none;
}

/* Animazione espansione pannello */
#customizationOptions {
    overflow: hidden;
    transition: all 0.5s ease;
    opacity: 0;
    max-height: 0;
}

#customizationOptions.expanded {
    opacity: 1;
    max-height: 2000px;
    background: #ffffff;
    border: 2px dashed #cfcfcf;
    padding: 15px 20px 10px 0;
    border-radius: 10px;
    margin: -10px 0 15px 0px;
}

/* Button add template */
a.add-template_conf {
    color: #000;
    font-size: 20px;
    padding-top: 28px;
    display: grid;
}


/* Button reset */
button#resetAll {
    margin: 30px auto 0 auto;
    max-width: 220px;
}

/* Button add codice*/
button.add-codice_esterno {
    transition: background-color 0.3s;
    color: #d3000d;
    font-size: 0.9em;
    padding: 0px 12px;
    border: 0;
    border-radius: 0;
    transition: all 0.3sease;
    display: inline-block;
    margin: 32px 0 10px 0;
    background: none;
}



/* ------------------------------------------------------------------------------------------------------------------ 
   MODALE POSIZIONAMENTO SU SFONDO A4
   ------------------------------------------------------------------------------------------------------------------ */
/* Bottone per aprire la modale */
.open-background-modal {
    transition: background-color 0.3s;
    color: #d3000d;
    font-size: 0.9em;
    padding: 0px 12px;
    border: 0;
    border-radius: 0;
    transition: all 0.3sease;
    display: inline-block;
    margin: 10px 0;
    background: none;
}

.open-background-modal:hover {
     color: var(--colore_nero);
}

/* Struttura base della modale */
.background-modal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.background-modal-content {
    background-color: #fefefe;
    margin: 2% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    overflow-y: auto;
}

/* Elementi di controllo della modale */
.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

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

.modal-header {
    padding-bottom: 15px;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.modal-footer {
    padding-top: 15px;
    margin-top: 20px;
    border-top: 1px solid #eee;
    text-align: center !important;
    display: block;
}

/* Layout del contenuto della modale */
.modal-body {
    display: flex;
    flex-wrap: wrap;
}

.modal-controls {
    flex: 1;
    min-width: 300px;
    padding: 0 15px;
}

.modal-preview {
    flex: 1;
    min-width: 300px;
    padding: 0 15px;
}


/* Stili per la modale Oppure add */
.add-codice_esterno {
    transition: background-color 0.3s;
    color: #d3000d;
    font-size: 0.9em;
    padding: 0px 12px;
    border: 0;
    border-radius: 0;
    transition: all 0.3s ease;
    display: inline-block;
    margin: 10px 0;
    background: none;
}

.add-codice_esterno:hover {
    color: var(--colore_nero);
}

.titolo-guida {
    font-weight: 700;
    border-bottom: 1px dashed #848484;
    margin-bottom: 10px;
}
i.esempio-formato {
    font-size: 12px;
    display: grid;
    margin: -18px 0 18px 10px;
}
pre code {
    color: #d3000d;
}

.altezza-libera {
    height: 35px !important;
}

.loading-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: white;
}

.loading-spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Contenitore dell'anteprima A4 - CORRETTO */
.preview-a4-container {
    position: relative;
    width: 100%;
    /* Rimuoviamo l'approccio con padding-bottom fisso */
    /* padding-bottom: 60%; */
    /* Impostiamo un'altezza fissa ma proporzionata all'A4 */
    height: 0;
    padding-bottom: 100%; /* Temporaneo, verrà modificato via JavaScript */
    max-height: none; /* Rimuoviamo il limite */
    background-color: white;
    border: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

.preview-a4 {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}


/* Griglia di riferimento nell'anteprima */
.grid-reference {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.grid-horizontal {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: rgba(0,0,0,0.1);
}

.grid-vertical {
    position: absolute;
    left: 50%;
    top: 0;
    height: 100%;
    width: 1px;
    background-color: rgba(0,0,0,0.1);
}

.preview-a4-container p.text-muted {
    font-size: 12px;
    margin: auto;
    padding: 10px 0 0 10px;
    width: 100%;
    text-align: center;
}

/* Indicatore QR nel preview */
.qr-position-indicator {
    border: 2px dashed #d3000d;
    background-color: rgba(211, 0, 13, 0.1);
    z-index: 10;
    position: absolute;
    overflow: hidden;
    box-sizing: border-box;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

.qr-position-indicator::after {
    content: "+";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #d3000d;
    font-size: 16px;
    font-weight: bold;
}

.qr-position-indicator svg {
    width: 100%;
    height: 100%;
    box-shadow: none;
    border-radius: 0;
}

/* Stili per l'alert informativo */
.alert {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
    font-size: 14px;
}

.alert-info {
    background-color: #f5f5f5;
    color: #000000;
    border: 0px solid #bee5eb;
    font-style: italic;
}

.alert.alert-info.mt-4 {
    height: 150px;
    padding: 20px 20px 20px 30px;
}

/* Spinner di caricamento */
.loading-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: white;
}

.loading-spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid white;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ------------------------------------------------------------------------------------------------------------------ 
   RESPONSIVE
   ------------------------------------------------------------------------------------------------------------------ */
@media (max-width: 768px) {
    .modal-body {
        flex-direction: column;
    }
    
    .modal-controls, 
    .modal-preview {
        width: 100%;
        min-width: 100%;
    }
    
    .background-modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .selezione_formato {
        padding: 0 10%;
    }
}



/* ------------------------------------------------------------------------------------------------------------------ 
   CSS MOMENTANEI
   ------------------------------------------------------------------------------------------------------------------ */
.display-none {
    display: none;
}
img.logo-desk {
    width: 200px;
}