/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

:root {
    --app-height: 100vh;
}

.app-container {
    height: var(--app-height);
}
body {
    background: #000;
    color: #fff;
    height: var(--app-height);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    margin: 0;
}

/* App Container - Responsive & Safe Area Support */
.app-container {
    width: 100%;
    height: var(--app-height);
    background: #000;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Desktop View */
@media (min-width: 768px) {
    body {
        background: linear-gradient(135deg, #000, #111);
        padding: 20px;
    }

    .app-container {
        width: 95%;
        max-width: 1200px;
        height: 92vh;
        border-radius: 12px;
        box-shadow: 0 0 40px rgba(0, 168, 132, 0.1);
        border: 1px solid #2a3942;
    }
}

/* Header */
.app-header {
    background: #111b21;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
    z-index: 10;
    flex-shrink: 0;
    border-bottom: 1px solid #2a3942;
}

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

.header-title {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: bold;
    font-size: 1.2rem;
    color: #e9edef;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.user-status {
    font-size: 0.8rem;
    color: #8696a0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.online-dot {
    width: 8px;
    height: 8px;
    background: #00a884;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(0, 168, 132, 0.5);
}

.header-right .avatar {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #10e030;
    box-shadow: 0 0 10px rgba(16, 224, 48, 0.3);
}

/* Chat Area */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #000306;
    scroll-behavior: smooth;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(0, 168, 132, 0.03) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(0, 168, 132, 0.03) 0%, transparent 20%);
}

/* Message Bubbles */
.message {
    max-width: 82%;
    display: flex;
    flex-direction: column;
}

.message-sender {
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 4px;
    opacity: 0.9;
    color: #5187a9;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 7.5px;
    font-size: 0.97rem;
    line-height: 1.45;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-time {
    font-size: 0.68rem;
    margin-top: 4px;
    opacity: 0.8;
    color: #667781;
}

/* User Messages (Right) */
.user-message {
    align-self: flex-end;
}

.user-message .message-bubble {
    background: #667371;
    color: #f4f5f6;
    border-top-right-radius: 0;
    border: 1px solid #2dbea1;
}

.user-message .message-time {
    text-align: right;
}

/* Ghost Messages (Left) */
.ghost-message {
    align-self: flex-start;
}

.ghost-message .message-bubble {
    background: #052436;
    color: #e9edef;
    border-top-left-radius: 0;
    border: 1px solid #2a3942;
}

.ghost-message .message-time {
    text-align: left;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-self: flex-start;
    background: #202c33;
    padding: 12px 16px;
    border-radius: 7.5px;
    border-top-left-radius: 0;
    border: 1px solid #2a3942;
    margin-top: 4px;
}

.typing-dots {
    display: flex;
    gap: 6px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #00a884;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
    box-shadow: 0 0 4px rgba(0, 168, 132, 0.5);
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

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

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

/* Input Area */
.input-container {
    background: #111b21;
    padding: 12px 16px;
    display: flex;
    gap: 12px;
    align-items: center;
    box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    border-top: 1px solid #2a3942;
    position: relative;
    z-index: 5;
    padding-bottom: max(env(safe-area-inset-bottom, 12px), 12px);
}

.input-field {
    flex: 1;
    padding: 14px 18px;
    border: none;
    border-radius: 8px;
    background: #2a3942;
    color: #e9edef;
    font-size: 0.97rem;
    outline: none;
    border: 1px solid #374248;
    transition: all 0.2s ease;
    min-width: 0;
}

.input-field:focus {
    border-color: #00a884;
    box-shadow: 0 0 0 2px rgba(0, 168, 132, 0.2);
    background: #32424a;
}

.input-buttons {
    display: flex;
    gap: 10px;
}

.action-button {
    background: none;
    border: none;
    color: #aebac1;
    font-size: 1.3rem;
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.action-button:hover {
    background: #2a3942;
    color: #00a884;
    transform: scale(1.05);
}

.send-button {
    background: #00a884;
    color: white;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 12px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 168, 132, 0.2);
    flex-shrink: 0;
}

.send-button:hover {
    background: #069c7a;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 168, 132, 0.3);
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .input-container {
        padding: 10px 12px;
        gap: 8px;
    }

    .input-field {
        padding: 12px 14px;
        font-size: 0.95rem;
    }

    .action-button {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .send-button {
        padding: 12px 16px;
        font-size: 0.9rem;
        min-width: 60px;
    }

    .header-right .avatar {
        width: 45px;
        height: 45px;
    }

    @media (max-width: 360px) {
        .input-container {
            padding: 8px 10px;
            gap: 6px;
        }

        .input-field {
            padding: 10px 12px;
            font-size: 0.9rem;
        }

        .action-button {
            width: 36px;
            height: 36px;
            font-size: 1.1rem;
        }

        .send-button {
            padding: 10px 14px;
            font-size: 0.85rem;
            min-width: 55px;
        }

        .header-right .avatar {
            width: 40px;
            height: 40px;
        }
    }
}

/* Animations */
@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
        opacity: 0.6;
    }

    50% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* Scrollbar */
.chat-container::-webkit-scrollbar {
    width: 6px;
}

.chat-container::-webkit-scrollbar-track {
    background: #0b141a;
}

.chat-container::-webkit-scrollbar-thumb {
    background: #2a3942;
    border-radius: 3px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: #374248;
}
