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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background: #1a1a2e;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

/* Animated Mesh Gradient Background */
.animated-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    overflow: hidden;
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    animation-direction: alternate;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, #667eea 0%, transparent 70%);
    top: -10%;
    left: -10%;
    animation: float1 20s infinite;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #764ba2 0%, transparent 70%);
    top: 60%;
    right: -5%;
    animation: float2 18s infinite;
}

.orb-3 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, #f093fb 0%, transparent 70%);
    bottom: -10%;
    left: 30%;
    animation: float3 22s infinite;
}

.orb-4 {
    width: 550px;
    height: 550px;
    background: radial-gradient(circle, #4facfe 0%, transparent 70%);
    top: 30%;
    left: 50%;
    animation: float4 25s infinite;
}

.orb-5 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #fa709a 0%, transparent 70%);
    top: 10%;
    right: 20%;
    animation: float5 16s infinite;
}

@keyframes float1 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(100px, -80px) scale(1.1);
    }
    66% {
        transform: translate(-50px, 100px) scale(0.9);
    }
}

@keyframes float2 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(-120px, 60px) scale(1.15);
    }
    66% {
        transform: translate(80px, -70px) scale(0.95);
    }
}

@keyframes float3 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(-90px, -100px) scale(1.05);
    }
    66% {
        transform: translate(110px, 50px) scale(1.1);
    }
}

@keyframes float4 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(70px, 90px) scale(0.9);
    }
    66% {
        transform: translate(-100px, -60px) scale(1.2);
    }
}

@keyframes float5 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(-80px, 110px) scale(1.1);
    }
    66% {
        transform: translate(90px, -90px) scale(0.95);
    }
}

/* Messenger Header */
.messenger-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.header-info {
    display: flex;
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
}

.profile-pic {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    color: #764ba2;
    margin-right: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.header-text h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 2px;
}

.header-text p {
    font-size: 13px;
    opacity: 0.9;
}

/* Main Container */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* Sidebar */
.sidebar {
    width: 350px;
    background: white;
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.sidebar-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #333;
}

/* Contacts List */
.contacts-list {
    flex: 1;
    overflow-y: auto;
}

.contact {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
}

.contact:hover {
    background: rgba(102, 126, 234, 0.08);
    transform: translateX(5px);
    box-shadow: inset 4px 0 0 rgba(102, 126, 234, 0.5);
}

.contact:hover .contact-pic {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.contact.active {
    background: rgba(102, 126, 234, 0.1);
}

.contact-pic {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 20px;
    color: white;
    margin-right: 12px;
    flex-shrink: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.contact-name {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.contact-message {
    font-size: 13px;
    color: #65676b;
    line-height: 1.4;
    word-wrap: break-word;
}

/* Chat Container */
.chat-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: transparent;
}

/* Message Groups */
.message-group {
    margin-bottom: 30px;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Messages */
.message {
    display: flex;
    margin-bottom: 8px;
}

.message.left {
    justify-content: flex-start;
}

.message.right {
    justify-content: flex-end;
}

/* Message Bubbles */
.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.message.left .message-bubble {
    background: white;
    border-bottom-left-radius: 4px;
    color: #333;
}

.message.right .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-bottom-right-radius: 4px;
    color: white;
    cursor: pointer;
}

.message.right .message-bubble:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4),
                0 0 40px rgba(118, 75, 162, 0.3);
}

.message.right .message-bubble:hover .message-header {
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

/* Message Content */
.message-bubble p {
    margin: 0;
    line-height: 1.5;
    font-size: 15px;
}

.message-header {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 6px;
    color: #ffd700;
}

.message-preview {
    font-size: 13px;
    opacity: 0.8;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Typing Indicator */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    animation: typingBounce 1.4s infinite;
    display: inline-block;
}

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

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

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

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

.message-content {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    animation: expandContent 0.3s ease;
}

.message-content.hidden {
    display: none;
}

@keyframes expandContent {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 5000px;
    }
}

.message-content h3 {
    color: #ffd700;
    margin-bottom: 15px;
    font-size: 18px;
}

