/*html, body { height: 100dvh; margin: 0; padding: 0; overflow: hidden; background: #ece5dd; font-family: 'Segoe UI', sans-serif; }*/
html, body { 
    height: 100%; 
    margin: 0; 
    padding: 0; 
    overflow: hidden; 
    background: #ece5dd; 
    font-family: 'Segoe UI', sans-serif;
    /* Previne o scroll da página inteira e o zoom indesejado */
    position: fixed; 
    width: 100%;
    overscroll-behavior-y: contain;
}
.top-actions { position: absolute; right: 15px; top: 15px; display: none; gap: 8px; z-index: 10001; }
.circle-btn { width: 48px; height: 48px; border-radius: 50%; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(0,0,0,0.3); transition: transform 0.1s; }
.circle-btn:active { transform: scale(0.92); }
#loading-history { text-align: center; padding: 15px; display: none; font-size: 13px; color: #075e54; font-weight: bold; width: 100%; }
.spinner { width: 20px; height: 20px; border: 3px solid #f3f3f3; border-top: 3px solid #075e54; border-radius: 50%; animation: spin 1s linear infinite; display: inline-block; vertical-align: middle; margin-right: 8px; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
#edit-btn { background: #f39c12; position: relative; display: none; font-size: 20px;}
#reply-btn { background: #3498db; position: relative; display: none; font-size: 20px;}
#clear-btn { background: #555; position: relative; transition: background 0.3s;}
.trash-body { width: 14px; height: 16px; border: 2px solid white; border-top: none; border-radius: 0 0 2px 2px; position: relative; top: 3px; }
.trash-lid { width: 18px; height: 2px; background: white; position: absolute; top: 14px; border-radius: 1px; }
.trash-handle { width: 6px; height: 2px; border: 2px solid white; border-bottom: none; position: absolute; top: 10px; border-radius: 2px 2px 0 0; }
#panic-btn { background: #c0392b; position: relative; }
.exit-door { width: 14px; height: 20px; border: 2px solid white; border-right: none; border-radius: 2px; position: relative; left: -2px; }
.exit-arrow { color: white; font-size: 20px; font-weight: bold; position: absolute; left: 18px; }
#menu-btn { background: #3498db; color: white; font-size: 24px; font-weight: bold; position: absolute; left: 15px; top: 15px; z-index: 10001; display: none; }
#sidebar { position: fixed; top: 0; left: -250px; width: 250px; height: 100%; background: #fff; box-shadow: 2px 0 10px rgba(0,0,0,0.2); transition: 0.3s; z-index: 10005; display: flex; flex-direction: column; padding-top: 60px; }
#sidebar.open { left: 0; }
.sidebar-item { padding: 15px 20px; font-size: 16px; color: #333; text-decoration: none; border-bottom: 1px solid #eee; display: block; font-weight: bold; cursor: pointer; }
.sidebar-item:active { background: #f0f0f0; }
#sidebar-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 10004; display: none; }
.modal { display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 90%; max-width: 400px; max-height: 80vh; background: #fff; z-index: 10010; border-radius: 15px; box-shadow: 0 5px 20px rgba(0,0,0,0.3); flex-direction: column; overflow: hidden; }
.modal-header { background: #075e54; color: white; padding: 15px; font-size: 18px; font-weight: bold; display: flex; justify-content: space-between; align-items: center; }
.close-modal { color: white; cursor: pointer; font-size: 24px; font-weight: bold; border: none; background: none; padding: 0; }
.modal-body { padding: 15px; overflow-y: auto; flex-grow: 1; }
.log-list { list-style: none; padding: 0; margin: 0; }
.log-list li { padding: 8px 0; border-bottom: 1px solid #eee; font-size: 14px; color: #555; }
.input-group input { width: 100%; padding: 10px; margin-top: 10px; border: 1px solid #ccc; border-radius: 5px; box-sizing: border-box; }
.btn-salvar { background: #075e54; color: white; width: 100%; padding: 12px; border: none; border-radius: 50px; margin-top: 15px; font-weight: bold; cursor: pointer; }
.gallery-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.gallery-img-container { position: relative; }
.gallery-img-container img { width: 100%; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid #ddd; }
.gallery-info { font-size: 10px; color: #777; text-align: center; margin-top: 2px; }
#login-screen, #chat-area { display: none; }
#login-screen { max-width: 400px; margin: 100px auto; background: white; padding: 30px; border-radius: 15px; text-align: center; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
#login-screen input { width: 80%; padding: 12px; margin-bottom: 10px; border: 1px solid #ddd; border-radius: 8px; font-size: 16px; display: block; margin-left: auto; margin-right: auto; }
#login-screen button { width: 85%; background: #075e54; color: white; border: none; padding: 12px; border-radius: 8px; cursor: pointer; font-size: 1em; font-weight: bold; }
#chat-area { max-width: 600px; margin: auto; height: 100dvh; flex-direction: column; position: relative; background: #fff; }
#messages { list-style: none; padding: 75px 10px 10px 10px; flex-grow: 1; overflow-y: auto; background: #fff; margin: 0; display: flex; flex-direction: column; }
#messages li { 
    margin-bottom: 12px; 
    padding: 8px 12px; 
    border-radius: 8px; 
    border-left: 5px solid #ccc; 
    background: #fdfdfd; 
    font-size: 15px; 
    position: relative; 
    display: flex;       /* NOVO: Organiza texto e hora */
    flex-direction: column; 
    max-width: 85%; 
    align-self: flex-start;
    word-wrap: break-word;
}

/* Conteúdo do texto */
.msg-content {
    display: block;      /* Mudado de inline-block para block */
    width: 100%;
    white-space: pre-wrap;
}

/* Data e Hora */
.msg-time { 
    font-size: 10px; 
    color: #888; 
    align-self: flex-end; /* Alinha na direita sem quebrar o layout */
    margin-top: 4px;
    white-space: nowrap;  /* IMPEDE a hora de ficar um número por linha */
}
#messages li.selected-msg { background: #dcf8c6 !important; border-left-color: #075e54 !important; }
.img-msg { max-width: 100%; border-radius: 8px; margin-top: 5px; display: block; }
#emoji-picker-wrapper { display: none; position: absolute; bottom: 70px; left: 10px; z-index: 10002; box-shadow: 0 5px 20px rgba(0,0,0,0.2); border-radius: 10px; overflow: hidden; }
.input-area { display: flex; padding: 10px; background: #f0f0f0; gap: 5px; align-items: center; border-top: 1px solid #ddd; padding-bottom: env(safe-area-inset-bottom, 10px); }
/* #m { flex-grow: 1; padding: 10px 15px; border: 1px solid #ddd; border-radius: 20px; outline: none; font-size: 16px; resize: none; overflow-y: hidden; min-height: 40px; max-height: 120px; line-height: 20px; box-sizing: border-box; font-family: inherit; } */
#m { 
    flex-grow: 1; 
    padding: 10px 15px; 
    border: 1px solid #ddd; 
    border-radius: 20px; 
    outline: none; 
    font-size: 16px !important; /* Mínimo para evitar zoom no iPhone */
    resize: none; 
    overflow-y: hidden; 
    min-height: 40px; 
    max-height: 120px; 
    line-height: 20px; 
    box-sizing: border-box; 
    font-family: inherit;
    /* Melhora a performance de renderização do texto e toque */
    touch-action: manipulation;
    text-rendering: optimizeSpeed;
}

input, textarea {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent; /* Remove o quadrado cinza ao tocar no Android */
}

#chat-area { max-width: 600px; margin: auto; height: 100dvh; flex-direction: column; position: relative; background: #fff; }
/* Garante que o container do chat se adapte à altura dinâmica do teclado */
#chat-area {
    max-width: 600px; 
    margin: auto; 
    height: 100dvh; /* Altura dinâmica que respeita o teclado */
    flex-direction: column; 
    position: relative; 
    background: #fff; 
    display: none;
}
.action-icon { font-size: 24px; cursor: pointer; color: #075e54; margin: 0 5px; background: none; border: none; padding: 0;}
.btn-send { background: #075e54; color: white; border: none; width: 45px; height: 45px; border-radius: 50%; cursor: pointer; flex-shrink: 0; font-weight: bold; font-size: 18px; }
#modal-musicas { border: none !important; border-radius: 25px; overflow: hidden; box-shadow: 0 10px 30px rgba(255, 182, 193, 0.4); }
#modal-musicas .modal-header { background: linear-gradient(135deg, #ffafbd 0%, #ffc3a0 100%) !important; color: #fff !important; border-bottom: none; font-family: 'Segoe UI', cursive; }
.subtitle-romantic { text-align: center; padding: 12px; background: #fffafa; color: #d81b60; font-style: italic; font-size: 14px; border-bottom: 1px dashed #f8bbd0; letter-spacing: 0.5px; }
#modal-musicas .modal-body { background: #fff9fb !important; }
.music-item:hover { transform: translateY(-2px); }
.play-btn-local { background: linear-gradient(135deg, #ff8fa3, #ffb3c1) !important; color: white !important; width: 38px !important; height: 38px !important; border-radius: 50% !important; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 16px; transition: 0.3s; box-shadow: 0 3px 10px rgba(255, 143, 163, 0.4); flex-shrink: 0; }
#form-musica { border-bottom: 2px solid #fce4ec !important; margin-bottom: 25px !important; padding-bottom: 20px !important; }
#form-musica label { color: #d81b60 !important; font-size: 14px; margin-bottom: 8px; display: block; }
#musica-link { border: 2px solid #fce4ec !important; border-radius: 15px !important; padding: 10px; transition: border-color 0.3s; }
#musica-link:focus { border-color: #ff8fa3 !important; outline: none; }
#btn-add-musica { background: linear-gradient(135deg, #ff8fa3, #ffafbd) !important; border-radius: 20px !important; margin-top: 10px; font-weight: bold; box-shadow: 0 4px 12px rgba(255, 143, 163, 0.3) !important; }
#player-container { border-top: 3px solid #ffafbd !important; border-radius: 0 0 25px 25px; width: 100%; background: #000; display: none; flex-direction: column; }
#player-iframe { width: 100%; height: 180px; border: none; }
.player-info-bar { background: #ffafbd !important; color: white; padding: 5px 10px; font-size: 12px; display: flex; justify-content: space-between; align-items: center; font-weight: 500; }
#modal-diario { border-radius: 20px; background: #fffafb; box-shadow: 0 10px 40px rgba(216, 27, 96, 0.3); }
#modal-diario .modal-header { background: linear-gradient(135deg, #d81b60 0%, #ff8fa3 100%) !important; border-bottom: none; }
.diario-header-form { background: #fff0f5; padding: 15px; border-bottom: 2px dashed #fce4ec; margin-bottom: 15px; border-radius: 0 0 15px 15px; }
.diario-form textarea { width: 100%; padding: 12px; border: 1px solid #fce4ec; border-radius: 12px; box-sizing: border-box; resize: vertical; min-height: 80px; font-family: 'Segoe UI', sans-serif; font-style: italic; color: #5d4037; outline: none; margin-top: 10px; }
.diario-form textarea:focus { border-color: #ff8fa3; }
.diario-form .file-label { display: inline-flex; align-items: center; gap: 5px; background: white; color: #d81b60; padding: 8px 15px; border-radius: 20px; cursor: pointer; font-size: 12px; font-weight: bold; border: 1px dashed #ffb6c1; margin-top: 10px; transition: 0.3s; }
.diario-form .file-label:hover { background: #ffe4e1; }
.diario-filters { display: flex; justify-content: space-between; align-items: center; background: white; padding: 10px 15px; border-radius: 15px; margin-bottom: 15px; border: 1px solid #fce4ec; box-shadow: 0 2px 10px rgba(255, 143, 163, 0.1); }
.diario-filters input[type="date"] { border: none; background: #fff0f5; color: #d81b60; font-weight: bold; padding: 5px 10px; border-radius: 10px; outline: none; }
.diario-card { background: white; border-radius: 15px; padding: 15px; margin-bottom: 20px; box-shadow: 0 4px 15px rgba(216, 27, 96, 0.08); border: 1px solid #fff0f5; }
.diario-card-header { display: flex; justify-content: space-between; font-size: 11px; color: #ff8fa3; text-transform: uppercase; font-weight: bold; border-bottom: 1px dashed #fce4ec; padding-bottom: 8px; margin-bottom: 12px; }
.diario-text { font-style: italic; color: #5d4037; font-size: 15px; line-height: 1.6; white-space: pre-wrap; margin-bottom: 12px; }
.diario-media { width: 100%; border-radius: 12px; margin-bottom: 12px; max-height: 400px; object-fit: cover; }
.diario-music-btn { background: linear-gradient(135deg, #ff8fa3, #ffafbd); color: white; border: none; border-radius: 20px; padding: 8px 15px; font-size: 12px; font-weight: bold; cursor: pointer; display: flex; align-items: center; gap: 5px; box-shadow: 0 3px 10px rgba(255, 143, 163, 0.3); transition: 0.3s; width: fit-content; }
.diario-music-btn:hover { transform: translateY(-2px); }
.diario-iframe-container { width: 100%; height: 80px; border-radius: 10px; overflow: hidden; display: none; margin-top: 10px; }
.diario-music-btn.tocando { background: #ff4b5c; color: white; animation: pulse 1.5s infinite; }
/* Cores baseadas em uma paleta romântica */
#playlist-screen {
    background: #fdf2f4 !important; /* Rosa bem clarinho */
}

.music-header {
    background: #d4a5a9 !important; /* Rosa antigo */
    color: white;
    padding: 20px;
    border-bottom: 2px solid #c08d92;
}

.music-item {
    display: flex;
    align-items: center;
    background: white;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 20px; /* Bordas bem redondas como o diário */
    box-shadow: 0 4px 15px rgba(212, 165, 169, 0.2);
    border: 1px solid #f2dadd;
}

.music-title {
    font-family: 'Georgia', serif; /* Fonte mais romântica */
    font-weight: bold;
    color: #8c5e62;
    font-size: 15px;
}

.music-added-by {
    font-size: 11px;
    color: #bfa3a6;
    font-style: italic;
}

.play-spotify-btn {
    background: #1DB954;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(29, 185, 84, 0.3);
}

@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }
