/* =========================================================
   CHAT FAKE - WHATSAPP PREMIUM DESIGN
========================================================= */

:root {
    --wp-dark-bg: #111b21;
    --wp-header: #202c33;
    --wp-input-bg: #2a3942;
    --wp-chat-bg: #0b141a;
    --wp-sent: #005c4b;
    --wp-received: #202c33;
    --wp-green: #00a884;
    --wp-green-light: #06cf9c;
    --wp-text: #e9edef;
    --wp-text-secondary: #8696a0;
    --wp-border: #2a3942;
    --wp-blue-check: #53bdeb;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--wp-dark-bg);
    height: 100dvh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ===== CHAT CONTAINER ===== */
#chat-screen {
    width: 100%;
    max-width: 500px;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--wp-chat-bg);
    position: relative;
    overflow: hidden;
}

/* ===== HEADER ===== */
.chat-header {
    background: var(--wp-header);
    padding: 8px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    min-height: 56px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.back-btn {
    color: var(--wp-text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}

.profile-pic-wrapper {
    position: relative;
}

.profile-pic {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid transparent;
}

.online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: var(--wp-green);
    border-radius: 50%;
    border: 2px solid var(--wp-header);
}

.header-info {
    display: flex;
    flex-direction: column;
    margin-left: 4px;
}

.contact-name {
    color: var(--wp-text);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.2;
}

.contact-status {
    color: var(--wp-text-secondary);
    font-size: 12.5px;
    line-height: 1.3;
    transition: color 0.2s;
}

.contact-status.typing {
    color: var(--wp-green);
}

.header-right {
    display: flex;
    gap: 18px;
    color: var(--wp-text-secondary);
    font-size: 18px;
    align-items: center;
}

.call-btn {
    cursor: pointer;
    transition: color 0.2s;
    padding: 4px;
}

.call-btn:hover, .call-btn:active {
    color: var(--wp-text);
}

/* ===== CHAT BODY ===== */
.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
    background-color: var(--wp-chat-bg);
}

/* WhatsApp doodle pattern */
.chat-body::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cpattern id='p' width='40' height='40' patternUnits='userSpaceOnUse'%3E%3Cpath d='M20 2l2 6h6l-5 4 2 6-5-4-5 4 2-6-5-4h6z' fill='%23fff' fill-opacity='.6' /%3E%3C/pattern%3E%3C/defs%3E%3Crect fill='url(%23p)' width='200' height='200'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

.chat-body > * {
    position: relative;
    z-index: 1;
}

/* Date divider */
.date-divider {
    text-align: center;
    margin: 8px 0 6px;
}

.date-divider span {
    background: #182229;
    color: var(--wp-text-secondary);
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
    font-weight: 500;
    letter-spacing: 0.2px;
}

