:root {
    --z-base: 1;
    --z-tooltip: 100;
    --z-modal-backdrop: 1000;
    --z-modal-content: 1010;
    --z-fab: 2000;
    --z-alert-backdrop: 9000;
    --z-alert-content: 9999;
}

/* =========================================================================
   STATE 3: CHAT (WhatsApp Style - Dark Premium)
========================================================================= */
#state-chat {
    background-color: #0b141a;
}

.chat-header {
    background: rgba(32, 44, 51, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 15px 20px; /* Reducido para eliminar el hueco superior */
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    z-index: var(--z-tooltip);
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: #0689fb; /* Fondo celeste perfecto */
    object-fit: contain; /* Para que Snoopy entre completo sin recortarse */
    object-position: 35% center;
    padding: 4px; /* Un poco de aire para que las patas/orejas no toquen el borde */
    box-sizing: border-box;
}

.status {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.status h3 {
    color: #e9edef;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 2px;
}

.online-indicator {
    color: #00a884;
    font-size: 13px;
    font-weight: 500;
}

.chat-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}


.memory-led {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: #00a884; /* Default verde */
    transition: background 0.3s ease;
    box-shadow: 0 0 4px rgba(0,0,0,0.3);
    margin-right: 18px;
}

.hidden-tooltip {
    display: none;
    position: absolute;
    top: 60px;
    right: 15px;
    background: #222;
    color: #fff;
    padding: 10px;
    border-radius: 8px;
    font-size: 12px;
    z-index: var(--z-tooltip);
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    white-space: nowrap;
}

.show-tooltip {
    display: block !important;
}

.panic-btn {
    background: rgba(241, 92, 109, 0.15);
    color: #f15c6d;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.panic-btn:active {
    background: rgba(241, 92, 109, 0.3);
    transform: scale(0.9);
}

.exit-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #e9edef;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.exit-btn:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0.9);
}

.chat-banner {
    position: absolute;
    top: 80px; /* Below the header */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 12px 20px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    z-index: var(--z-modal-backdrop);
    opacity: 0;
    transition: opacity 0.5s ease;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    pointer-events: none;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    /* Scrolling nativo para Webkit */
    -webkit-overflow-scrolling: touch;
    /* Pattern de fondo estilo WhatsApp */
    background-image: url('data:image/svg+xml,%3Csvg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="%231a242c" fill-opacity="0.6" fill-rule="evenodd"%3E%3Ccircle cx="3" cy="3" r="3"/%3E%3Ccircle cx="13" cy="13" r="3"/%3E%3C/g%3E%3C/svg%3E');
}

.scroll-bottom-btn {
    position: absolute;
    bottom: 95px; /* Elevado para no superponerse con el botón de enviar o el textarea */
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #202c33;
    color: #8696a0;
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: var(--z-tooltip);
    transition: opacity 0.2s, transform 0.2s;
}

.scroll-bottom-btn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

.date-separator {
    align-self: center;
    background-color: rgba(30, 42, 48, 0.9);
    color: rgba(255, 255, 255, 0.9);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    margin: 8px 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    text-align: center;
    width: fit-content;
    z-index: var(--z-base);
}

.system-message {
    align-self: center;
    background-color: rgba(255, 193, 7, 0.15);
    color: rgba(255, 214, 102, 0.9);
    padding: 6px 14px;
    border-radius: 12px;
    font-size: 12px;
    font-style: italic;
    margin: 10px 0;
    text-align: center;
    width: fit-content;
    max-width: 85%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.msg-bubble {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    animation: fadeInMsg 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    min-width: 80px;
    transition: opacity 0.2s; /* Para efecto visual al pulsar largo */
}

.msg-content {
    margin-bottom: 2px;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    white-space: pre-wrap;
}

.msg-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
}

.msg-ticks {
    font-size: 13px;
    letter-spacing: -2px;
    margin-right: 2px;
}

.msg-ticks.read {
    color: #53bdeb; /* Ticks azules */
}