.message-content p {
    margin-bottom: 10px;
    line-height: 1.7;
}

.message-content ul {
    margin-left: 20px;
    margin-top: 10px;
}

.message-content li {
    margin-bottom: 8px;
    line-height: 1.6;
}

/* Images Gallery */
.images-gallery {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-top: 15px;
}

.image-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.images-gallery img {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.images-gallery img:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.caption {
    font-size: 13px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.95);
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-left: 3px solid #ffd700;
    border-radius: 8px;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .chat-container {
        padding: 15px 10px;
    }

    .message-bubble {
        max-width: 85%;
        padding: 10px 14px;
    }

    .header-text h2 {
        font-size: 16px;
    }

    .header-text p {
        font-size: 12px;
    }

    .profile-pic {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .message-header {
        font-size: 15px;
    }

    .message-bubble p {
        font-size: 14px;
    }

    .caption {
        font-size: 12px;
    }
}

/* Scrollbar Styling */
.chat-container::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.contacts-list::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

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

.chat-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.sidebar::-webkit-scrollbar-track,
.contacts-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

.sidebar::-webkit-scrollbar-thumb,
.contacts-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.contacts-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Documentation Modal */
.doc-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    animation: fadeIn 0.3s ease;
}

.doc-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.doc-modal-content {
    background: rgba(102, 126, 234, 0.15);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 95%;
    height: 95%;
    max-width: 1400px;
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5),
                0 0 100px rgba(102, 126, 234, 0.3),
                inset 0 0 80px rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    position: relative;
    animation: slideIn 0.3s ease;
    overflow: hidden;
}

@keyframes slideIn {
    from {
        transform: scale(0.9) translateY(50px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.doc-close-btn {
    position: absolute;
    top: 20px;
    right: 25px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: white;
    font-size: 40px;
    font-weight: bold;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    z-index: 10;
}

.doc-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.doc-modal-header {
    padding: 30px 40px;
    font-size: 28px;
    font-weight: 600;
    color: #ffd700;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.doc-modal-body {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    color: white;
    line-height: 1.7;
}

.doc-modal-body p {
    margin-bottom: 15px;
    font-size: 16px;
}

.doc-modal-body ul {
    margin-left: 25px;
    margin-top: 15px;
    margin-bottom: 15px;
}

.doc-modal-body li {
    margin-bottom: 12px;
    font-size: 16px;
}

.doc-modal-body h3,
.message-content h3 {
    color: #ffd700;
    margin-top: 30px;
    margin-bottom: 20px;
    font-size: 22px;
    font-weight: 600;
}

.doc-modal-body strong,
.message-content strong {
    color: #ffed4e;
    font-weight: 600;
}

.doc-modal-body a,
.message-content a {
    color: #ffd700;
    text-decoration: underline;
    transition: all 0.3s ease;
}

.doc-modal-body a:hover,
.message-content a:hover {
    color: #ffed4e;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.doc-modal-body .images-gallery {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-top: 20px;
}

.doc-modal-body .image-item {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.doc-modal-body img {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.doc-modal-body img:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.doc-modal-body .caption {
    font-size: 15px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.95);
    padding: 15px 18px;
    background: rgba(0, 0, 0, 0.25);
    border-left: 4px solid #ffd700;
    border-radius: 8px;
    margin: 0;
}

/* Modal scrollbar */
.doc-modal-body::-webkit-scrollbar {
    width: 12px;
}

.doc-modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.doc-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.doc-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* User selection should still be allowed */
.doc-modal-body {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

/* Responsive modal */
@media (max-width: 768px) {
    .doc-modal-content {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .doc-close-btn {
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 35px;
    }

    .doc-modal-header {
        padding: 20px 25px;
        font-size: 22px;
    }

    .doc-modal-body {
        padding: 25px 20px;
    }

    .doc-modal-body p,
    .doc-modal-body li {
        font-size: 15px;
    }

    .doc-modal-body .caption {
        font-size: 14px;
        padding: 12px 15px;
    }
}
