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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    overflow: hidden;
}

/* ============ AUTH STYLES ============ */
.auth-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-box {
    background: white;
    border-radius: 24px;
    padding: 40px;
    width: 450px;
    max-width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.5s ease-out;
}

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

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

.auth-header .logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 40px;
    color: white;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.auth-header h2 {
    font-size: 28px;
    color: #1f2937;
    margin-bottom: 8px;
}

.auth-header p {
    color: #6b7280;
    font-size: 14px;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: #f3f4f6;
    padding: 5px;
    border-radius: 12px;
}

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

.tab-btn.active {
    background: white;
    color: #667eea;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.auth-form {
    display: none;
    animation: fadeIn 0.3s;
}

.auth-form.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 18px;
}

.input-group input {
    width: 100%;
    padding: 14px 15px 14px 45px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 14px;
    transition: all 0.3s;
    font-family: inherit;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.forgot-link {
    text-align: right;
    margin-bottom: 20px;
}

.forgot-link a {
    color: #667eea;
    text-decoration: none;
    font-size: 13px;
}

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

.back-link {
    text-align: center;
    margin-top: 15px;
}

.back-link button {
    background: #f3f4f6;
    color: #6b7280;
    box-shadow: none;
}

.auth-form button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.auth-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

/* ============ CHAT APP STYLES ============ */
.chat-app {
    display: flex;
    width: 100vw;
    height: 100vh;
    background: white;
    position: fixed;
    top: 0;
    left: 0;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.user-info {
    padding: 25px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.avatar {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.user-details {
    flex: 1;
}

.user-details .username {
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 4px;
}

.user-details .status {
    font-size: 12px;
    color: #10b981;
    display: flex;
    align-items: center;
    gap: 5px;
}

.user-details .status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
    animation: blink 1.5s infinite;
}

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

.logout-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 20px;
}

.logout-btn:hover {
    background: #ef4444;
    transform: rotate(90deg);
}

.chat-types {
    padding: 20px;
    display: flex;
    gap: 10px;
}

.chat-type-btn {
    flex: 1;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.chat-type-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.chat-type-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

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

.search-box i {
    position: absolute;
    left: 32px;
    top: 13px;
    color: #9ca3af;
    font-size: 14px;
}

.search-box input {
    width: 100%;
    padding: 10px 10px 10px 35px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: white;
    font-size: 14px;
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

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

.user-item {
    padding: 12px 15px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.user-item.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.3) 0%, rgba(118, 75, 162, 0.3) 100%);
    border: 1px solid rgba(102, 126, 234, 0.5);
}

.user-avatar-small {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
}

.user-info-text {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.user-status-text {
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.user-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
}

.user-status-dot.offline {
    background: #6b7280;
}

/* Main Chat Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f9fafb;
    position: relative;
}

.chat-header {
    padding: 20px 30px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}

.chat-header h2 {
    font-size: 20px;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #667eea;
}

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

.header-btn {
    width: 35px;
    height: 35px;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 16px;
}

.header-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message {
    animation: slideIn 0.3s ease-out;
}

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

.message-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
    padding-left: 10px;
}

.message-username {
    font-weight: 700;
    color: #667eea;
    font-size: 14px;
}

.message-time {
    font-size: 11px;
    color: #9ca3af;
}

.message-text {
    background: white;
    padding: 12px 18px;
    border-radius: 18px;
    display: inline-block;
    max-width: 70%;
    word-wrap: break-word;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    color: #1f2937;
}

.message.own {
    text-align: right;
}

.message.own .message-header {
    justify-content: flex-end;
    padding-right: 10px;
}

.message.own .message-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: #6b7280;
}

/* Message Input */
.message-input {
    padding: 20px 30px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 15px;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

.message-input input {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
    font-family: inherit;
    padding-right: 50px;
}

.message-input input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-actions {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.input-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    transition: all 0.3s;
    color: #9ca3af;
}

.input-action-btn:hover {
    color: #667eea;
    transform: scale(1.1);
}

.message-input button {
    padding: 14px 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.message-input button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

::-webkit-scrollbar-track {
    background: #f3f4f6;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4f46e5;
}

/* Emoji Picker */
.emoji-picker {
    position: fixed;
    bottom: 100px;
    right: 30px;
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    display: none;
    max-width: 350px;
    z-index: 1000;
    border: 1px solid #e5e7eb;
}

.emoji-list {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    font-size: 24px;
    cursor: pointer;
}

.emoji-list span {
    cursor: pointer;
    transition: transform 0.2s;
    text-align: center;
}

.emoji-list span:hover {
    transform: scale(1.2);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #1f2937;
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.3s;
    z-index: 1000;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.toast.success {
    background: #10b981;
}

.toast.error {
    background: #ef4444;
}

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

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -320px;
        transition: left 0.3s ease;
        height: 100vh;
        z-index: 100;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .chat-header {
        padding: 15px 20px;
    }
    
    .messages {
        padding: 20px;
    }
    
    .message-input {
        padding: 15px 20px;
    }
    
    .message-text {
        max-width: 85%;
    }
    
    .auth-box {
        padding: 30px 20px;
        margin: 20px;
    }
}