@keyframes fadeInMsg {
    0% { opacity: 0; transform: translateY(15px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.msg-bubble.received {
    align-self: flex-start;
    background-color: #202c33;
    color: #e9edef;
    border-top-left-radius: 4px;
}

.msg-bubble.sent {
    align-self: flex-end;
    background-color: #005c4b;
    color: #e9edef;
    border-top-right-radius: 4px;
}

/* === INDICADOR DE ESCRITURA (Globo con 3 puntitos) === */
.typing-indicator {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 5px;
    /* Mismo look que .msg-bubble.received */
    background-color: #202c33;
    padding: 12px 14px;
    border-radius: 16px;
    border-top-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    width: fit-content;
    animation: fadeInMsg 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #8696a0;
    animation: typingBounce 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* Respeto por accesibilidad: sin rebote si el usuario reduce animaciones */
@media (prefers-reduced-motion: reduce) {
    .typing-dot {
        animation: none;
        opacity: 0.8;
    }
}

.chat-footer {
    padding: 15px 20px 30px 20px; /* Espacio inferior para Home Indicator en iOS */
    background: rgba(32, 44, 51, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.chat-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 10px;
    gap: 8px; /* Separación justa entre los 4 elementos */
    background: #2a3942;
    border-radius: 28px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.chat-input-wrapper textarea, #chat-input {
    flex: 1 1 auto !important; /* Crece todo lo posible */
    width: 100%;
    min-width: 0; /* Truco de flexbox para evitar desbordes */
    margin: 0;
    background: transparent;
    border: none;
    color: #e9edef;
    font-size: 16px;
    outline: none;
    user-select: auto;
    -webkit-user-select: auto;
    resize: none;
    overflow-y: auto;
    max-height: 100px;
    padding: 10px 12px; /* Reducido drásticamente el padding lateral para eliminar el espacio vacío */
    border-radius: 0;
    line-height: 1.4;
    font-family: inherit;
    /* Evitar scrollbars visibles en webkit si no es necesario */
}

.chat-input-wrapper textarea::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

.chat-input-wrapper textarea::placeholder {
    color: #8696a0;
}

.send-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #00a884;
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    padding: 10px;
    margin: 0 !important;
    flex-shrink: 0;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 168, 132, 0.3);
}

.send-btn:active {
    transform: scale(0.9);
    background: #008f6f;
}

.btn-bomb:active {
    transform: scale(0.95);
}

.attachment-menu {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 10px;
    background: #2a3942;
    border-radius: 15px;
    padding: 10px;
    display: none;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    z-index: var(--z-tooltip);
}

.attachment-menu.active {
    display: flex;
}

.attachment-menu-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.attachment-menu-btn:hover, .attachment-menu-btn:active {
    background: #3a3a3a;
}

/* === STICKER PANEL === */
.sticker-panel {
    display: none;
    background: #1f2c34;
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 10px;
    max-height: 200px;
    overflow-y: auto;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.sticker-panel.active {
    display: grid;
}

.sticker-item {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    cursor: pointer;
    border-radius: 8px;
    transition: transform 0.2s ease, background 0.2s;
    padding: 4px;
}

.sticker-item:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.1);
}

.sticker-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    color: #8696a0;
    border: none;
    width: 36px !important;
    height: 36px !important;
    padding: 4px !important;
    margin: 0 !important;
    flex-shrink: 0; /* No se achican ni se agrandan */
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.2s;
}
.sticker-btn svg {
    width: 22px;
    height: 22px;
}

.sticker-btn:active, .sticker-btn.active {
    color: #00a884;
}

/* Sticker messages */
.msg-bubble.sticker-msg {
    background: transparent !important;
    padding: 0;
    box-shadow: none;
}

.msg-bubble.sticker-msg .msg-content img {
    max-width: 130px;
    border-radius: 8px;
    background: transparent;
    display: block;
}

.msg-bubble.sticker-msg .msg-meta {
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 6px;
    border-radius: 12px;
    position: absolute;
    bottom: 4px;
    right: 4px;
    color: white;
}

/* === SISTEMA DE CITAS / RESPUESTAS === */
#reply-preview-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2a3942;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 4px solid #00a884;
}

.reply-preview-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}

#reply-preview-sender {
    color: #00a884;
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 2px;
}

#reply-preview-text {
    color: #8696a0;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.cancel-reply-btn {
    background: transparent;
    border: none;
    color: #8696a0;
    font-size: 18px;
    cursor: pointer;
    padding: 0 8px;
}

.reply-block {
    background: rgba(0, 0, 0, 0.15);
    border-left: 4px solid #00a884;
    border-radius: 4px;
    padding: 6px 8px;
    margin-bottom: 6px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
}

.reply-block .reply-sender {
    color: #00a884;
    font-weight: bold;
    margin-bottom: 2px;
    font-size: 12px;
}

.reply-block .reply-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}



@keyframes whatsappFlash {
    0% { filter: brightness(1.8); }
    100% { filter: brightness(1); }
}

.flash-message {
    animation: whatsappFlash 1.5s ease-out;
}

/* === UI DE GRABACIÓN === */

.recording-dot {
    width: 10px;
    height: 10px;
    background-color: #ff3b30;
    border-radius: 50%;
    animation: pulseRed 1s infinite;
}

