/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Authentication Styles */
.auth-container {
    max-width: 400px;
    margin: 50px auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

.auth-tabs {
    display: flex;
    background: #f8f9fa;
}

.tab-btn {
    flex: 1;
    padding: 15px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: white;
    color: #667eea;
    border-bottom: 3px solid #667eea;
}

.auth-form {
    padding: 30px;
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-form h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.alert {
    padding: 12px;
    border-radius: 8px;
    margin-top: 20px;
    text-align: center;
}

.alert-error {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.alert-success {
    background: #efe;
    color: #363;
    border: 1px solid #cfc;
}

/* Chat App Styles */
.chat-container {
    display: flex;
    height: calc(100vh - 40px);
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}

.chat-container.chat-hidden {
    border-radius: 15px;
}

.chat-container.chat-hidden .chat-area {
    display: none;
}

.chat-container.chat-hidden .sidebar {
    width: 100%;
    margin-right: 0;
}

/* Show chat area when user is selected */
.chat-area.active {
    display: flex !important;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background: #ffffff;
    border-right: 1px solid #e1e5e9;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    overflow: hidden;
}

.sidebar-header {
    padding: 20px;
    background: white;
    border-bottom: 1px solid #e1e5e9;
}

.user-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-name {
    font-weight: 600;
    color: #333;
}

.logout-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
}

.search-container {
    padding: 20px;
    border-bottom: 1px solid #e1e5e9;
}

.search-input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #e1e5e9;
    border-radius: 20px;
    font-size: 14px;
}

.users-list {
    flex: 1;
    overflow-y: auto;
}

.user-item {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
}

.user-item:hover {
    background: #f5f5f5;
}

.user-item.active {
    background: #e7f3ff;
    color: #000;
    border-left: 3px solid #25d366;
}

.user-details {
    display: flex;
    align-items: center;
}

.user-avatar {
    width: 49px;
    height: 49px;
    border-radius: 50%;
    background: #25d366;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 15px;
    font-size: 20px;
    flex-shrink: 0;
}

.user-name-text {
    font-weight: 400;
    font-size: 17px;
    color: #111b21;
    margin-bottom: 2px;
}

.user-status {
    font-size: 13px;
    color: #667781;
    font-weight: 400;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    flex-shrink: 0;
}

.status-online {
    background: #25d366;
}

.status-offline {
    background: #667781;
}

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    width: calc(100% - 300px);
    overflow: hidden;
}

.chat-header {
    padding: 10px 20px;
    background: #f0f2f5;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    align-items: center;
    gap: 15px;
    min-height: 60px;
}

