/* ============================================
   Private Chat System - Styles
   ============================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f0f2f5;
    color: #1c1e21;
    line-height: 1.5;
    min-height: 100vh;
}

/* ============================================
   Login Form
   ============================================ */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #1877f2;
    font-size: 28px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #606770;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #dddfe2;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #1877f2;
    box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.2);
}

.btn {
    width: 100%;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: #1877f2;
    color: #fff;
}

.btn-primary:hover {
    background: #166fe5;
}

.btn-secondary {
    background: #e4e6eb;
    color: #050505;
    margin-top: 10px;
}

.btn-secondary:hover {
    background: #d8dadf;
}

.error-message {
    background: #ffebe9;
    border: 1px solid #ff8785;
    color: #cf222e;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.toggle-form {
    text-align: center;
    margin-top: 20px;
    color: #606770;
}

.toggle-form a {
    color: #1877f2;
    text-decoration: none;
    font-weight: 500;
}

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

/* ============================================
   Chat Layout
   ============================================ */
.chat-container {
    display: flex;
    height: 100vh;
}

/* Sidebar - User List */
.sidebar {
    width: 320px;
    background: #fff;
    border-right: 1px solid #e4e6eb;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e4e6eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 20px;
    color: #050505;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info span {
    font-size: 14px;
    color: #606770;
}

.btn-logout {
    padding: 8px 16px;
    font-size: 14px;
    width: auto;
}

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

.user-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f2f5;
}

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

.user-item.active {
    background: #e7f3ff;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #1877f2;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
    margin-right: 12px;
    position: relative;
}

.online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #31a24c;
    border: 2px solid #fff;
}

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

.user-name {
    font-weight: 600;
    color: #050505;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-status {
    font-size: 13px;
    color: #65676b;
}

.unread-badge {
    background: #1877f2;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

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

.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e4e6eb;
    display: flex;
    align-items: center;
}

.chat-header .user-avatar {
    width: 40px;
    height: 40px;
    font-size: 16px;
}

.chat-header-info h3 {
    font-size: 16px;
    color: #050505;
}

.chat-header-info .status {
    font-size: 13px;
    color: #65676b;
}

.chat-header-info .status.online {
    color: #31a24c;
}

.typing-indicator {
    font-size: 13px;
    color: #1877f2;
    font-style: italic;
}

/* Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.no-chat-selected {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #65676b;
    font-size: 16px;
}

.message {
    max-width: 65%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message.sent {
    align-self: flex-end;
    background: #1877f2;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message.received {
    align-self: flex-start;
    background: #e4e6eb;
    color: #050505;
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}

.message.sent .message-time {
    text-align: right;
}

/* Input Area */
.chat-input {
    padding: 16px 20px;
    border-top: 1px solid #e4e6eb;
    display: flex;
    gap: 12px;
    align-items: center;
}

.chat-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e4e6eb;
    border-radius: 20px;
    font-size: 15px;
    background: #f0f2f5;
    transition: background-color 0.2s, border-color 0.2s;
}

.chat-input input:focus {
    outline: none;
    background: #fff;
    border-color: #1877f2;
}

.chat-input button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #1877f2;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.1s;
}

.chat-input button:hover {
    background: #166fe5;
}

.chat-input button:active {
    transform: scale(0.95);
}

.chat-input button:disabled {
    background: #e4e6eb;
    cursor: not-allowed;
}

/* Notification Banner */
.notification-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #fef3cd;
    border-bottom: 1px solid #ffc107;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
}

.notification-banner.hidden {
    display: none;
}

.notification-banner button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.notification-banner .btn-enable {
    background: #1877f2;
    color: #fff;
}

.notification-banner .btn-dismiss {
    background: transparent;
    color: #856404;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #323232;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
}

.toast.success {
    background: #31a24c;
}

.toast.error {
    background: #cf222e;
}

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

/* Responsive */
@media (max-width: 768px) {
    .chat-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        max-height: 40vh;
    }

    .chat-main {
        flex: 1;
    }

    .message {
        max-width: 85%;
    }
}
