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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 100%);
    color: #e4e4e7;
    overflow: hidden;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0f0f1a, #1a1a2e);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loader {
    width: 50px;
    height: 50px;
    border: 3px solid #2ecc71;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Auth Styles */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 100%);
    padding: 20px;
}

.auth-card {
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 32px;
    padding: 40px;
    width: 450px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(46, 204, 113, 0.1);
    animation: slideUp 0.5s ease;
}

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

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 10px;
}

.logo i {
    color: #2ecc71;
    font-size: 36px;
}

.logo span {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-header p {
    color: #8b8b9b;
    font-size: 14px;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 60px;
    padding: 5px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    color: #8b8b9b;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    border-radius: 60px;
    transition: all 0.3s;
}

.tab-btn.active {
    background: #2ecc71;
    color: #0f0f1a;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-group i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #8b8b9b;
}

.input-group input {
    width: 100%;
    padding: 14px 16px 14px 45px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(46, 204, 113, 0.2);
    border-radius: 16px;
    color: #e4e4e7;
    font-size: 14px;
    transition: all 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: #2ecc71;
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.1);
}

.file-input {
    position: relative;
    padding: 10px 0;
}

.file-input input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-input label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    background: rgba(46, 204, 113, 0.1);
    border: 1px dashed #2ecc71;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    border: none;
    border-radius: 16px;
    color: #0f0f1a;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(46, 204, 113, 0.4);
}

/* Main Chat Layout */
.main-container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 320px;
    background: rgba(15, 15, 26, 0.95);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(46, 204, 113, 0.2);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(46, 204, 113, 0.2);
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px;
    border-radius: 16px;
    transition: all 0.3s;
}

.user-info:hover {
    background: rgba(46, 204, 113, 0.1);
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #2ecc71;
}

.user-details {
    flex: 1;
}

.user-details span {
    font-weight: 600;
    display: block;
}

.user-details small {
    font-size: 11px;
    color: #8b8b9b;
}

.profile-menu {
    position: absolute;
    top: 70px;
    left: 20px;
    background: #1e1e2e;
    border-radius: 16px;
    width: 220px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(46, 204, 113, 0.2);
    display: none;
    z-index: 100;
    animation: fadeIn 0.2s ease;
}

.profile-menu.show {
    display: block;
}

.profile-menu button {
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    color: #e4e4e7;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
}

.profile-menu button:hover {
    background: rgba(46, 204, 113, 0.1);
}

.profile-menu button.danger {
    color: #e74c3c;
}

.search-box {
    padding: 15px;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 28px;
    top: 24px;
    color: #8b8b9b;
}

.search-box input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(46, 204, 113, 0.2);
    border-radius: 30px;
    color: #e4e4e7;
}

.search-results {
    position: absolute;
    background: #1e1e2e;
    border-radius: 16px;
    margin: 0 15px;
    z-index: 99;
    display: none;
    max-height: 300px;
    overflow-y: auto;
    width: calc(100% - 30px);
}

.search-results.show {
    display: block;
}

.chats-list {
    padding: 15px;
    flex: 1;
    overflow-y: auto;
}

.chats-list h3 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #8b8b9b;
    margin-bottom: 15px;
}

.chat-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.chat-item:hover {
    background: rgba(46, 204, 113, 0.1);
}

.chat-item.active {
    background: rgba(46, 204, 113, 0.15);
    border-left: 3px solid #2ecc71;
}

.chat-item.blocked {
    opacity: 0.5;
}

.chat-info {
    flex: 1;
}

.chat-info strong {
    font-size: 14px;
    display: block;
}

.chat-info small {
    font-size: 11px;
    color: #8b8b9b;
}

.three-dots {
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
}

.three-dots:hover {
    background: rgba(255, 255, 255, 0.1);
}

.dropdown-menu {
    position: absolute;
    right: 10px;
    top: 45px;
    background: #1e1e2e;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    display: none;
    z-index: 100;
    min-width: 150px;
    border: 1px solid rgba(46, 204, 113, 0.2);
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu button {
    width: 100%;
    padding: 10px 15px;
    background: none;
    border: none;
    color: #e4e4e7;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.dropdown-menu button:hover {
    background: rgba(46, 204, 113, 0.1);
}

.dropdown-menu button.danger {
    color: #e74c3c;
}

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(10, 10, 18, 0.8);
}

