/* Friend System Styles */

/* Main App Layout */
#mainApp {
    display: flex;
    height: 100vh;
    width: 100%;
}

.sidebar {
    width: 350px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 16px;
    overflow-y: auto;
}

/* Input text color fix */
input,
textarea,
select {
    color: var(--text-primary) !important;
}

/* Room Info Section */
.room-info {
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    text-align: center;
}

.room-info h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.room-info p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Join Form */
.join-form {
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.join-form input,
.join-form select {
    width: 100%;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
}

/* Friends Section */
.friends-section {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-top: 16px;
}

.my-code-section {
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.my-code-section label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.code-display {
    display: flex;
    gap: 8px;
    align-items: center;
}

.code-display span {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--accent-primary);
    background: var(--bg-primary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.add-friend-section {
    margin-bottom: 16px;
}

.add-friend-section h4 {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.add-friend-section input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    margin-bottom: 8px;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
}

.add-friend-section input::placeholder {
    text-transform: none;
    font-family: 'Inter', sans-serif;
}

.add-friend-section button {
    width: 100%;
}

#friendLookupResult {
    margin-top: 8px;
}

.friend-lookup-result {
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease;
}

.pending-requests h4,
.friends-list h4 {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.friend-request-item {
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 3px solid var(--warning);
}

.friend-request-item span {
    font-weight: 500;
}

.friend-request-item div {
    display: flex;
    gap: 6px;
}

.friend-request-item button {
    padding: 6px 12px;
    font-size: 0.9rem;
}

.friend-item {
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.friend-item:hover {
    background: var(--bg-primary);
    border-left-color: var(--accent-primary);
    transform: translateX(2px);
}

.friend-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    display: inline-block;
}

.status-online {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-offline {
    background: var(--text-muted);
}

.unread-badge {
    background: var(--danger);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

/* DM Modal */
.dm-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    animation: fadeIn 0.2s ease;
}

.dm-content {
    background: var(--bg-secondary);
    width: 90%;
    max-width: 600px;
    height: 70vh;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.dm-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.dm-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 0;
}

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

.dm-messages::-webkit-scrollbar {
    width: 8px;
}

.dm-messages::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

.dm-messages::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 4px;
}

.dm-message {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    max-width: 70%;
    word-wrap: break-word;
    animation: slideIn 0.2s ease;
}

.dm-sent {
    background: var(--accent-primary);
    margin-left: auto;
    text-align: right;
    border-bottom-right-radius: 4px;
}

.dm-received {
    background: var(--bg-tertiary);
    border-bottom-left-radius: 4px;
}

.dm-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    background: var(--bg-tertiary);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.dm-input-area input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.dm-input-area input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.dm-input-area button {
    padding: 12px 24px;
}

/* Sidebar Footer - Buttons Side by Side */
.sidebar-footer {
    display: flex;
    gap: 12px;
    margin-top: auto;
}

.sidebar-footer .btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 0.9rem;
}

/* Chat Input Area Styling */
.chat-input-area {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    background: var(--bg-tertiary);
}

.chat-input-area input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary) !important;
    font-size: 0.95rem;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.chat-input-area input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.chat-input-area button,
.chat-send-btn {
    padding: 12px 24px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.chat-send-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

/* Chat Input Area Styling */
.chat-input-area {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    background: var(--bg-tertiary);
}

.chat-input-area input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary) !important;
    font-size: 0.95rem;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.chat-input-area input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.chat-input-area button,
.chat-send-btn {
    padding: 12px 24px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.chat-send-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

/* Hide users list when empty */
.users-list:empty {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Main Chat Input Fix */
#chatInput {
    color: var(--text-primary) !important;
    background: var(--bg-tertiary) !important;
}