/* RESET E VARIABILI */
*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --primary-green: hsl(135, 69%, 71%);
    --dark-bg: #0c0c0c;
    --border-color: rgba(255, 255, 255, 0.2);
}

body {
    margin: 0;
    font-family: "Figtree", sans-serif;
}

.lab-container p {
    font-size: 18px;
}

/* STRUTTURA PRINCIPALE */
.cryptoLAB {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.intro {
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

/* IL FORM */
#cryptForm {
    display: flex;
    gap: 30px;
    width: 100%;
    align-items: flex-start;
}

/* COLONNE LATERALI: Identiche e i componenti si allungano in larghezza */
#crypto-left,
#crypto-rigth {
    flex: 1;
    /* Ampiezza uguale tra left e right */
    display: flex;
    flex-direction: column;
    align-items: stretch;
    /* Forza i componenti a occupare tutta la larghezza */
    min-width: 0;
}

#crypto-rigth {
    width: 100%;
}

/* ZONA CENTRALE PARAMETRI */
.parametri {
    width: 100%;
    max-width: 100%;
    flex-shrink: 0;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* TEXTAREA: Dimensione fissa, larghezza totale */
textarea {
    width: 100%;
    height: 200px;
    padding: 12px;
    font-size: 20px;
    border: 2px solid #555;
    border-radius: 8px;
    resize: none;
    /* Impedisce l'ingrandimento manuale */
    background-color: rgba(20, 20, 20, 0.8);
    color: rgba(255, 255, 255, 0.682);
    transition: border-color 0.3s, box-shadow 0.3s;
    display: block;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 8px var(--primary-green);
}

/* ELEMENTI INTERNI (LABEL, INPUT) */
.label-text {
    margin-top: 15px;
    margin-bottom: 5px;
    font-weight: bold;
    color: white;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.bookmarkBtn {
    width: 120%;
    height: 40px;
    border-radius: 40px;
    border: 1px solid rgba(255, 255, 255, 0.349);
    background-color: rgb(12, 12, 12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition-duration: 0.3s;
    overflow: hidden;
    position: relative;
    margin-top: 5px;
}

.IconContainer {
    width: 30px;
    height: 30px;
    background: linear-gradient(to bottom, #80e89a, #66a275);
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 2;
    transition-duration: 0.3s;
    position: absolute;
    left: 5px;
}

.icon {
    border-radius: 1px;
}

.text {
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 1;
    transition-duration: 0.3s;
    font-size: 1.04em;
    white-space: nowrap;
    padding-left: 30px;
}

.bookmarkBtn:hover {
    box-shadow: 0px 0px 10px 0px #80e89a;
    border: 2px solid #80e89a;
}

.bookmarkBtn:hover .IconContainer {
    transform: scale(1.1);
}

.bookmarkBtn:hover .text {
    color: #80e89a;
}

.bookmarkBtn:active {
    transform: scale(0.95);
    transition-duration: 0.3s;
}

/* ERRORI */
#error-message {
    color: #e74c3c;
    min-height: 1.5em;
    font-size: 0.9em;
    margin-top: 5px;
}

#controls-automatico {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    width: 100%;
    gap: 20px;
    padding-top: 10px;

    border-top: 2px solid rgba(255, 255, 255, 0.349);
}

@media (max-width: 768px) {
    #controls-automatico {
        border-bottom: 2px solid rgba(255, 255, 255, 0.349);
    }
}

.rsa-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    margin-left: 10px;
}

#buttonsGM {
    margin-top: 20px;
    padding-top: 5px;
    border-top: 2px solid rgba(255, 255, 255, 0.349);
    width: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.buttonsGM {
    width: 90%;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.controls-automatico-div {
    display: flex !important;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    justify-content: center;
    align-items: center;
}

label {
    font-family: 'Inter', sans-serif;
    color: #ffffff;
    font-size: 0.9em;
    display: flex;
    flex-direction: row;
    /* Elementi affiancati */
    align-items: center;
    /* Centrati verticalmente */
    gap: 15px;
}

#algoSelect {
    appearance: none;
    -webkit-appearance: none;
    width: 150px;
    height: 40px;
    padding: 0 40px 0 20px;

    border-radius: 40px;
    border: 1px solid rgba(255, 255, 255, 0.349);
    background-color: rgb(12, 12, 12);
    color: white;
    cursor: pointer;
    font-size: 1.04em;
    transition-duration: 0.3s;
}

/* Hover e interazioni */
#algoSelect:hover {
    box-shadow: 0px 0px 10px 0px #80e89a;
    border: 1px solid #80e89a;
    color: #80e89a;
}

