/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1a1f3a 100%);
    height: 100vh;
    color: #e5e7eb;
}

/* Authentication Styles */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    padding: 20px;
}

.auth-card {
    background: #1a1f3a;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 400px;
    text-align: center;
    border: 1px solid #2d3748;
}

.auth-card h1 {
    color: #60a5fa;
    margin-bottom: 2rem;
    font-size: 2rem;
}

.form-container h2 {
    margin-bottom: 1.5rem;
    color: #e5e7eb;
}

.input-group {
    margin-bottom: 1rem;
}

.input-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #374151;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
    background: #111827;
    color: #e5e7eb;
}

.input-group input:focus {
    outline: none;
    border-color: #60a5fa;
}

.form-container button {
    width: 100%;
    padding: 12px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
    margin-bottom: 1rem;
}

.form-container button:hover {
    background: #2563eb;
}

.form-container p {
    margin-top: 1rem;
    color: #9ca3af;
}

.form-container a {
    color: #60a5fa;
    text-decoration: none;
}

.form-container a:hover {
    text-decoration: underline;
}

/* Message Styles */
.error-message, .success-message {
    padding: 10px;
    border-radius: 5px;
    margin: 1rem 0;
    display: none;
}

.error-message {
    background: #7f1d1d;
    color: #fecaca;
    border: 1px solid #991b1b;
}

.success-message {
    background: #1f2937;
    color: #86efac;
    border: 1px solid #15803d;
}

.error-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #991b1b;
    color: white;
    padding: 15px 20px;
    border-radius: 5px;
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.success-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #15803d;
    color: white;
    padding: 15px 20px;
    border-radius: 5px;
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

/* Chat Container Styles */
.chat-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #0f172a;
}

.chat-header {
    background: linear-gradient(135deg, #1a1f3a 0%, #2d3748 100%);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid #374151;
}

.chat-header h1 {
    font-size: 1.5rem;
    margin: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Main Chat Layout */
.chat-main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Sidebar Styles */
.sidebar {
    width: 300px;
    background: #111827;
    border-right: 1px solid #2d3748;
    display: flex;
    flex-direction: column;
    position: relative;
}

.sidebar-logo {
    padding: 1.5rem;
    border-bottom: 1px solid #2d3748;
    text-align: center;
    background: linear-gradient(135deg, #1a1f3a 0%, #111827 100%);
}

.sidebar-logo svg {
    width: 60px;
    height: 60px;
    filter: drop-shadow(0 0 8px rgba(96, 165, 250, 0.5));
}

.sidebar-decorative {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.sidebar-decorative svg {
    width: 24px;
    height: 24px;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.sidebar-decorative svg:hover {
    opacity: 1;
}

.sidebar-section {
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
}

.sidebar-section h3 {
    margin-bottom: 1rem;
    color: #60a5fa;
    font-size: 1.1rem;
}

.user-search {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.user-search input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #374151;
    border-radius: 20px;
    font-size: 14px;
    background: #1f2937;
    color: #e5e7eb;
}

.user-search input::placeholder {
    color: #6b7280;
}

.user-search button {
    padding: 8px 12px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.3s;
}

.user-search button:hover {
    background: #2563eb;
}

/* User List Styles */
.user-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
    background: #1f2937;
}

.user-item:hover {
    background: #374151;
}

.user-item.active {
    background: #3b82f6;
    color: white;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #3b82f6;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

.user-item.active .user-avatar {
    background: rgba(255, 255, 255, 0.2);
}

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

.user-name {
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #e5e7eb;
}

.user-email {
    font-size: 12px;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-item.active .user-email {
    color: rgba(255, 255, 255, 0.7);
}

/* Chat Content Styles */
.chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.messages-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #0f172a;
}

.welcome-message {
    text-align: center;
    color: #9ca3af;
    margin-top: 2rem;
}

/* Message Styles */
.message {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    max-width: 70%;
}

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

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

.message-content {
    background: #374151;
    padding: 8px 12px;
    border-radius: 18px;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
    color: #e5e7eb;
}

.message.sent .message-content {
    background: #3b82f6;
    color: white;
}

.message-time {
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
    padding: 0 8px;
}

/* Message Input Styles */
.message-input-container {
    border-top: 1px solid #374151;
    background: #111827;
    padding: 1rem;
}

.message-input {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.message-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #374151;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
    background: #1f2937;
    color: #e5e7eb;
}

.message-input input:focus {
    border-color: #3b82f6;
}

.message-input input::placeholder {
    color: #6b7280;
}

.message-input input:disabled {
    background: #111827;
    color: #6b7280;
}

.message-input button {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s;
}

.message-input button:hover:not(:disabled) {
    background: #2563eb;
}

.message-input button:disabled {
    background: #6b7280;
    cursor: not-allowed;
}

/* Connection Status */
.connection-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    z-index: 100;
    transition: all 0.3s;
}

.connection-status.online {
    background: #10b981;
    color: white;
}

.connection-status.offline {
    background: #ef4444;
    color: white;
}

.connection-status.connecting {
    background: #f59e0b;
    color: white;
}

.connection-status.error {
    background: #dc2626;
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -300px;
        height: calc(100vh - 70px);
        z-index: 1000;
        transition: left 0.3s;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .chat-header {
        padding: 1rem;
    }
    
    .auth-card {
        margin: 0 10px;
    }
    
    .message {
        max-width: 85%;
    }
}

/* Scrollbar Styling */
.messages-area::-webkit-scrollbar {
    width: 6px;
}

.messages-area::-webkit-scrollbar-track {
    background: #1f2937;
}

.messages-area::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 3px;
}

.messages-area::-webkit-scrollbar-thumb:hover {
    background: #4b5563;
}

.sidebar-section::-webkit-scrollbar {
    width: 6px;
}

.sidebar-section::-webkit-scrollbar-track {
    background: #111827;
}

.sidebar-section::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 3px;
}

.sidebar-section::-webkit-scrollbar-thumb:hover {
    background: #4b5563;
}