:root {
    --primary-color: #1a1a2e;
    --secondary-color: #16213e;
    --accent-color: #0f3460;
    --text-color: #e8e8e8;
    --success-color: #00b894;
    --danger-color: #e94560;
    --warning-color: #fdcb6e;
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-color);
    min-height: 100vh;
    line-height: 1.6;
}

/* Auth Forms */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: rgba(22, 33, 62, 0.9);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.auth-header p {
    color: #a0a0a0;
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #b0b0b0;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 16px;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn {
    width: 100%;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 10px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.auth-links {
    text-align: center;
    margin-top: 20px;
}

.auth-links a {
    color: #667eea;
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.auth-links a:hover {
    color: #764ba2;
}

/* Chat Interface */
.chat-container {
    display: flex;
    height: 100vh;
    background: var(--primary-color);
}

.sidebar {
    width: 300px;
    background: var(--secondary-color);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    background: var(--accent-color);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-details h3 {
    font-size: 1rem;
    margin-bottom: 2px;
}

.user-status {
    font-size: 0.8rem;
    color: var(--success-color);
}

/* User Search Styles */
.user-search {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-search input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 14px;
    outline: none;
}

.user-search input:focus {
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.08);
}

.search-results {
    margin-top: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.search-result-item {
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-result-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.search-result-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.search-result-info {
    flex: 1;
}

.search-result-name {
    font-weight: 500;
    font-size: 14px;
}

.search-result-username {
    font-size: 12px;
    color: #999;
}

.search-result-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
}

.search-result-status.offline {
    background: #666;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.conversation-item {
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 5px;
}

.conversation-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.conversation-item.active {
    background: rgba(102, 126, 234, 0.2);
    border-left: 3px solid #667eea;
}

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.conversation-name {
    font-weight: 500;
}

.conversation-time {
    font-size: 0.75rem;
    color: #666;
}

.conversation-preview {
    font-size: 0.85rem;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 20px;
    background: var(--accent-color);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Message Layout - Your Desired Format */
.message {
    max-width: 70%;
    margin-bottom: 15px;
    animation: messageSlide 0.3s ease-out;
}

.message.sent {
    align-self: flex-end;
}

.message.received {
    align-self: flex-start;
}

.message-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.message.sent .message-header {
    justify-content: flex-end;
}

.message.received .message-header {
    justify-content: flex-start;
}

.message-display-name {
    font-weight: 600;
    color: #fff;
}

.message.received .message-display-name {
    color: #667eea;
}

.message-username {
    color: #999;
    font-size: 0.8rem;
}

.message-body {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.message.sent .message-body {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-fallback {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.message-content {
    flex: 1;
    word-wrap: break-word;
    padding: 8px 12px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
}

.message.sent .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.message-info {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 4px;
}

.message.sent .message-info {
    text-align: right;
}

.message.received .message-info {
    text-align: left;
}

/* Mention styling */
/* Mention styling - FIXED */
/* Mention styling - FIXED */
.mention {
    color: #00bcd4 !important;
    cursor: pointer;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.mention:hover {
    text-decoration: underline;
    background-color: rgba(0, 188, 212, 0.1);
}

/* Security Features - FIXED SIZE AND POSITION */
/* Security Features - FIXED */
.secure-indicator {
    position: fixed !important;
    bottom: 20px !important;
    left: 20px !important;
    top: auto !important;
    right: auto !important;
    background: rgba(0, 184, 148, 0.25) !important;
    border: 1px solid #00b894 !important;
    border-radius: 20px !important;
    padding: 8px 16px !important;
    font-size: 0.75rem !important;
    color: #00b894 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    z-index: 1000 !important;
    max-width: 200px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    box-shadow: 0 2px 8px rgba(0, 184, 148, 0.2) !important;
}

.secure-indicator::before {
    content: '🔒' !important;
    font-size: 0.9rem !important;
    line-height: 1 !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .message {
        max-width: 85%;
    }
    
    .message-header {
        font-size: 0.8rem;
    }
    
    .message-avatar {
        width: 28px;
        height: 28px;
    }
    
    .avatar-fallback {
        font-size: 12px;
    }
}

.chat-input-container {
    padding: 20px;
    background: var(--secondary-color);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    color: var(--text-color);
    font-size: 16px;
    resize: none;
    border: none;
    outline: none;
    transition: var(--transition);
}

.chat-input:focus {
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.08);
}

.send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 18px;
}

.send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.send-btn:active {
    transform: scale(0.95);
}

/* Animations */
@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Security Features */
/* Security Features - FIXED POSITION */
.secure-indicator {
    position: fixed;
    bottom: 20px;
    left: 20px;
    top: auto;
    right: auto;
    background: rgba(0, 184, 148, 0.2);
    border: 1px solid var(--success-color);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.85rem;
    color: var(--success-color);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1000;
}

.secure-indicator::before {
    content: '🔒';
    font-size: 1rem;
}

/* Alternative positions if you prefer */
.secure-indicator.top-right {
    top: 20px;
    right: 20px;
    left: auto;
}

.secure-indicator.bottom-left {
    top: auto;
    bottom: 20px;
    left: 20px;
    right: auto;
}

.secure-indicator.bottom-right {
    top: auto;
    bottom: 20px;
    left: auto;
    right: 20px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
    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.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Logout Button */
.btn-logout {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}

.btn-logout:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: fixed;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .chat-main {
        width: 100%;
    }
    
    .message {
        max-width: 85%;
    }
    
    .auth-card {
        margin: 20px;
        padding: 30px;
    }
    
    .secure-indicator {
        top: 10px;
        right: 10px;
        font-size: 0.75rem;
        padding: 6px 12px;
    }
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    animation: toastSlide 0.3s ease-out;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

.toast.warning {
    background: var(--warning-color);
}

@keyframes toastSlide {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
/* Send Button States */
.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.send-btn:disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* Message Input Focus States */
.chat-input:focus {
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Active Conversation Input */
.chat-input-wrapper:has(.chat-input:focus) {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 30px;
}

/* Typing Animation */
.chat-input:placeholder-shown ~ .send-btn {
    opacity: 0.7;
}

.chat-input:not(:placeholder-shown) ~ .send-btn {
    opacity: 1;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}
/* Typing Indicator */
.typing-indicator {
    display: none;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    margin-bottom: 10px;
    max-width: 70%;
}

.typing-indicator.show {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
    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.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* New Message Animation */
.message.new-message {
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Online Status Indicator */
.user-status.typing {
    color: #667eea;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Conversation Update Animation */
.conversation-item.new-message {
    animation: conversationUpdate 0.5s ease-out;
}

@keyframes conversationUpdate {
    0% {
        background: rgba(102, 126, 234, 0.3);
    }
    100% {
        background: transparent;
    }
}
/* Typing Indicator */
.typing-indicator {
    display: none;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    margin-bottom: 10px;
    max-width: 70%;
    align-self: flex-start;
}

.typing-indicator.show {
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
    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.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Message Animations */
@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    animation: messageSlide 0.3s ease-out;
}

/* Active conversation styling */
.conversation-item.active {
    background: rgba(102, 126, 234, 0.2);
    border-left: 3px solid #667eea;
}

/* Send Button States */
.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.send-btn:disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* Message Input Focus States */
.chat-input:focus {
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
/* Global Alert Banners */
.global-alert-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    padding: 15px;
    text-align: center;
    border-bottom: 3px solid;
}

.global-alert-banner.alert-info {
    background: rgba(52, 152, 219, 0.9);
    border-color: #3498db;
    color: white;
}

.global-alert-banner.alert-warning {
    background: rgba(243, 156, 18, 0.9);
    border-color: #f39c12;
    color: white;
}

.global-alert-banner.alert-error {
    background: rgba(231, 76, 60, 0.9);
    border-color: #e74c3c;
    color: white;
}

.alert-content {
    position: relative;
    display: inline-block;
    max-width: 800px;
}

.alert-close {
    position: absolute;
    top: -5px;
    right: -25px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
}

.alert-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Adjust secure indicator for alerts */
.secure-indicator {
    top: 60px; /* Move down to make room for alerts */
}
/* New Message Animation */
.message.new-message {
    animation: messageSlideIn 0.3s ease-out;
    background: linear-gradient(135deg, 
        rgba(102, 126, 234, 0.1) 0%, 
        rgba(118, 75, 162, 0.1) 100%
    ) !important;
    border-left: 3px solid #667eea;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Conversation Update Animation */
.conversation-item.new-message {
    animation: conversationUpdate 0.5s ease-out;
}

@keyframes conversationUpdate {
    0% {
        background: rgba(102, 126, 234, 0.3);
    }
    100% {
        background: transparent;
    }
}
/* Message layout with profile photos */
.message-content-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    max-width: 70%;
}

.message.sent .message-content-wrapper {
    flex-direction: row-reverse;
    margin-left: auto;
}

.message-avatar {
    flex-shrink: 0;
}

.message-content {
    flex: 1;
}

.message-sender {
    font-size: 0.85rem;
    font-weight: 600;
    color: #999;
    margin-bottom: 4px;
}

.message-text {
    word-wrap: break-word;
}

.message.received .message-text {
    color: var(--text-color);
}

.message.sent .message-text {
    color: white;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .message-content-wrapper {
        max-width: 85%;
    }
}