#algoSelect:focus {
    outline: none;
    border: 1px solid #80e89a;
}

#algoSelect:active {
    transform: scale(0.95);
}

/* Opzioni */
#algoSelect option {
    background-color: rgb(12, 12, 12);
    color: white;
}

/* Il tuo div contenitore */
#div-algorithm {
    display: flex;
    flex-direction: row;
    width: 100%;
    padding-bottom: 10px;
}

#extra-params {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding-bottom: 5px;
    padding-top: 10px;
    white-space: nowrap;

    gap: 10px;
}

.label-algo {
    width: 100% !important;
}

/* Stile per i tag input */
input {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 40px;
    border-radius: 40px;

    /* Colori e Bordi */
    border: 1px solid rgba(255, 255, 255, 0.349);
    background-color: rgb(12, 12, 12);
    color: white;

    /* Spaziatura testo interno */
    padding: 0 20px;
    font-size: 1.04em;
    font-family: 'Inter', sans-serif;

    transition-duration: 0.3s;
    outline: none;
}

/* Placeholder coordinato (leggermente opaco) */
input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Effetto Hover - Stesso del tuo bottone */
input:hover {
    box-shadow: 0px 0px 10px 0px #80e89a;
    border: 1px solid #80e89a;
}

/* Effetto Focus - Quando l'utente scrive */
input:focus,
textarea:hover {
    border: 1px solid #80e89a;
    box-shadow: 0px 0px 12px 0px rgba(128, 232, 154, 0.3);
    background-color: rgb(20, 20, 20);
    /* Leggera variazione per feedback */
}

/* Opzionale: stile specifico per input numero (rimuove freccette brutte) */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.buttonRSAcontainer {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

#btnConfermaAuto,
#bits-select {
    border-radius: 8px;
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, 0.349);
    background-color: rgb(12, 12, 12);
    color: white;
    cursor: pointer;
    font-size: 1.04em;
    transition-duration: 0.3s;
}

#btnDownloadRSA {
    height: 50px;
    border-radius: 8px;
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, 0.349);
    background-color: rgb(12, 12, 12);
    color: white;
    cursor: pointer;
    font-size: 1.04em;
    transition-duration: 0.3s;
}

textarea::-webkit-scrollbar {
    width: 10px;
}

textarea::-webkit-scrollbar-track {
    background: transparent;
}

textarea::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.322);
    border-radius: 10px;

    border: 2px solid rgba(255, 255, 255, 0);
    background-clip: padding-box;
}

textarea::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

#btnDownloadRSA:hover,
#btnConfermaAuto:hover,
#bits-select:hover {
    box-shadow: 0px 0px 10px 0px #80e89a;
    border: 1px solid #80e89a;
    color: #80e89a;
}

@media (max-width: 768px) {
    #extra-params {
        padding-left: 0px !important;
    }
}

@media (max-width: 920px) {

    #btnDownloadRSA {
        margin-left: 0px;
    }

    .parametri {
        width: 100%;
        min-width: 100%;
        padding: 20px 0;
        border-left: none;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        order: 2;
    }

    .buttonRSAcontainer {
        flex-direction: column;
        width: 100%;
        gap: 20px;
    }

    /* 1. Layout a colonna singola */
    #cryptForm {
        flex-direction: column;
        gap: 20px;
    }

    #crypto-left,
    #crypto-rigth {
        width: 100%;
        flex: none;
    }

    #crypto-left {
        order: 1;
    }

    #crypto-rigth {
        order: 3;
    }

    /* 3. Correzione larghezze elementi interni */
    /* Forza gli elementi che avevano width fisse/percentuali a occupare tutto lo spazio */
    input,
    .bookmarkBtn {
        width: 100% !important;
        /* Sovrascrive il 70% e il 120% del desktop */
    }

    /* 4. Allineamento Label e Input */
    /* Su mobile è meglio avere la label sopra l'input per non schiacciare il testo */
    label {
        gap: 8px;
        width: 70%;
        justify-content: center;
    }

    #div-algorithm {
        flex-direction: column;
        align-items: center;

    }

    #extra-params {
        flex-direction: column;
        align-items: flex-start;
        white-space: normal;
        padding-left: 30px;
        /* Permette al testo lungo di andare a capo */
    }

    /* 5. Ottimizzazione Textarea */
    textarea {
        height: 180px;
    }

    /* 6. Correzione icone e testi nei bottoni */
    .text {
        padding-left: 40px;
        /* Spazio per l'icona a sinistra */
        font-size: 0.95em;
    }

    .rsa-container {
        margin-left: 0;
        width: 100%;
    }
}