* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #075e54, #128c7e);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.phone-container {
    width: 375px;
    height: 667px;
    background: #fff;
    border-radius: 25px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.header {
    background: #075e54;
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    position: relative;
    flex-shrink: 0;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.1), transparent);
}

.back-arrow {
    margin-right: 10px;
    font-size: 20px;
    cursor: pointer;
}

.profile-picture {
    margin-right: 10px;
}

.profile-picture img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.contact-info {
    flex: 1;
}

.contact-name {
    font-weight: 600;
    font-size: 16px;
}

.contact-status {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 2px;
    position: relative;
}

.typing-status {
    font-size: 13px;
    color: #4caf50;
    font-style: italic;
    animation: typingPulse 1.5s infinite;
}

@keyframes typingPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.header-actions {
    display: flex;
    gap: 15px;
    font-size: 18px;
}

.chat-container {
    flex: 1;
    background: #e5ddd5;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(120, 219, 255, 0.3) 0%, transparent 50%);
    overflow-y: auto;
    padding: 10px;
    padding-bottom: 10px;
    transition: padding-bottom 0.3s ease;
}

.chat-container.keyboard-active {
    padding-bottom: 280px;
}

.message {
    margin: 10px 0;
    display: flex;
    align-items: flex-end;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.message.sent {
    justify-content: flex-end;
}

.message.received {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
}

.message.sent .message-bubble {
    background: #dcf8c6;
    color: #000;
    border-bottom-right-radius: 4px;
}

.message.received .message-bubble {
    background: #fff;
    color: #000;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
    text-align: right;
}

.message.received .message-time {
    text-align: left;
}

.typing-indicator {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #fff;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    margin: 10px 0;
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.input-container {
    background: #d9d9db;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
}

.input-field {
    flex: 1;
    background: #2d2d2d;
    color: #fff;
    border: none;
    border-radius: 21px;
    padding: 8px 15px;
    font-size: 15px;
    outline: none;
    max-height: 100px;
    overflow-y: auto;
}

.input-field::placeholder {
    color: #999;
}

.input-emoji {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-emoji svg {
    width: 24px;
    height: 24px;
}

.input-attach {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
}

.input-attach {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-attach svg {
    width: 22px;
    height: 22px;
}

.input-camera {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-camera svg {
    width: 22px;
    height: 22px;
}

.send-button {
    background: #25d366;
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.send-button svg {
    width: 22px;
    height: 22px;
}

.send-button:hover {
    background: #20ba5a;
}

.mic-button {
    background: #25d366;
    border: none;
    color: #fff;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.mic-button svg {
    width: 22px;
    height: 22px;
}

.mic-button:hover {
    background: #20ba5a;
}

.menu-button {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    filter: brightness(0) invert(1);
}

.status-indicator {
    width: 8px;
    height: 8px;
    background: #4caf50;
    border-radius: 50%;
    margin-right: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

.emoji {
    font-size: 16px;
}

.highlight {
    background: #ffeb3b;
    padding: 2px 4px;
    border-radius: 3px;
}

.alert-box {
    background: #ff5722;
    color: white;
    padding: 8px 12px;
    border-radius: 12px;
    margin: 5px 0;
    font-weight: bold;
}

.info-box {
    background: #2196f3;
    color: white;
    padding: 8px 12px;
    border-radius: 12px;
    margin: 5px 0;
}

.success-box {
    background: #4caf50;
    color: white;
    padding: 8px 12px;
    border-radius: 12px;
    margin: 5px 0;
}

.scroll-indicator {
    position: absolute;
    bottom: 80px;
    right: 20px;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    animation: fadeInOut 3s infinite;
    cursor: pointer;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* Keyboard Simulation */
.keyboard-container {
    position: absolute;
    bottom: 70px;
    left: 0;
    width: 100%;
    background: #f0f0f0;
    border-top: 3px solid #075e54;
    padding: 10px;
    display: none;
    z-index: 100;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 6px;
}

.keyboard-key {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
    min-width: 32px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.keyboard-key.wide {
    min-width: 80px;
}

.keyboard-key.space {
    min-width: 150px;
}

.emoji-bar {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-bottom: 8px;
    font-size: 18px;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.keyboard-container.slide-in {
    animation: slideUp 0.3s ease-out;
}
