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

body {
    font-family: 'Roboto', sans-serif;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    background: linear-gradient(
        rgba(0,0,0,0.2),
        rgba(0,0,0,0.2)
    ), url('https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=1920&q=80') center/cover no-repeat fixed;
}

/* Header Styles */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    padding: 8px 16px;
    height: 56px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-btn, .grid-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.menu-btn:hover, .grid-btn:hover {
    background: rgba(255,255,255,0.1);
}

.header h1 {
    color: white;
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 56px;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 8px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    border-radius: 50%;
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active {
    color: white;
    background: rgba(255,255,255,0.15);
}

/* Conversations Panel */
.conversations-panel {
    width: 320px;
    background: white;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(0, 0, 0, 0.1);
}

.new-conversation-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.2s;
}

.new-conversation-btn:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.plus-icon {
    width: 24px;
    height: 24px;
    background: #4caf50;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 400;
}

.contacts-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.contact-item:hover {
    background: #f5f5f5;
}

.contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

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

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

.contact-status {
    font-size: 12px;
    color: #757575;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Welcome Area */
.welcome-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.welcome-content {
    text-align: center;
    color: white;
}

.welcome-title {
    font-size: 42px;
    font-weight: 300;
    margin-bottom: 12px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.welcome-subtitle {
    font-size: 16px;
    font-weight: 400;
    opacity: 0.9;
    margin-bottom: 48px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 32px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    transition: transform 0.2s;
}

.action-btn:hover {
    transform: translateY(-4px);
}

.action-btn:hover .action-icon {
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.action-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255,255,255,0.8);
    background: transparent;
    transition: all 0.2s;
}

.action-label {
    color: white;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Photo Credit */
.photo-credit {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 12px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.credit-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

/* Scrollbar Styling */
.contacts-list::-webkit-scrollbar {
    width: 6px;
}

.contacts-list::-webkit-scrollbar-track {
    background: transparent;
}

.contacts-list::-webkit-scrollbar-thumb {
    background: #bdbdbd;
    border-radius: 3px;
}

.contacts-list::-webkit-scrollbar-thumb:hover {
    background: #9e9e9e;
}

/* Chat Windows - Old Google Hangouts Style */
.chat-windows-container {
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 1000;
    pointer-events: none;
}

.chat-window {
    position: fixed;
    bottom: 0;
    width: 280px;
    height: 350px;
    background: #f5f5f5;
    border: 1px solid #ccc;
    border-bottom: none;
    box-shadow: -2px -2px 10px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: auto;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #e0e0e0;
    padding: 6px 10px;
    border-bottom: 1px solid #ccc;
    cursor: move;
    user-select: none;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-avatar {
    width: 24px;
    height: 24px;
    border-radius: 2px;
}

.chat-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
}

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

.chat-action-btn, .chat-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-action-btn:hover {
    color: #333;
}

.chat-close-btn:hover {
    color: #d32f2f;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: white;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

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

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

.message-content {
    padding: 8px 10px;
    border-radius: 2px;
    font-size: 13px;
    line-height: 1.3;
    word-wrap: break-word;
}

.message-sent .message-content {
    background: #e3f2fd;
    color: #333;
}

.message-received .message-content {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #e0e0e0;
}

.chat-system-message {
    text-align: center;
    font-size: 11px;
    color: #999;
    padding: 8px;
    font-style: italic;
}

.message-time {
    font-size: 10px;
    color: #999;
    margin-top: 2px;
}

.chat-input-area {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    background: #f5f5f5;
    border-top: 1px solid #ccc;
    gap: 6px;
}

.chat-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 2px;
    font-size: 13px;
    outline: none;
    background: white;
}

.chat-input:focus {
    border-color: #4a90d9;
}

.chat-send-btn {
    background: none;
    border: none;
    color: #666;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-send-btn:hover {
    color: #4a90d9;
}

/* Chat Window Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
}

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

.auth-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 400px;
}

.auth-box h1 {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 400;
    color: #333;
}

.auth-subtitle {
    margin: 0 0 24px 0;
    color: #757575;
    font-size: 14px;
}

.auth-error {
    background: #ffebee;
    color: #c62828;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
}

.auth-success {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #4285f4;
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: #757575;
    font-size: 12px;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #3367d6;
}

.auth-link {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: #757575;
}

.auth-link a {
    color: #4285f4;
    text-decoration: none;
}

.auth-link a:hover {
    text-decoration: underline;
}

/* User info in header */
.user-name {
    color: white;
    font-size: 14px;
    margin-right: 12px;
}

.logout-btn {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
}

/* Current user info in sidebar */
.current-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
}

.current-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.current-user-details {
    display: flex;
    flex-direction: column;
}

.current-user-name {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.current-user-jid {
    font-size: 12px;
    color: #757575;
}

/* XMPP Status */
.xmpp-status {
    margin-top: 32px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: rgba(255,255,255,0.8);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.connecting {
    background: #ffc107;
    animation: pulse 1.5s infinite;
}

.status-dot.connected {
    background: #4caf50;
}

.status-dot.error {
    background: #f44336;
}

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

/* Responsive */
@media (max-width: 768px) {
    .conversations-panel {
        width: 280px;
    }
    
    .welcome-title {
        font-size: 32px;
    }
    
    .action-buttons {
        gap: 24px;
    }
    
    .action-icon {
        width: 56px;
        height: 56px;
    }
    
    .chat-window {
        width: 260px;
        height: 320px;
    }
    
    .auth-box {
        padding: 24px;
    }
}