@keyframes pulseRed {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}
.msg-bubble.audio-msg {
    min-width: 280px !important;
    padding: 8px 10px 24px 10px !important;
    height: auto !important;
}
.whatsapp-audio-player {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
}
.audio-avatar-box {
    position: relative !important;
    width: 48px !important;
    height: 48px !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
}
.audio-avatar-box img {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    object-fit: cover !important;
}
.audio-mic-badge {
    position: absolute !important;
    bottom: 0 !important;
    right: -4px !important;
    background: #00a884 !important;
    border: 2px solid #202c33 !important;
    border-radius: 50% !important;
    width: 16px !important;
    height: 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.msg-bubble.received .audio-mic-badge { background: #53bdeb !important; }
.audio-controls-col {
    flex: 1 !important;
    min-width: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    max-width: 100% !important;
    overflow: hidden !important;
}
.audio-play-btn {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    width: 26px !important;
    height: 26px !important;
    flex-shrink: 0 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.audio-timeline-wrapper {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    max-width: 100% !important;
    overflow: hidden !important;
}
.audio-timeline {
    width: 100% !important;
    height: 16px !important;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
}

/* Fondo de la onda (gris rayado) */
.audio-waveform-bg {
    position: absolute !important;
    width: 100% !important;
    height: 100% !important;
    background: repeating-linear-gradient(to right, #65757d 0, #65757d 2px, transparent 2px, transparent 4px) !important;
}

/* Progreso de la onda (celeste rayado) */
.audio-progress-bar {
    position: absolute !important;
    height: 100% !important;
    width: 0%; /* Sin !important para que el JS pueda moverlo */
    background: repeating-linear-gradient(to right, #53bdeb 0, #53bdeb 2px, transparent 2px, transparent 4px) !important;
    transition: width 0.15s linear !important;
}

.msg-bubble.received .audio-progress-bar {
    background: repeating-linear-gradient(to right, #00a884 0, #00a884 2px, transparent 2px, transparent 4px) !important;
}


.audio-knob {
    position: absolute !important;
    width: 12px !important;
    height: 12px !important;
    background: #53bdeb !important;
    border-radius: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    left: 0%;
    transition: left 0.15s linear !important;
}
.msg-bubble.received .audio-knob { background: #00a884 !important; }
.audio-time-label {
    font-size: 11px !important;
    color: rgba(255, 255, 255, 0.6) !important;
    line-height: 1 !important;
}

.recording-waveform-anim {
    flex: 1;
    height: 18px;
    margin: 0 10px;
    background: repeating-linear-gradient(to right, #8696a0 0, #8696a0 2px, transparent 2px, transparent 6px);
    -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    animation: scrollWaveform 1s linear infinite;
}

@keyframes scrollWaveform {
    from { background-position: 0 0; }
    to { background-position: -24px 0; }
}

.recording-waveform-anim.paused {
    animation-play-state: paused;
    opacity: 0.5;
}

.modal-header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 25px 15px 15px;
    width: 100%;
    box-sizing: border-box;
}
.tab-container {
    display: flex;
    background: #161b1e;
    border-radius: 25px;
    padding: 4px;
    gap: 4px;
    border: 1px solid #2a3236;
}
.tab-btn {
    padding: 8px 24px;
    border-radius: 20px;
    border: none;
    background: transparent;
    color: #888;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}
.tab-btn.active {
    background: #128c7e;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.floating-btn {
    position: absolute;
    bottom: 30px;
    right: 30px;
    background: #00a884;
    color: white;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    font-size: 28px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    cursor: pointer;
}
/* DISEÑO POST-IT Y CINTA */
.post-it-container {
    background: #fff9b1; /* Amarillo pastel */
    width: 90%;
    max-width: 400px;
    height: 70vh;
    margin: auto;
    position: relative;
    z-index: var(--z-modal-content);
    box-shadow: 3px 5px 15px rgba(0,0,0,0.3);
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    padding: 35px 20px 20px 20px;
}
.cinta-adhesiva {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%) rotate(-2deg);
    width: 100px;
    height: 28px;
    background: rgba(255, 255, 255, 0.45);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    backdrop-filter: blur(2px);
}
#note-title-input {
    background: transparent;
    border: none;
    border-bottom: 2px solid rgba(0,0,0,0.1);
    font-size: 20px;
    font-weight: bold;
    color: #333;
    padding-bottom: 8px;
    margin-bottom: 15px;
    outline: none;
}
.renglones {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #333;
    font-size: 16px;
    line-height: 28px; /* Clave para los renglones */
    background-image: repeating-linear-gradient(transparent, transparent 27px, rgba(0,0,0,0.08) 28px);
    resize: none;
}
.note-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    position: relative;
    z-index: var(--z-tooltip);
}
.note-btn {
    background: none;
    border: none;
    color: #666;
    font-weight: bold;
    font-size: 15px;
    cursor: pointer;
}
.note-btn.save { color: #00a884; }
.note-pagination {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #555;
    font-weight: bold;
}
.page-btn {
    background: rgba(0,0,0,0.05);
    border: none;
    border-radius: 5px;
    width: 25px;
    height: 25px;
    cursor: pointer;
    color: #333;
}

.note-footer {
    transform: translateZ(1px);
    position: relative !important;
    z-index: var(--z-modal-content);
    pointer-events: auto !important;
}
.note-btn {
    position: relative !important;
    z-index: var(--z-modal-content);
    pointer-events: auto !important;
}

/* Custom Confirm Modal */
.confirm-backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex; align-items: center; justify-content: center;
    z-index: var(--z-alert-backdrop); opacity: 1; transition: opacity 0.3s;
}
.confirm-backdrop.hidden {
    display: none; opacity: 0;
}
.confirm-box {
    background: #1e2428; border-radius: 12px; padding: 20px;
    width: 80%; max-width: 320px; text-align: center;
    color: #fff; box-shadow: 0 8px 16px rgba(0,0,0,0.5);
    position: relative;
    z-index: var(--z-alert-content);
}
.confirm-actions {
    display: flex; justify-content: space-between; gap: 10px; margin-top: 20px;
}
.confirm-actions button {
    flex: 1; padding: 10px; border-radius: 8px; border: none; font-weight: bold; cursor: pointer;
}
.btn-cancel { background: #333; color: #fff; }
.btn-delete { background: #e74c3c; color: #fff; }

/* Ocultar botones al escribir */
#btn-attachments, #btn-sticker {
    transition: width 0.2s ease, opacity 0.2s ease, margin 0.2s ease, padding 0.2s ease;
    overflow: hidden;
}

.chat-input-wrapper.is-typing #btn-attachments,
.chat-input-wrapper.is-typing #btn-sticker {
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0;
    pointer-events: none;
}

#edit-mode-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(11, 20, 26, 0.85); /* Fondo oscuro semitransparente */
    z-index: var(--z-modal-backdrop);
    display: flex; align-items: center; justify-content: center;
}
#edit-mode-overlay.hidden { display: none; }
.whatsapp-edit-modal {
    background: #111b21; width: 90%; max-width: 500px;
    border-radius: 16px; display: flex; flex-direction: column;
    box-shadow: 0 17px 50px 0 rgba(0,0,0,0.19); overflow: hidden;
}
.edit-header {
    display: flex; align-items: center; padding: 20px;
    color: #d1d7db; font-size: 16px; gap: 20px;
}
#btn-cancel-edit {
    background: none; border: none; color: #aebac1; font-size: 20px; cursor: pointer;
}
.edit-preview-container {
    padding: 20px; background: transparent; display: flex; justify-content: center;
}
.edit-input-area {
    padding: 10px 20px 20px; display: flex; align-items: center; gap: 15px;
}
#edit-dedicated-input {
    flex: 1; background: transparent; border: none; outline: none;
    border-bottom: 2px solid #00a884; color: #d1d7db; font-size: 15px;
    padding: 8px 0;
}
#btn-save-edit {
    background: #00a884; color: #111b21; border: none; width: 40px; height: 40px;
    border-radius: 50%; font-size: 18px; cursor: pointer; font-weight: bold;
    display: flex; align-items: center; justify-content: center;
}

#msg-context-menu.hidden {
    display: none !important;
}

/* Forzar expansión del layout padre real (.msg-bubble) */
.msg-bubble:has(iframe) {
    max-width: 95% !important; /* Rompe el límite del 80% heredado */
    padding: 6px 8px !important; /* Padding ajustado como un widget nativo */
    padding-bottom: 22px !important; /* Espacio para que la estampa de hora (.msg-meta) no lo pise */
}

/* Limpiar los fondos y paddings duplicados del contenedor interno */
.msg-content:has(iframe) {
    width: 300px !important; /* Mismo ancho del reproductor */
    max-width: 100% !important;
    padding: 0 !important;
    background: transparent !important;
}

/* Forzar al Iframe a encajar como guante */
.msg-content iframe {
    width: 300px !important; 
    max-width: 100% !important; 
    height: 152px !important;
    margin: 0 !important;
    border-radius: 12px !important; /* Bordes curvos oficiales */
    display: block !important;
    border: none !important;
}

.msg-content a {
    word-break: break-all;
    display: inline-block;
}
