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

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    padding: 4rem 2rem;
    color: #2d3748;
}

.container {
    max-width: 140rem;
    margin: 0 auto;
}

h1 {
    text-align: center;
    font-size: 4rem;
    font-weight: 700;
    color: white;
    margin-bottom: 1rem;
    text-shadow: 0 0.2rem 0.4rem rgba(0, 0, 0, 0.1);
}

.subtitle {
    text-align: center;
    font-size: 1.6rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 4rem;
}

.demo-section {
    background: white;
    border-radius: 2rem;
    padding: 3rem;
    margin-bottom: 3rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.1);
}

.demo-section h2 {
    font-size: 2.4rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 0.2rem solid #e2e8f0;
}

.demo-area {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50rem;
}

.demo-note {
    text-align: center;
    font-size: 1.4rem;
    color: #718096;
    margin-bottom: 2rem;
}

/* Chat widget base */
.chat-widget {
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-widget.compact {
    width: 38rem;
    height: 55rem;
}

.chat-widget.expanded {
    width: 45rem;
    height: 65rem;
}

.chat-widget.with-contacts {
    width: 90rem;
    height: 70rem;
    flex-direction: row;
}

/* Chat header */
.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.avatar-status {
    position: relative;
}

.avatar {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.avatar.small {
    width: 4.5rem;
    height: 4.5rem;
    font-size: 2rem;
}

.avatar.tiny {
    width: 4rem;
    height: 4rem;
    font-size: 1.6rem;
}

.status-dot {
    position: absolute;
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 50%;
    border: 0.2rem solid white;
    bottom: 0;
    right: 0;
}

.status-dot.online {
    background: #48bb78;
}

.status-dot.offline {
    background: #cbd5e0;
}

.status-dot.busy {
    background: #f56565;
}

.status-dot.away {
    background: #ed8936;
}

.contact-info h3 {
    color: white;
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.status-text {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.3rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.icon-btn {
    width: 3.5rem;
    height: 3.5rem;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 0.8rem;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.4rem;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

/* Chat body */
.chat-body {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background: #f7fafc;
}

.chat-body::-webkit-scrollbar {
    width: 0.6rem;
}

.chat-body::-webkit-scrollbar-track {
    background: #edf2f7;
}

.chat-body::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 1rem;
}

.chat-body::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.date-separator {
    text-align: center;
    margin: 2rem 0;
}

.date-separator span {
    background: #e2e8f0;
    color: #718096;
    padding: 0.5rem 1.5rem;
    border-radius: 2rem;
    font-size: 1.2rem;
    font-weight: 500;
}

/* Messages */
.message {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.message.sent {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.message-content {
    max-width: 70%;
    display: flex;
    flex-direction: column;
}

.message.received .message-content {
    align-items: flex-start;
}

.message.sent .message-content {
    align-items: flex-end;
}

.message-content p {
    background: white;
    padding: 1.2rem 1.6rem;
    border-radius: 1.5rem;
    font-size: 1.4rem;
    color: #2d3748;
    line-height: 1.5;
    margin-bottom: 0.5rem;
    box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.05);
}

.message.sent .message-content p {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.message-time {
    font-size: 1.1rem;
    color: #a0aec0;
    padding: 0 0.5rem;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.typing-dots {
    background: white;
    padding: 1.2rem 1.6rem;
    border-radius: 1.5rem;
    display: flex;
    gap: 0.5rem;
    box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.05);
}

.typing-dots span {
    width: 0.8rem;
    height: 0.8rem;
    background: #cbd5e0;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-0.8rem);
        opacity: 1;
    }
}

/* System message */
.system-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 1rem;
    margin: 2rem 0;
    font-size: 1.3rem;
    color: #667eea;
}

/* Chat footer */
.chat-footer {
    padding: 1.5rem 2rem;
    background: white;
    border-top: 0.1rem solid #e2e8f0;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.message-input {
    flex: 1;
    padding: 1.2rem 1.6rem;
    border: 0.15rem solid #e2e8f0;
    border-radius: 2.5rem;
    font-size: 1.4rem;
    font-family: 'Poppins', sans-serif;
    outline: none;
    transition: all 0.3s ease;
}

.message-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.3rem rgba(102, 126, 234, 0.1);
}

.send-btn {
    width: 4rem;
    height: 4rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.6rem;
}

.send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0.5rem 1.5rem rgba(102, 126, 234, 0.3);
}

.chat-footer .icon-btn {
    background: transparent;
    color: #718096;
}

.chat-footer .icon-btn:hover {
    background: #f7fafc;
    color: #667eea;
}

/* Floating chat */
.floating-demo {
    position: relative;
    background: #f7fafc;
    border-radius: 1.5rem;
    padding: 3rem;
    min-height: 60rem;
}

.floating-chat-widget {
    position: absolute;
    bottom: 10rem;
    right: 3rem;
    width: 38rem;
    height: 50rem;
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(2rem) scale(0.95);
    transition: all 0.3s ease;
    pointer-events: none;
}

.floating-chat-widget.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.floating-chat-btn {
    position: absolute;
    bottom: 3rem;
    right: 3rem;
    width: 6rem;
    height: 6rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.6rem;
    box-shadow: 0 0.5rem 2rem rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

.floating-chat-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 1rem 3rem rgba(102, 126, 234, 0.5);
}

.floating-chat-btn.hidden {
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
}

.notification-badge {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    width: 2.4rem;
    height: 2.4rem;
    background: #f56565;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    border: 0.2rem solid white;
}

/* Welcome message */
.welcome-message {
    text-align: center;
    padding: 3rem 2rem;
}

.welcome-icon {
    width: 8rem;
    height: 8rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    color: white;
    margin: 0 auto 2rem;
}

.welcome-message h4 {
    font-size: 2rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 1rem;
}

.welcome-message p {
    font-size: 1.4rem;
    color: #718096;
}

/* Quick actions */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0 2rem;
}

.quick-action-btn {
    background: white;
    border: 0.15rem solid #e2e8f0;
    border-radius: 1rem;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.4rem;
    color: #2d3748;
    font-family: 'Poppins', sans-serif;
}

.quick-action-btn:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
    transform: translateX(0.5rem);
}

