/* Color Palette from Coolors */
:root {
    --primary: #2b2d42;
    --secondary: #8d99ae;
    --light: #edf2f4;
    --accent: #ef233c;
    --dark-accent: #d90429;
    --success: #06d6a0;
    --warning: #ffd166;
    --info: #118ab2;
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--light);
    color: var(--primary);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-container {
    width: 100%;
    max-width: 1200px;
    height: 90vh;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
}

/* Authentication Screen */
.auth-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--primary);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.auth-card {
    background-color: white;
    padding: 2rem;
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.5s ease;
}

.logo {
    margin-bottom: 2rem;
    color: var(--primary);
}

.logo i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.auth-form input {
    width: 100%;
    padding: 12px;
    margin-bottom: 1rem;
    border: 1px solid var(--secondary);
    border-radius: 5px;
    font-size: 1rem;
}

.auth-form button {
    width: 100%;
    padding: 12px;
    background-color: var(--accent);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.auth-form button:hover {
    background-color: var(--dark-accent);
}

.error-message {
    color: var(--accent);
    margin-top: 0.5rem;
    font-size: 0.9rem;
    min-height: 1rem;
}

/* Chat Container */
.chat-container {
    display: flex;
    height: 100%;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background-color: var(--primary);
    color: white;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--secondary);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    margin-bottom: 1rem;
}

#createRoomBtn {
    width: 100%;
    padding: 8px;
    background-color: var(--success);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

#createRoomBtn:hover {
    background-color: #05b888;
}

.room-search {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.room-search input {
    width: 100%;
    padding: 8px;
    border-radius: 5px;
    border: none;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

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

.room-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.room-item {
    padding: 12px;
    margin-bottom: 5px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

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

.room-item.active {
    background-color: var(--accent);
}

.room-name {
    font-weight: 500;
}

.room-users {
    font-size: 0.8rem;
    opacity: 0.7;
}

.user-info {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Main Chat Area */
.main-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.messages-container {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    background-color: #f9f9f9;
}

.message {
    margin-bottom: 1rem;
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 15px;
    position: relative;
    word-wrap: break-word;
}

.message.sent {
    background-color: var(--accent);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 5px;
}

.message.received {
    background-color: var(--secondary);
    color: white;
    margin-right: auto;
    border-bottom-left-radius: 5px;
}

.message-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.8rem;
}

.message.sent .message-info {
    color: rgba(255, 255, 255, 0.8);
}

.message.received .message-info {
    color: rgba(255, 255, 255, 0.8);
}

.message-content {
    line-height: 1.4;
}

.message-content a {
    color: inherit;
    text-decoration: underline;
}

.message-content strong {
    font-weight: bold;
}

.message-content em {
    font-style: italic;
}

.message-input-container {
    display: flex;
    padding: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    background-color: white;
}

.formatting-tools {
    display: flex;
    align-items: center;
    margin-right: 10px;
}

.format-btn {
    background: none;
    border: none;
    color: var(--secondary);
    cursor: pointer;
    padding: 5px;
    font-size: 1rem;
}

.format-btn:hover {
    color: var(--primary);
}

#messageInput {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--secondary);
    border-radius: 5px;
    font-size: 1rem;
}

#sendButton {
    margin-left: 10px;
    padding: 0 15px;
    background-color: var(--accent);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#sendButton:hover {
    background-color: var(--dark-accent);
}

#sendButton:disabled {
    background-color: var(--secondary);
    cursor: not-allowed;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 200;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    position: relative;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-content h3 {
    margin-bottom: 1.5rem;
}

.modal-content input {
    width: 100%;
    padding: 10px;
    margin-bottom: 1rem;
    border: 1px solid var(--secondary);
    border-radius: 5px;
}

.modal-content button {
    width: 100%;
    padding: 10px;
    background-color: var(--success);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        height: 100vh;
        border-radius: 0;
    }
    
    .sidebar {
        width: 100%;
        position: absolute;
        z-index: 10;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .chat-header {
        display: flex;
        justify-content: space-between;
    }
    
    .mobile-menu-btn {
        display: block;
        background: none;
        border: none;
        color: var(--primary);
        font-size: 1.2rem;
    }
}

/* Notification */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--success);
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 300;
}