* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: #f3f4f6;
    color: #1f2937;
    height: 100vh;
}

/* =========================================
   Login Page Styles
========================================= */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.login-card h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.subtitle {
    color: #6b7280;
    font-size: 0.875rem;
    text-align: center;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: #667eea;
}

.btn-primary {
    width: 100%;
    padding: 0.75rem;
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #5a6fd6;
}

.btn-primary:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}

.error-message {
    background-color: #fee2e2;
    color: #b91c1c;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.login-hint {
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: #9ca3af;
    text-align: center;
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
}

/* =========================================
   Chat Page Styles
========================================= */
.chat-page {
    overflow: hidden;
}

.app-layout {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 300px;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: #6b7280;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
}

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

.room-item {
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background-color 0.2s;
}

.room-item:hover {
    background-color: #f9fafb;
}

.room-item.active {
    background-color: #eff6ff;
    border-left: 4px solid #3b82f6;
}

.room-type {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.room-role {
    font-size: 0.75rem;
    color: #6b7280;
}

.room-id {
    font-size: 0.7rem;
    color: #9ca3af;
    margin-top: 0.5rem;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f9fafb;
}

.chat-header {
    padding: 1rem 1.5rem;
    background: white;
    border-bottom: 1px solid #e5e7eb;
}

.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.empty-state {
    text-align: center;
    color: #9ca3af;
    margin-top: 2rem;
    font-size: 0.875rem;
}

.msg-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 70%;
}

.msg-wrapper.mine {
    align-self: flex-end;
    align-items: flex-end;
}

.msg-wrapper.theirs {
    align-self: flex-start;
    align-items: flex-start;
}

.msg-bubble {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.4;
    word-break: break-word;
}

.msg-wrapper.mine .msg-bubble {
    border-bottom-right-radius: 2px;
}

.msg-wrapper.theirs .msg-bubble {
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 2px;
}

.bg-buyer {
    background-color: #e0f0ff !important;
    color: #333333 !important;
}

.bg-seller {
    background-color: #ffe0e6 !important;
    color: #333333 !important;
}

.msg-meta {
    font-size: 0.7rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.chat-input-area {
    padding: 1.5rem;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 1rem;
}

.chat-input-area input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    outline: none;
    font-size: 0.95rem;
}

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

.chat-input-area button {
    padding: 0.75rem 1rem;
    background-color: #3b82f6;
    color: white;
    border: none;
    border-radius: 24px;
    font-weight: bold;
    cursor: pointer;
}

.chat-input-area button:disabled {
    background-color: #9ca3af;
}

/* =========================================
   Auth Tabs & Modal Styles
========================================= */
.auth-tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e5e7eb;
}

.auth-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 10px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.auth-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

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

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

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

/* Responsive for Mobile */
@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 30vh;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .chat-main {
        height: 70vh;
    }
}