.chat-header {
    padding: 20px;
    background: rgba(15, 15, 26, 0.9);
    border-bottom: 1px solid rgba(46, 204, 113, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-sm {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #2ecc71;
}

.chat-actions {
    display: flex;
    gap: 10px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(46, 204, 113, 0.1);
    border: none;
    color: #2ecc71;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: #2ecc71;
    color: #0f0f1a;
    transform: scale(1.05);
}

/* Messages Container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 18px;
    animation: messageIn 0.3s ease;
    position: relative;
}

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

.message.sent {
    align-self: flex-end;
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: #0f0f1a;
}

.message.received {
    align-self: flex-start;
    background: rgba(46, 204, 113, 0.1);
}

.message.deleted {
    opacity: 0.6;
    font-style: italic;
    background: rgba(100, 100, 100, 0.2);
}

.message img, .message video {
    max-width: 250px;
    border-radius: 12px;
    margin-top: 5px;
}

.message audio {
    margin-top: 5px;
    max-width: 200px;
}

.message-caption {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 5px;
}

.message-time {
    font-size: 10px;
    margin-top: 5px;
    opacity: 0.6;
}

.reply-preview {
    font-size: 11px;
    opacity: 0.7;
    margin-bottom: 6px;
    padding-left: 8px;
    border-left: 2px solid currentColor;
}

.message-actions {
    position: absolute;
    top: -25px;
    right: 0;
    display: none;
    gap: 5px;
    background: rgba(0, 0, 0, 0.8);
    padding: 4px 8px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

.message:hover .message-actions {
    display: flex;
}

.message-actions button {
    background: none;
    border: none;
    color: #2ecc71;
    cursor: pointer;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 12px;
    transition: all 0.2s;
}

.message-actions button:hover {
    background: rgba(46, 204, 113, 0.2);
}

/* Reply Indicator */
.reply-indicator {
    padding: 8px 15px;
    background: rgba(46, 204, 113, 0.1);
    border-radius: 8px;
    margin: 0 20px 10px 20px;
    font-size: 12px;
    display: none;
    border-left: 3px solid #2ecc71;
}

/* Message Input Area */
.message-input-area {
    padding: 20px;
    background: rgba(15, 15, 26, 0.9);
    border-top: 1px solid rgba(46, 204, 113, 0.2);
    display: flex;
    gap: 10px;
    align-items: center;
}

.media-buttons {
    display: flex;
    gap: 8px;
}

.media-btn, .send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(46, 204, 113, 0.1);
    border: none;
    color: #2ecc71;
    cursor: pointer;
    transition: all 0.2s;
}

.media-btn:hover, .send-btn:hover {
    background: #2ecc71;
    color: #0f0f1a;
    transform: scale(1.05);
}

#messageInput {
    flex: 1;
    padding: 12px 18px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(46, 204, 113, 0.2);
    border-radius: 30px;
    color: #e4e4e7;
    font-size: 14px;
}

#messageInput:focus {
    outline: none;
    border-color: #2ecc71;
}

.typing-indicator {
    padding: 5px 20px;
    font-size: 12px;
    color: #8b8b9b;
    font-style: italic;
}

/* Camera Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #1a1a2e;
    margin: 5% auto;
    padding: 20px;
    width: 90%;
    max-width: 600px;
    border-radius: 24px;
    border: 1px solid rgba(46, 204, 113, 0.3);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(46, 204, 113, 0.2);
}

.modal-header h2 {
    font-size: 20px;
    color: #2ecc71;
}

.close {
    font-size: 28px;
    cursor: pointer;
    color: #888;
    transition: all 0.2s;
}

.close:hover {
    color: #e74c3c;
}

.camera-modal {
    max-width: 600px;
}

.camera-container {
    position: relative;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
}

#cameraVideo {
    width: 100%;
    border-radius: 16px;
}

.camera-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px;
}

.cam-btn {
    padding: 12px 24px;
    background: rgba(46, 204, 113, 0.2);
    border: 1px solid #2ecc71;
    border-radius: 30px;
    color: #2ecc71;
    cursor: pointer;
    transition: all 0.2s;
}

.cam-btn:hover {
    background: #2ecc71;
    color: #0f0f1a;
}

.cam-btn.capture {
    background: #2ecc71;
    color: #0f0f1a;
}

.recording-timer {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 5px 10px;
    border-radius: 20px;
    color: #e74c3c;
    font-family: monospace;
    font-size: 16px;
}

.caption-input {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(46, 204, 113, 0.2);
}

.caption-input input {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(46, 204, 113, 0.2);
    border-radius: 12px;
    color: #e4e4e7;
    margin-bottom: 10px;
}

/* Account Modal */
.account-modal {
    max-width: 450px;
}

.account-data-item {
    padding: 12px;
    margin: 10px 0;
    background: rgba(46, 204, 113, 0.05);
    border-radius: 12px;
}

.password-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.toggle-password {
    background: rgba(46, 204, 113, 0.1);
    border: none;
    color: #2ecc71;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 20px;
    transition: all 0.2s;
}

.toggle-password:hover {
    background: rgba(46, 204, 113, 0.2);
}

/* Badges */
.verified-badge {
    color: #2ecc71;
    margin-left: 5px;
    font-size: 12px;
}

.online-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #2ecc71;
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

::-webkit-scrollbar-track {
    background: #1a1a2e;
}

::-webkit-scrollbar-thumb {
    background: #2ecc71;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #27ae60;
}

/* Recording Animation */
.recording {
    animation: recordingPulse 1s infinite;
    background: #e74c3c !important;
    color: white !important;
}

@keyframes recordingPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Fade In Animation */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 280px;
        position: fixed;
        left: -280px;
        transition: left 0.3s ease;
        z-index: 1000;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .message {
        max-width: 85%;
    }
    
    .auth-card {
        width: 90%;
        padding: 30px 20px;
    }
    
    .camera-controls {
        flex-wrap: wrap;
    }
    
    .cam-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
}

/* Mobile Menu Toggle Button (optional) */
.menu-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    background: #2ecc71;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }
}

/* Blocked User Style */
.chat-item.blocked .chat-info strong {
    text-decoration: line-through;
}

.blocked-badge {
    background: #e74c3c;
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    margin-left: 8px;
}

/* Admin Message Style */
.message.sent .verified-badge,
.message.received .verified-badge {
    font-size: 10px;
}

/* Loading More Messages */
.loading-messages {
    text-align: center;
    padding: 10px;
    color: #8b8b9b;
    font-size: 12px;
}

/* Emoji Picker (Optional) */
.emoji-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
}

/* Image Preview */
.image-preview {
    max-width: 200px;
    max-height: 200px;
    border-radius: 12px;
    margin-top: 5px;
}

/* Video Preview */
.video-preview {
    max-width: 200px;
    border-radius: 12px;
    margin-top: 5px;
}