.back-btn {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.back-btn:hover {
    background: #5a6fd8;
    transform: scale(1.05);
}

.chat-user-info {
    display: flex;
    align-items: center;
}

.chat-user-name {
    font-weight: 600;
    color: #333;
    margin-left: 12px;
}

.messages-container {
    flex: 1;
    padding: 20px;
    padding-bottom: 100px;
    overflow-y: auto;
    background: #e5ddd5;
    margin-bottom: 80px;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="%23ffffff" opacity="0.1"/><circle cx="10" cy="60" r="0.5" fill="%23ffffff" opacity="0.1"/><circle cx="90" cy="40" r="0.5" fill="%23ffffff" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="%23e5ddd5"/><rect width="100" height="100" fill="url(%23grain)"/></svg>');
}

.message {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-end;
}

.message.sent {
    justify-content: flex-end;
}

.message.received {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
}

.message.sent .message-bubble {
    background: #d9fdd3;
    color: #111b21;
    border-bottom-right-radius: 5px;
    border-bottom-left-radius: 18px;
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
}

.message.received .message-bubble {
    background: white;
    color: #111b21;
    border: none;
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 18px;
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
}

.message-status {
    font-size: 11px;
    opacity: 0.7;
    margin-left: 5px;
}

.message-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e1e5e9;
    position: fixed;
    bottom: 0;
    left: 300px;
    right: 0;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.chat-container.chat-hidden .message-input-container {
    display: none;
}

.message-input-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.emoji-btn {
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.emoji-btn:hover {
    background: #e9ecef;
    transform: scale(1.05);
}

.file-btn {
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.file-btn:hover {
    background: #e9ecef;
    transform: scale(1.05);
}

.file-display {
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 10px;
    margin: 5px 0;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-icon {
    font-size: 16px;
}

.file-name {
    flex: 1;
    font-size: 14px;
    color: #333;
}

.remove-file {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-file:hover {
    background: #c82333;
}

.dark-theme .file-btn {
    background: #34495e;
    border: 1px solid #4a5f7a;
    color: #ecf0f1;
}

.dark-theme .file-btn:hover {
    background: #4a5f7a;
}

.dark-theme .file-display {
    background: #34495e;
    border: 1px solid #4a5f7a;
}

.dark-theme .file-name {
    color: #ecf0f1;
}

/* File Attachments */
.file-attachment {
    margin-top: 8px;
    padding: 8px;
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.image-attachment img {
    display: block;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.image-attachment img:hover {
    transform: scale(1.02);
}

.file-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #333;
    padding: 4px 0;
}

.file-link:hover {
    text-decoration: none;
    color: #667eea;
}

.dark-theme .file-attachment {
    background: rgba(255,255,255,0.05);
    border: 1px solid #4a5f7a;
}

.dark-theme .file-link {
    color: #ecf0f1;
}

.dark-theme .file-link:hover {
    color: #3498db;
}

.message-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #667eea;
    border-radius: 25px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    min-height: 40px;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.message-input:focus {
    outline: none;
    border-color: #5a6fd8;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.emoji-picker {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
}

.emoji-grid span {
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    text-align: center;
    transition: background-color 0.2s ease;
}

.emoji-grid span:hover {
    background: #f8f9fa;
}

.send-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.send-btn:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6c757d;
    text-align: center;
}

.empty-state h3 {
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 14px;
}

/* Responsive Design */
/* Mobile Responsive - WhatsApp Style */
@media (max-width: 768px) {
    body {
        margin: 0;
        padding: 0;
        overflow-x: hidden;
    }
    
    .chat-container {
        flex-direction: column;
        height: 100vh;
        border-radius: 0;
        margin: 0;
        box-shadow: none;
    }
    
    .sidebar {
        width: 100%;
        height: 100vh;
        border-radius: 0;
        margin-right: 0;
        border: none;
    }
    
    .chat-area {
        width: 100%;
        height: 100vh;
        border-radius: 0;
        border: none;
        display: none;
    }
    
    .chat-area.active {
        display: flex !important;
    }
    
    .sidebar-header {
        padding: 15px 20px;
        background: #075e54;
        color: white;
        border-bottom: 1px solid #128c7e;
    }
    
    .sidebar-title {
        font-size: 20px;
        font-weight: 600;
    }
    
    .user-item {
        padding: 15px 20px;
        border-bottom: 1px solid #f0f0f0;
        transition: background-color 0.2s ease;
    }
    
    .user-item:hover {
        background-color: #f5f5f5;
    }
    
    .user-item.active {
        background-color: #e7f3ff;
        border-left: 4px solid #25d366;
    }
    
    .user-avatar {
        width: 50px;
        height: 50px;
        font-size: 20px;
        border: 2px solid #25d366;
    }
    
    .user-name-text {
        font-size: 16px;
        font-weight: 500;
        color: #111b21;
    }
    
    .user-status {
        font-size: 13px;
        color: #667781;
    }
    
    .status-indicator {
        width: 12px;
        height: 12px;
        border: 2px solid white;
    }
    
    .chat-header {
        padding: 15px 20px;
        background: #075e54;
        color: white;
        border-bottom: 1px solid #128c7e;
        min-height: 60px;
    }
    
    .chat-user-info {
        display: flex;
        align-items: center;
        gap: 15px;
    }
    
    .chat-user-name {
        font-size: 18px;
        font-weight: 500;
    }
    
    .call-controls {
        margin-left: auto;
        gap: 10px;
    }
    
    .call-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .messages-container {
        padding: 10px;
        margin-bottom: 80px;
        background: #e5ddd5;
        background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="%23ffffff" opacity="0.1"/><circle cx="10" cy="60" r="0.5" fill="%23ffffff" opacity="0.1"/><circle cx="90" cy="40" r="0.5" fill="%23ffffff" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="%23e5ddd5"/><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    }
    
    .message {
        margin-bottom: 10px;
    }
    
    .message-bubble {
        max-width: 80%;
        font-size: 14px;
        padding: 8px 12px;
        border-radius: 18px;
        word-wrap: break-word;
    }
    
    .message.sent .message-bubble {
        background: #d9fdd3;
        color: #111b21;
        border-bottom-right-radius: 5px;
        margin-left: auto;
    }
    
    .message.received .message-bubble {
        background: white;
        color: #111b21;
        border-bottom-left-radius: 5px;
        box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    }
    
    .message-input-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #f0f2f5;
        padding: 10px;
        border-top: 1px solid #e1e5e9;
        z-index: 1000;
        border-radius: 0;
    }
    
    .message-input {
        font-size: 16px;
        padding: 12px 16px;
        border-radius: 20px;
        border: 1px solid #e1e5e9;
        background: white;
        width: calc(100% - 120px);
    }
    
    .send-btn {
        width: 45px;
        height: 45px;
        font-size: 18px;
        border-radius: 50%;
        background: #25d366;
        color: white;
        border: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-left: 10px;
    }
    
    .emoji-btn, .file-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
        border-radius: 50%;
        background: #f0f2f5;
        border: 1px solid #e1e5e9;
        color: #667781;
        margin-right: 5px;
    }
    
    .emoji-picker {
        position: fixed;
        bottom: 80px;
        left: 10px;
        right: 10px;
        width: auto;
        max-height: 200px;
        border-radius: 15px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    }
    
    .emoji-grid {
        display: grid;
        grid-template-columns: repeat(8, 1fr);
        gap: 5px;
        padding: 10px;
    }
    
    .emoji-grid span {
        padding: 8px;
        text-align: center;
        border-radius: 8px;
        font-size: 18px;
        cursor: pointer;
        transition: background-color 0.2s ease;
    }
    
    .file-input {
        display: none;
    }
    
    .file-display {
        position: fixed;
        bottom: 80px;
        left: 10px;
        right: 10px;
        background: white;
        padding: 10px;
        border-radius: 10px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        z-index: 1001;
    }
    
    .empty-state {
        padding: 50px 20px;
        text-align: center;
        background: #f0f2f5;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .empty-state h3 {
        color: #111b21;
        font-weight: 300;
        margin-bottom: 10px;
        font-size: 24px;
    }
    
    .empty-state p {
        color: #667781;
        font-size: 16px;
        margin-bottom: 20px;
    }
    
    /* Mobile chat behavior */
    .chat-container.mobile-chat-active .sidebar {
        display: none !important;
    }
    
    .chat-container.mobile-chat-active .chat-area {
        display: flex !important;
        width: 100%;
        height: 100vh;
    }
    
    /* Back button for mobile */
    .back-btn {
        background: #075e54;
        color: white;
        border: none;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        font-size: 18px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 15px;
        transition: all 0.3s ease;
    }
    
    .back-btn:hover {
        background: #128c7e;
        transform: scale(1.05);
    }
    
    .back-icon {
        font-size: 20px;
        font-weight: bold;
    }
    
    /* Hide chat area on mobile when no user selected */
    .chat-container.chat-hidden .chat-area {
        display: none;
    }
    
    .chat-container.chat-hidden .sidebar {
        width: 100%;
    }
    
    /* Mobile call interface */
    .call-interface {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: #000;
        z-index: 10000;
    }
    
    .call-container {
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    
    .call-header {
        background: #2c2c2c;
        padding: 15px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .call-user-avatar {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .call-user-name {
        font-size: 16px;
    }
    
    .call-status {
        font-size: 12px;
    }
    
    #localVideo {
        position: absolute;
        top: 15px;
        right: 15px;
        width: 120px;
        height: 90px;
        border-radius: 8px;
        border: 2px solid #25d366;
    }
    
    #remoteVideo {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .call-controls {
        position: absolute;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        gap: 15px;
    }
    
    .call-control-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .incoming-call-modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.9);
        z-index: 10001;
    }
    
    .incoming-call-content {
        background: white;
        padding: 30px 20px;
        border-radius: 15px;
        text-align: center;
        max-width: 350px;
        width: 90%;
        margin: 50% auto 0;
        transform: translateY(-50%);
    }
    
    .incoming-call-avatar {
        width: 80px;
        height: 80px;
        font-size: 32px;
        margin: 0 auto 15px;
    }
    
    .incoming-call-name {
        font-size: 20px;
        margin-bottom: 8px;
    }
    
    .incoming-call-type {
        font-size: 14px;
        margin-bottom: 25px;
    }
    
    .incoming-call-controls {
        display: flex;
        gap: 25px;
        justify-content: center;
    }
    
    .answer-call-btn, .decline-call-btn {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
    
    /* Touch-friendly interactions */
    .user-item {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    .call-btn, .send-btn, .emoji-btn, .file-btn {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    /* Prevent zoom on input focus */
    input[type="text"], input[type="password"], textarea {
        font-size: 16px;
    }
    
    /* Swipe gestures for mobile */
    .user-item {
        position: relative;
        overflow: hidden;
    }
    
    .user-item::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
        transition: left 0.5s;
    }
    
    .user-item:active::before {
        left: 100%;
    }
}

/* Extra small devices (phones, 480px and down) */
@media (max-width: 480px) {
    .sidebar-header {
        padding: 12px 15px;
    }
    
    .sidebar-title {
        font-size: 18px;
    }
    
    .user-item {
        padding: 12px 15px;
    }
    
    .user-avatar {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .user-name-text {
        font-size: 15px;
    }
    
    .user-status {
        font-size: 12px;
    }
    
    .chat-header {
        padding: 12px 15px;
    }
    
    .chat-user-name {
        font-size: 16px;
    }
    
    .call-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .message-bubble {
        max-width: 85%;
        font-size: 13px;
        padding: 7px 11px;
    }
    
    .message-input {
        font-size: 16px;
        padding: 10px 14px;
        width: calc(100% - 100px);
    }
    
    .send-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .emoji-btn, .file-btn {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 3px;
        padding: 8px;
    }
    
    .emoji-grid span {
        padding: 6px;
        font-size: 16px;
    }
    
    .empty-state h3 {
        font-size: 20px;
    }
    
    .empty-state p {
        font-size: 14px;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Dark Theme Styles */
.dark-theme {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: #ecf0f1;
}

.dark-theme .chat-container {
    background: #2c3e50;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.dark-theme .sidebar {
    background: #34495e;
    border-right: 1px solid #4a5f7a;
}

.dark-theme .sidebar-header {
    background: #2c3e50;
    border-bottom: 1px solid #4a5f7a;
}

.dark-theme .user-name {
    color: #ecf0f1;
}

.dark-theme .search-input {
    background: #34495e;
    border: 1px solid #4a5f7a;
    color: #ecf0f1;
}

.dark-theme .search-input::placeholder {
    color: #bdc3c7;
}

.dark-theme .user-item {
    border-bottom: 1px solid #4a5f7a;
    color: #ecf0f1;
}

.dark-theme .user-item:hover {
    background: #4a5f7a;
}

.dark-theme .user-item.active {
    background: #3498db;
    color: white;
}

.dark-theme .user-avatar {
    background: #3498db;
    color: white;
}

.dark-theme .chat-header {
    background: #2c3e50;
    border-bottom: 1px solid #4a5f7a;
}

.dark-theme .chat-user-name {
    color: #ecf0f1;
}

.dark-theme .messages-container {
    background: #34495e;
}

.dark-theme .message.received .message-bubble {
    background: #2c3e50;
    color: #ecf0f1;
    border: 1px solid #4a5f7a;
}

.dark-theme .message.sent .message-bubble {
    background: #3498db;
    color: white;
}

.dark-theme .message-input-container {
    background: #2c3e50;
    border-top: 1px solid #4a5f7a;
}

.dark-theme .message-input {
    background: #2c3e50;
    border: 2px solid #3498db;
    color: #ecf0f1;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.dark-theme .message-input:focus {
    border-color: #2980b9;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.dark-theme .message-input::placeholder {
    color: #bdc3c7;
}

.dark-theme .message-input-container {
    background: #2c3e50;
    border-top: 1px solid #4a5f7a;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
}

.dark-theme .emoji-btn {
    background: #34495e;
    border: 1px solid #4a5f7a;
    color: #ecf0f1;
}

.dark-theme .emoji-btn:hover {
    background: #4a5f7a;
}

.dark-theme .emoji-picker {
    background: #2c3e50;
    border: 1px solid #4a5f7a;
}

.dark-theme .emoji-grid span:hover {
    background: #4a5f7a;
}

.dark-theme .empty-state {
    color: #bdc3c7;
}

/* Theme Toggle Button */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-toggle {
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: #e9ecef;
    transform: scale(1.05);
}

.dark-theme .theme-toggle {
    background: #34495e;
    border: 1px solid #4a5f7a;
    color: #ecf0f1;
}

.dark-theme .theme-toggle:hover {
    background: #4a5f7a;
}

.dark-theme .back-btn {
    background: #3498db;
    color: white;
}

.dark-theme .back-btn:hover {
    background: #2980b9;
}

/* Call Interface Styles */
.call-interface {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
}

.call-header {
    background: #2c2c2c;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #444;
}

.call-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.call-user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #25d366;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    font-weight: bold;
}

.call-user-details {
    color: white;
}

.call-user-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 5px;
}

.call-status {
    font-size: 14px;
    color: #ccc;
}

.call-close-btn {
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.video-container {
    flex: 1;
    position: relative;
    background: #000;
}

#localVideo {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 200px;
    height: 150px;
    border-radius: 10px;
    border: 2px solid #25d366;
    object-fit: cover;
    z-index: 2;
}

#remoteVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.call-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 3;
}

.call-control-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
}

.mute-btn {
    background: #444;
    color: white;
}

.mute-btn.muted {
    background: #ff4444;
}

.video-btn {
    background: #444;
    color: white;
}

.video-btn.disabled {
    background: #ff4444;
}

.end-call-btn {
    background: #ff4444;
    color: white;
}

.call-control-btn:hover {
    transform: scale(1.1);
}

/* Incoming Call Modal */
.incoming-call-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.incoming-call-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.incoming-call-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #25d366;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 40px;
    font-weight: bold;
    margin: 0 auto 20px;
}

.incoming-call-name {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.incoming-call-type {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
}

.incoming-call-controls {
    display: flex;
    gap: 30px;
    justify-content: center;
}

.answer-call-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #25d366;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    transition: all 0.3s ease;
}

.decline-call-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #ff4444;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    transition: all 0.3s ease;
}

.answer-call-btn:hover,
.decline-call-btn:hover {
    transform: scale(1.1);
}

/* Call buttons in chat header */
.call-controls {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

.call-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    background: #25d366;
    color: white;
}

.call-btn:hover {
    background: #128c7e;
    transform: scale(1.1);
}

.voice-call-btn {
    background: #25d366;
}

.video-call-btn {
    background: #667eea;
}

/* Sticker Send Styles */
.sticker-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    background: #ff6b6b;
    color: white;
    margin-right: 5px;
}