/* ===== MENSAGENS ===== */
.message {
    max-width: 78%;
    padding: 6px 8px 6px 10px;
    border-radius: 8px;
    font-size: 14.2px;
    line-height: 1.45;
    position: relative;
    word-wrap: break-word;
    animation: msgPop 0.2s ease-out;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

@keyframes msgPop {
    from { opacity: 0; transform: translateY(6px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Mensagem recebida */
.message.received {
    align-self: flex-start;
    background: var(--wp-received);
    color: var(--wp-text);
    border-top-left-radius: 2px;
    margin-right: 40px;
}

.message.received::before {
    content: '';
    position: absolute;
    top: 0;
    left: -7px;
    width: 0;
    height: 0;
    border-top: 0px solid transparent;
    border-right: 8px solid var(--wp-received);
    border-bottom: 8px solid transparent;
}

/* Mensagem enviada */
.message.sent {
    align-self: flex-end;
    background: var(--wp-sent);
    color: var(--wp-text);
    border-top-right-radius: 2px;
    margin-left: 40px;
}

.message.sent::before {
    content: '';
    position: absolute;
    top: 0;
    right: -7px;
    width: 0;
    height: 0;
    border-top: 0px solid transparent;
    border-left: 8px solid var(--wp-sent);
    border-bottom: 8px solid transparent;
}

/* Timestamp */
.message .time {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    float: right;
    margin-left: 10px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.message.received .time {
    color: var(--wp-text-secondary);
}

.message .check {
    color: rgba(255, 255, 255, 0.45);
    font-size: 13px;
    transition: color 0.25s ease;
}

.message .check.read {
    color: var(--wp-blue-check);
}

/* ===== ÁUDIO ===== */
.message.audio-msg {
    min-width: 240px;
    padding: 8px 10px;
}

.audio-player {
    display: flex;
    align-items: center;
    gap: 10px;
}

.audio-play-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s;
}

.audio-play-btn:hover {
    background: rgba(255,255,255,0.1);
}

.audio-wave-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.audio-wave {
    display: flex;
    align-items: end;
    gap: 1.5px;
    height: 22px;
}

.audio-wave .bar {
    width: 3px;
    border-radius: 2px;
    background: rgba(255,255,255,0.5);
    transition: height 0.15s;
}

.audio-progress {
    width: 100%;
    height: 3px;
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
    overflow: hidden;
}

.audio-progress-bar {
    height: 100%;
    background: var(--wp-green);
    width: 0%;
    border-radius: 3px;
    transition: width 0.1s;
}

.audio-duration {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
}

/* ===== IMAGEM NA MENSAGEM ===== */
.message img.chat-image {
    width: 100%;
    max-width: 280px;
    border-radius: 6px;
    display: block;
    margin-bottom: 4px;
}

/* ===== TYPING INDICATOR ===== */
.typing-indicator {
    align-self: flex-start;
    background: var(--wp-received);
    padding: 12px 18px;
    border-radius: 8px;
    border-top-left-radius: 2px;
    display: flex;
    gap: 4px;
    animation: msgPop 0.2s ease-out;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

.typing-indicator::before {
    content: '';
    position: absolute;
    top: 0;
    left: -7px;
    width: 0;
    height: 0;
    border-top: 0px solid transparent;
    border-right: 8px solid var(--wp-received);
    border-bottom: 8px solid transparent;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    background: var(--wp-text-secondary);
    border-radius: 50%;
    animation: typingPulse 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingPulse {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* ===== FOOTER ===== */
.chat-footer {
    background: var(--wp-header);
    padding: 6px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 10;
}

.input-container {
    flex: 1;
    background: var(--wp-input-bg);
    border-radius: 24px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: box-shadow 0.2s;
}

.input-container:focus-within {
    box-shadow: 0 0 0 1px var(--wp-green);
}

.input-container i {
    color: var(--wp-text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.15s;
}

.input-container i:hover {
    color: var(--wp-text);
}

#message-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--wp-text);
    font-size: 15px;
    font-family: inherit;
    min-width: 0;
}

#message-input::placeholder {
    color: var(--wp-text-secondary);
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--wp-green);
    border: none;
    color: var(--wp-dark-bg);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-btn:hover {
    background: var(--wp-green-light);
    transform: scale(1.05);
}

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

/* ===== TELA DE CHAMADA ===== */
.call-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    background: #000;
    display: flex;
    flex-direction: column;
}

.call-overlay.hidden {
    display: none;
}

#call-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.5s ease;
}

.call-overlay-ui {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0.75) 0%,
        transparent 30%,
        transparent 70%,
        rgba(0,0,0,0.85) 100%
    );
}

.call-top {
    padding: 50px 24px 0;
    text-align: center;
}

.call-avatar-container {
    width: 110px;
    height: 110px;
    margin: 10px auto 18px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s ease;
}

.call-avatar-container.connected {
    opacity: 0;
    transform: scale(0.6);
    pointer-events: none;
    display: none;
}

.call-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 2;
}

.call-avatar-container::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.65);
    animation: callPulse 1.8s infinite;
}

@keyframes callPulse {
    0% { transform: scale(0.9); opacity: 0.9; }
    100% { transform: scale(1.5); opacity: 0; }
}

.call-name {
    color: #fff;
    font-size: 26px;
    font-weight: 600;
    display: block;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.call-timer {
    color: rgba(255,255,255,0.75);
    font-size: 16px;
    margin-top: 6px;
    display: block;
    font-weight: 300;
}

.call-bottom {
    padding: 0 24px 60px;
    display: flex;
    justify-content: center;
    gap: 28px;
    align-items: center;
}

.call-action-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.18);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.2s;
}

.call-action-btn span {
    font-size: 9px;
    font-weight: 500;
    margin-top: 2px;
}

.call-action-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

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

.end-call-btn {
    background: #ff3b30 !important;
    width: 66px;
    height: 66px;
    font-size: 24px;
    box-shadow: 0 4px 20px rgba(255,59,48,0.4);
}

.end-call-btn:hover {
    background: #ff5247 !important;
}

/* ===== NOTIFICATION BANNER ===== */
.notification-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--wp-header);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    animation: slideDown 0.3s ease-out;
    cursor: pointer;
    max-width: 500px;
    margin: 0 auto;
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

.notification-banner img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.notification-banner .notif-text {
    flex: 1;
}

.notification-banner .notif-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--wp-text);
}

.notification-banner .notif-msg {
    font-size: 13px;
    color: var(--wp-text-secondary);
}

/* ===== SCROLLBAR ===== */
.chat-body::-webkit-scrollbar {
    width: 4px;
}

.chat-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.12);
    border-radius: 4px;
}

/* ===== RESPONSIVO ===== */
@media (min-width: 501px) {
    #chat-screen {
        border-radius: 12px;
        height: 92dvh;
        box-shadow: 0 12px 48px rgba(0,0,0,0.5);
    }
}

@media (max-width: 500px) {
    .message {
        max-width: 84%;
    }
}
/* ===== LINKS NO CHAT ===== */
.chat-link {
    color: #53bdeb;
    text-decoration: none;
    word-break: break-all;
}

.chat-link:hover {
    text-decoration: underline;
}

/* ===== IMAGEM NO CHAT ===== */
.chat-image {
    width: 100%;
    max-width: 260px;
    border-radius: 8px;
    display: block;
    margin-bottom: 4px;
    cursor: pointer;
    transition: transform 0.2s;
}

.chat-image:hover {
    transform: scale(1.02);
}

/* ===== MSG CONTENT (para quebra de linha) ===== */
.msg-content {
    white-space: pre-wrap;
    word-wrap: break-word;
}