/* Font WhatsApp-like, preferisci Segoe UI, Roboto, Arial, Helvetica */
body, .screen, .wa-header, .wa-bubble {
    font-family: 'Segoe UI', 'Roboto', 'Arial', 'Helvetica Neue', Arial, sans-serif;
}

body {
    background: linear-gradient(135deg, #9de98f 0%, #60a8f5 100%);
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* iPhone cornice */
.iphone-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.iphone {
    width: 420px;
    height: 900px;
    background: #232323;
    border-radius: 65px;
    box-shadow: 0 8px 48px 12px #2225;
    border: 10px solid #1d1d1d;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: visible;
}

.iphone-side {
    position: absolute;
    left: -10px;
    top: 80px;
    width: 12px;
    height: 80px;
    background: #888;
    border-radius: 6px;
    z-index: 1;
}

.notch {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 170px;
    height: 34px;
    background: #111;
    border-radius: 0 0 24px 24px;
    z-index: 10;
    box-shadow: 0 2px 4px #0006;
}

.screen {
    background: #e5ddd5;
    width: 375px;
    height: 812px;
    margin-top: 32px;
    border-radius: 48px;
    box-shadow: 0 4px 16px #0002;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* WhatsApp header */
.wa-header {
    height: 70px;
    background: #075e54;
    display: flex;
    align-items: center;
    padding: 0 18px 0 12px;
    color: #fff;
    gap: 14px;
    box-shadow: 0 1px 4px #0002;
    z-index: 3;
}

.wa-back {
    font-size: 1.5em;
    color: #fff;
    font-weight: normal;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
}


.wa-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
}

.wa-title {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-left: 4px;
}

.wa-name {
    font-weight: bold;
    font-size: 1.18em;
    letter-spacing: 0.1em;
}
.wa-status {
    font-size: 0.85em;
    color: #cfd8dc;
}

.wa-more {
    width: 25px;
    height: 25px;
    filter: brightness(0) invert(1) grayscale(1);
    cursor: pointer;
}

.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 28px 12px 24px 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: url('https://www.transparenttextures.com/patterns/diamond-upholstery.png'), #d7f4d2;
    /* Texture WhatsApp background */
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: #b0d7b2 #e5ddd5;
}

/* Scrollbar per Chrome */
.chat-area::-webkit-scrollbar {
    width: 7px;
}
.chat-area::-webkit-scrollbar-thumb {
    background: #b0d7b2;
    border-radius: 4px;
}
.chat-area::-webkit-scrollbar-track {
    background: #e5ddd5;
}

/* Chat bubbles */
.message-row {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.message-row.elaine {
    align-items: flex-start;
}

.wa-bubble {
    max-width: 74%;
    padding: 12px 18px 8px 18px;
    border-radius: 16px 16px 4px 16px;
    margin-bottom: 2px;
    font-size: 1.05em;
    background: #dcf8c6;
    color: #222;
    position: relative;
    box-shadow: 0 2px 10px #0001;
    word-break: break-word;
    transition: background 0.2s;
}

.message-row.elaine .wa-bubble {
    background: #fff;
    border-radius: 16px 16px 16px 4px;
}

/* Messaggio vocale stile */
.audio-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.audio-row svg {
    display: inline-block;
}

.audio-label {
    font-weight: 500;
    color: #4caf50;
    font-size: 1em;
    letter-spacing: 0.01em;
}

.audio-transcription {
    font-size: 0.98em;
    color: #333;
    padding-left: 4px;
    line-height: 1.5;
    margin-top: 3px;
    font-style: italic;   /* <--- questa riga aggiunge il corsivo */
}


/* Meta info */
.wa-meta {
    font-size: 0.74em;
    color: #999;
    margin: 2px 0 0 0;
    text-align: right;
    padding-right: 2px;
}

.wa-bottom {
    width: 100%;
    height: 25px;
    background: transparent;
    border-radius: 0 0 48px 48px;
    position: absolute;
    bottom: 0;
    left: 0;
}

/* Responsive minimo */
@media (max-width: 500px) {
    .iphone {
        width: 99vw;
        height: 99vw;
        max-width: 100vw;
        max-height: 98vh;
        border-radius: 5vw;
    }
    .screen {
        width: 90vw;
        height: 95vw;
        max-width: 100vw;
        max-height: 98vh;
        border-radius: 4vw;
        margin-top: 18px;
    }
}

/* Nascondi il bottone di caricamento file se usi fetch */
#fileInput {
    display: none;
}