.quick-action-btn i {
    font-size: 2rem;
    color: #667eea;
}

/* Contacts sidebar */
.contacts-sidebar {
    width: 32rem;
    background: #f7fafc;
    border-right: 0.1rem solid #e2e8f0;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 0.1rem solid #e2e8f0;
}

.sidebar-header h3 {
    font-size: 2rem;
    font-weight: 600;
    color: #2d3748;
}

.search-box {
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: white;
    margin: 1rem;
    border-radius: 1rem;
}

.search-box i {
    color: #a0aec0;
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.4rem;
    font-family: 'Poppins', sans-serif;
    color: #2d3748;
}

.contacts-list {
    flex: 1;
    overflow-y: auto;
}

.contact-item {
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.contact-item:hover {
    background: rgba(102, 126, 234, 0.05);
}

.contact-item.active {
    background: rgba(102, 126, 234, 0.1);
    border-left: 0.3rem solid #667eea;
}

.contact-details {
    flex: 1;
    min-width: 0;
}

.contact-details h4 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.3rem;
}

.last-message {
    font-size: 1.2rem;
    color: #a0aec0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contact-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.contact-meta .time {
    font-size: 1.1rem;
    color: #a0aec0;
}

.unread-badge {
    background: #667eea;
    color: white;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Chat main */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 3rem;
    }

    .subtitle {
        font-size: 1.4rem;
    }

    .demo-section {
        padding: 2rem;
    }

    .demo-section h2 {
        font-size: 2rem;
    }

    .chat-widget.compact,
    .chat-widget.expanded {
        width: 100%;
        max-width: 40rem;
    }

    .chat-widget.with-contacts {
        width: 100%;
        flex-direction: column;
    }

    .contacts-sidebar {
        width: 100%;
        max-height: 30rem;
        border-right: none;
        border-bottom: 0.1rem solid #e2e8f0;
    }

    .floating-chat-widget {
        width: calc(100% - 4rem);
        right: 2rem;
        left: 2rem;
    }

    .floating-chat-btn {
        bottom: 2rem;
        right: 2rem;
    }
}