/* ————————————————————————————————
   BASE
——————————————————————————————— */

body.theme-glass-gnic {
	background: url("/assets/milkyway.jpg") no-repeat center center fixed;
	background-size: cover;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    padding: 25px;
    color: #333;
}
body.theme-glass-copag {
	background: url("/assets/sfondocopag.jpg") no-repeat center center fixed;
	background-size: cover;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    padding: 25px;
    color: #333;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}
/* ————————————————————————————————
   LOGIN PANEL (isolato dal resto)
——————————————————————————————— */
.login-panel {
    max-width: 520px;
    margin: 60px auto;
    padding: 30px;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-radius: 18px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.25);
    color: #000000;
}

/* ————————————————————————————————
   TITOLI
——————————————————————————————— */
.login-panel h1 {
    margin: 0;
    font-size: 1.9rem;
    font-weight: 600;
    text-align: center;
    text-shadow: 0 2px 4px rgba(255,255,255,0.55);
}

.login-panel .subtitle {
    margin: 4px 0 20px 0;
    font-size: 1rem;
    text-align: center;
    opacity: 0.85;
    text-shadow: 0 1px 4px rgba(255,255,255,0.55);
}

/* ————————————————————————————————
   DESCRIZIONE
——————————————————————————————— */
.login-description {
    font-size: 1rem;
    line-height: 1.55;
    margin-bottom: 20px;
   text-shadow: 0 2px 4px rgba(255,255,255,0.55);
}

/* ————————————————————————————————
   FORM
——————————————————————————————— */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.login-input {
    padding: 12px 14px;
    font-size: 1rem;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.25);
    color: #000000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.login-input::placeholder {
    color: rgba(0,0,0,0.45);
}

/* ————————————————————————————————
   BOTTONE
——————————————————————————————— */
.button {
    padding: 12px 18px;
    font-size: 1rem;
    border-radius: 10px;
    background: #007aff;
    color: #fff;
    border: none;
    cursor: pointer;
    margin-top: 10px;
}

.button:hover {
    background: #005fcc;
}

/* ————————————————————————————————
   ERRORE LOGIN
——————————————————————————————— */
.login-error {
    color: #ff6b6b;
    margin-top: 10px;
    font-weight: bold;
    text-align: center;
}

/* ————————————————————————————————
   HEADER
——————————————————————————————— */

.header-solid {
    background: rgba(255, 255, 255, 0.72);
    border-radius: 14px;
    padding: 10px 14px;      /* meno alto */
    margin-bottom: 12px;
    box-shadow: 0 3px 14px rgba(0,0,0,0.12);
    position: relative;
}

/* Azzeriamo i margini verticali dei testi */
.header-solid h1 {
    margin: 0;
    font-size: 1.4rem;       /* più compatto */
    font-weight: 600;
}

.header-solid .subtitle {
    margin: 2px 0 0 0;       /* quasi attaccato al titolo */
    font-size: 0.9rem;
    opacity: 0.75;
}

.header-actions {
    position: absolute;
    top: 8px;
    right: 10px;
    display: flex;
    gap: 6px;
}

.header-actions button {
    padding: 6px 10px;
    font-size: 14px;
    border-radius: 10px;
    cursor: pointer;
    border: none;
    background: rgba(255,255,255,0.35);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.4);
    transition: background 0.2s ease;
}

.header-actions button:hover {
    background: rgba(255,255,255,0.55);
}



.container {
    max-width: 700px;
    margin: auto;
    padding: 25px;

    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);

    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

/* ————————————————————————————————
   CHAT INPUT
——————————————————————————————— */

.chat-box {
    padding: 0;
    background: transparent;
    border: none;
}

.input-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.avatar-user {
    font-size: 32px;
    margin-top: 6px;
}

.prompt-bubble {
    position: relative;
    flex: 1;
    display: flex;
}

.prompt-bubble::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 22px;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 12px solid rgba(255, 255, 255, 0.25);
}

textarea {
    width: 100%;
    height: 70px;
    font-size: 16px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    resize: vertical;
}

textarea::placeholder,
input::placeholder {
     color: rgba(0, 0, 0, 0.41); /* più visibile */
    opacity: 1; /* Safari fix */
}

/* ————————————————————————————————
   SEND BUTTON
——————————————————————————————— */

.send-btn {
    margin-top: 6px;
    margin-left: auto;
    display: block;
    padding: 10px 26px;
    height: 30px;
    min-width: 70px;
    font-size: 18px;
    font-weight: 600;
    color: white;
    background: rgba(0, 122, 255, 0.85);
    backdrop-filter: blur(8px);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.15s ease;
}

.send-btn:hover {
    background: rgba(0, 122, 255, 1);
    transform: scale(1.03);
}

.send-btn:active {
    transform: scale(0.96);
}

.disabled-send {
    opacity: 0.4;
    pointer-events: none;
    transform: scale(0.95);
}

/* ————————————————————————————————
   RESPONSE BOX
——————————————————————————————— */

.response-box-outer {
    margin-top: 30px;
    background: transparent;
    border: none;
    padding: 0;
}

.response-box-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.response-inner {
    flex: 1;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    padding: 20px;
    min-height: 120px;
    position: relative;
}

.response-inner::after {
    content: "";
    position: absolute;
    right: -12px;
    top: 22px;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 12px solid rgba(255, 255, 255, 0.25);
}


