/* public/css/style.css */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Login Container */
#login-container, #chat-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    width: 90%;
    max-width: 900px;
}

#login-container {
    padding: 40px;
    text-align: center;
}

#login-container h1 {
    margin-bottom: 20px;
    color: #333;
    font-size: 2.5em;
}

#login-container p {
    color: #666;
    margin-bottom: 20px;
}

#login-container input {
    width: 100%;
    padding: 15px;
    margin: 10px 0;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

#login-container input:focus {
    outline: none;
    border-color: #667eea;
}

#login-container button {
    width: 100%;
    padding: 15px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

#login-container button:hover {
    background: #5a67d8;
}

/* Chat Container */
#chat-container {
    display: none;
    flex-direction: column;
    height: 700px;
}

#main-layout {
    display: flex;
    height: 100%;
}

/* Users Sidebar */
#users-panel {
    width: 220px;
    border-right: 1px solid #e0e0e0;
    background: #f8f9fa;
    border-radius: 10px 0 0 0;
    display: flex;
    flex-direction: column;
}

#users-header {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
}

#users-header h3 {
    color: #333;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#users-list {
    list-style: none;
    padding: 10px;
    flex: 1;
    overflow-y: auto;
}

#users-list li {
    padding: 10px;
    margin-bottom: 5px;
    color: #666;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

#users-list li:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

#users-list li.selected {
    background: #667eea;
    color: white;
}

#users-list li .status {
    color: #48bb78;
    font-size: 10px;
}

#users-list li .dm-badge {
    background: #ff6b6b;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
}

/* Chat Area */
#chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    background: white;
    border-radius: 0 10px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#chat-header #current-chat {
    font-weight: bold;
    color: #333;
    font-size: 16px;
}

#chat-header #chat-type {
    font-size: 12px;
    color: #999;
    background: #f0f2f5;
    padding: 4px 8px;
    border-radius: 20px;
}

#chat-header #back-to-public {
    background: none;
    border: 1px solid #e0e0e0;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

#chat-header #back-to-public:hover {
    background: #f0f2f5;
}

/* Messages Area */
#messages-area {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: white;
}

#messages {
    list-style: none;
    display: flex;
    flex-direction: column;
}

#messages li {
    margin-bottom: 15px;
    padding: 10px 15px;
    border-radius: 10px;
    max-width: 80%;
    word-wrap: break-word;
    position: relative;
    animation: fadeIn 0.3s;
}

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

#messages li.public {
    background: #f0f2f5;
    align-self: flex-start;
}

#messages li.private {
    background: #e3f2fd;
    border-left: 3px solid #2196f3;
    align-self: flex-start;
}

#messages li.private.own {
    background: #e8f5e9;
    border-left: 3px solid #4caf50;
    align-self: flex-end;
}

#messages li.system {
    background: transparent;
    color: #999;
    text-align: center;
    font-size: 12px;
    max-width: 100%;
    align-self: center;
}

#messages li .user {
    font-weight: bold;
    color: #667eea;
    margin-right: 5px;
}

#messages li .private-badge {
    display: inline-block;
    background: #2196f3;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-right: 8px;
}

#messages li .time {
    color: #999;
    font-size: 11px;
    margin-left: 5px;
}

/* Typing Indicator */
#typing-indicator {
    padding: 10px 20px;
    color: #999;
    font-style: italic;
    font-size: 13px;
    min-height: 36px;
    background: #f8f9fa;
}

/* Message Form */
#form {
    display: flex;
    padding: 15px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 10px 10px;
}

#input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 14px;
    margin-right: 10px;
    transition: border-color 0.3s;
}

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

#form button {
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
}

#form button:hover {
    background: #5a67d8;
}

#form button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Instructions */
.dm-instruction {
    color: #999;
    font-size: 12px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

/* Responsive Design */
@media (max-width: 600px) {
    #users-panel {
        width: 80px;
    }
    
    #users-panel h3 {
        display: none;
    }
    
    #users-list li span:last-child {
        display: none;
    }
    
    .dm-instruction {
        font-size: 10px;
        padding: 5px;
    }
}

/* Add to existing style.css */

/* Auth Container */
#auth-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    width: 90%;
    max-width: 400px;
    padding: 40px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: #999;
    transition: all 0.3s;
}

.auth-tab.active {
    color: #667eea;
    border-bottom: 2px solid #667eea;
    margin-bottom: -2px;
}

.auth-form {
    display: none;
}

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

.auth-form h2 {
    margin-bottom: 20px;
    color: #333;
}

.auth-form input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.auth-form input:focus {
    outline: none;
    border-color: #667eea;
}

.auth-form button {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 20px;
}

.auth-form button:hover {
    background: #5a67d8;
}

.auth-error {
    color: #e53e3e;
    font-size: 14px;
    margin-top: 10px;
    text-align: center;
}

.auth-success {
    color: #48bb78;
    font-size: 14px;
    margin-top: 10px;
    text-align: center;
}

/* User info in chat */
#user-info {
    padding: 10px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#user-info span {
    font-weight: bold;
    color: #667eea;
}

#logout-btn {
    background: none;
    border: 1px solid #e0e0e0;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

#logout-btn:hover {
    background: #f0f2f5;
}

/* Friend System Styles */
.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px !important;
}

.user-info {
    flex: 1;
    cursor: pointer;
}

.user-actions {
    display: flex;
    gap: 5px;
}

.add-friend-btn {
    background: #48bb78;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
}

.add-friend-btn:hover {
    background: #38a169;
}

.accept-btn {
    background: #48bb78;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
}

.reject-btn {
    background: #f56565;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    margin-left: 4px;
}

.pending-badge {
    color: #a0aec0;
    font-size: 11px;
    font-style: italic;
}

.friend-badge {
    color: #48bb78;
    font-size: 11px;
    font-weight: bold;
}

.friend-requests-section {
    padding: 15px;
    border-bottom: 1px solid #e2e8f0;
    background: #f7fafc;
}

.friend-requests-section h4 {
    margin: 0 0 10px 0;
    color: #4a5568;
    font-size: 14px;
}

.request-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    margin-bottom: 5px;
    background: white;
    border-radius: 5px;
    border: 1px solid #e2e8f0;
}

.request-item .requester {
    font-weight: 500;
    color: #2d3748;
}

.request-actions {
    display: flex;
    gap: 5px;
}