.sticker-btn:hover {
    background: #ff5252;
    transform: scale(1.1);
}

/* Sticker Modal */
.sticker-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sticker-modal-content {
    background: white;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.sticker-header {
    background: #ff6b6b;
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sticker-header h3 {
    margin: 0;
    font-size: 20px;
}

.sticker-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.sticker-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sticker-body {
    padding: 20px;
}

.video-preview-container {
    width: 100%;
    height: 300px;
    background: #f0f0f0;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

#stickerVideoPreview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
}

.video-placeholder {
    text-align: center;
    color: #666;
}

.placeholder-icon {
    font-size: 60px;
    margin-bottom: 10px;
}

.sticker-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.record-btn, .stop-btn, .send-sticker-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.record-btn {
    background: #ff4444;
    color: white;
}

.stop-btn {
    background: #666;
    color: white;
}

.send-sticker-btn {
    background: #25d366;
    color: white;
}

.record-btn:hover, .stop-btn:hover, .send-sticker-btn:hover {
    transform: scale(1.05);
}

.sticker-info {
    text-align: center;
    color: #666;
    font-size: 14px;
}

.sticker-info p {
    margin: 5px 0;
}

/* Sticker View Modal */
.sticker-view-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10003;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sticker-view-content {
    background: #000;
    border-radius: 20px;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    position: relative;
}

.sticker-view-header {
    background: #333;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sticker-sender-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sender-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #25d366;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.sender-name {
    font-size: 16px;
    font-weight: 600;
}

.sticker-view-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.sticker-view-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sticker-view-body {
    position: relative;
}

#stickerViewVideo {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

.sticker-timer {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
}

.timer-bar {
    height: 100%;
    background: #ff6b6b;
    width: 0%;
    transition: width 0.1s linear;
}

/* Streak Fire Emoji */
.streak-fire {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #ff6b6b;
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 14px;
    font-weight: bold;
    margin-left: 10px;
}

.streak-number {
    background: white;
    color: #ff6b6b;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* Mobile Sticker Styles */
@media (max-width: 768px) {
    .sticker-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .video-preview-container {
        height: 250px;
    }
    
    .sticker-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .record-btn, .stop-btn, .send-sticker-btn {
        width: 100%;
        justify-content: center;
    }
    
    .sticker-view-content {
        width: 95%;
        max-height: 90vh;
    }
    
    #stickerViewVideo {
        height: 300px;
    }
}