.btn-exit {
    padding: 10px 22px;
    font-size: 16px;
    border-radius: 14px;
    cursor: pointer;
    border: none;
    color: #ff3b30;
    background: rgba(255, 59, 48, 0.75);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s ease, transform 0.15s ease;
}

.btn-exit:hover {
    background: rgba(255, 59, 48, 0.95);
}


/* Pulsante Reset */
.btn-reset {
    padding: 10px 22px;
    font-size: 15px;
    border-radius: 14px;
    cursor: pointer;
    border: none;
    color: #007aff;
    background: rgba(0, 122, 255, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    transition: background 0.2s ease, transform 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-reset:hover {
    background: rgba(255, 59, 48, 0.95);
    transform: scale(1.03);
}

.btn-reset:active {
    transform: scale(0.96);
}


.avatar-ai {
    font-size: 32px;
    margin-left: 14px;
    margin-top: 4px;
}

/* ————————————————————————————————
   FOOTER
——————————————————————————————— */
.footer {
    margin-top: 40px;
    padding: 12px;
    font-size: 14px;
    color: #fff;

    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    border-radius: 12px;

    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    text-align: center;
}

/* QUESTA È LA CHIAVE */
.footer-item {
    flex: 0 0 auto;      /* <— Safari NON può più comprimere */
    min-width: 12em;     /* <— spazio garantito per ogni blocco */
    white-space: nowrap;
}

#latency {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ————————————————————————————————
   PENNA ANIMATA
——————————————————————————————— */

.pen-anim {
    display: inline-block;
    font-size: 28px;
    margin-left: 8px;
    animation: penBlink 0.8s ease-in-out infinite;
}

@keyframes penBlink {
    0%   { opacity: 0.3; transform: translateY(0); }
    50%  { opacity: 1;   transform: translateY(-2px); }
    100% { opacity: 0.3; transform: translateY(0); }
}


/* ————————————————————————————————
   AGGIUNTA GNICAI HISTORY (avatar + fumetti)
——————————————————————————————— */

#history-container {
    width: 100%;
    margin-bottom: 20px;
}

.history-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 18px;
}

.history-row.user {
    justify-content: flex-start;
}

.history-row.ai {
    justify-content: flex-end;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
}

.avatar.user {
    background-image: url("avatar_user.png");
    margin-right: 10px;
}

.avatar.ai {
    background-image: url("avatar_ai.png");
    margin-left: 10px;
}

.history-box {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 15px;
    line-height: 1.45;
    backdrop-filter: blur(10px);
    color: #fff;
}

.history-box.user {
    background: rgba(0, 150, 255, 0.25);
    border: 1px solid rgba(0, 150, 255, 0.4);
}

.history-box.ai {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
}

/* ————————————————————————————————
   HISTORY GNICAI (avatar + fumetti)
——————————————————————————————— */

#history-container {
    width: 100%;
    margin-bottom: 25px;
}

/* Riga con avatar + fumetto */
.history-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 18px;
}

/* Utente a sinistra */
.history-row.user {
    justify-content: flex-start;
}

/* AI a destra */
.history-row.ai {
    justify-content: flex-end;
}

/* Avatar generico */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
}

/* Avatar utente */
.avatar.user {
    background-image: url("avatar_user.png");
    margin-right: 10px;
}

/* Avatar AI */
.avatar.ai {
    background-image: url("avatar_ai.png");
    margin-left: 10px;
}

/* Avatar emoji */
.avatar-user,
.avatar-ai {
    font-size: 32px;
    line-height: 32px;
    display: inline-block;
}

/* Spaziatura */
.history-row.user .avatar-user {
    margin-right: 10px;
}

.history-row.ai .avatar-ai {
    margin-left: 10px;
}

/* Fumetto base */
.history-box {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 15px;
    line-height: 1.45;
    backdrop-filter: blur(10px);
    color: #fff;
}

/* Fumetto utente */
.history-box.user {
    background: rgba(0, 150, 255, 0.25);
    border: 1px solid rgba(0, 150, 255, 0.4);
}

/* Fumetto AI */
.history-box.ai {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
}
/* Fumetto utente in history con glass identico al prompt */
.history-row.user .history-box.user {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 16px;
    color: #000;
    position: relative;
}

/* Triangolino identico al prompt */
.history-row.user .history-box.user::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 18px;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 12px solid rgba(255, 255, 255, 0.25);
}
.history-row.ai .history-box.ai {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 16px;
    color: #000;
    position: relative;
}

.history-row.ai .history-box.ai::after {
    content: "";
    position: absolute;
    right: -12px;
    top: 18px;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 12px solid rgba(255, 255, 255, 0.25);
}

.hidden {
    display: none !important;
}

/* Spazio sotto il box live quando è visibile */
#response-box-outer:not(.hidden) {
    margin-bottom: 22px;
}

.footer-buttons {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 30px;
}

/* Pulsante Home */
.btn-home {
    padding: 10px 22px;
    font-size: 15px;
    border-radius: 14px;
    text-decoration: none;
    color: white;
    background: rgba(0, 122, 255, 0.75);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    transition: background 0.2s ease, transform 0.15s ease;
}

.btn-home:hover {
    background: rgba(0, 122, 255, 0.95);
    transform: scale(1.03);
}

.btn-home:active {
    transform: scale(0.96);
}



.num {
    font-weight: 600;
    margin-right: 4px;
}



