/* ===================================
   Chapter Enrollment Chat - Frontend Styles
   =================================== */

/* Chapter Chat Container */
.ce-chat-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 600px;
    margin: 20px 0;
}

.ce-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.ce-chat-header h3 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 700;
}

.ce-chat-members {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

/* Messages Area */
.ce-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f9f9f9;
}

.ce-chat-loading {
    text-align: center;
    color: #999;
    padding: 20px;
    font-size: 14px;
}

.ce-chat-empty {
    text-align: center;
    color: #ccc;
    padding: 40px 20px;
    font-size: 14px;
}

/* Message Item */
.ce-chat-message {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    animation: slideIn 0.3s ease;
}

.ce-chat-message.ce-own-message {
    justify-content: flex-end;
}

.ce-chat-message.ce-own-message .ce-chat-message-avatar {
    order: 2;
}

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

.ce-chat-message-avatar {
    flex-shrink: 0;
}

.ce-chat-message-avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.ce-chat-message-content {
    flex: 1;
    max-width: 70%;
}

.ce-chat-message.ce-own-message .ce-chat-message-content {
    max-width: 70%;
}

.ce-chat-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    margin-bottom: 4px;
}

.ce-chat-message-name {
    font-weight: 600;
    color: #333;
}

.ce-chat-message-time {
    color: #999;
    font-size: 11px;
    margin-left: 8px;
}

.ce-chat-message-text {
    background: #fff;
    padding: 10px 12px;
    border-radius: 8px;
    color: #333;
    line-height: 1.4;
    word-break: break-word;
}

.ce-chat-message.ce-own-message .ce-chat-message-text {
    background: #667eea;
    color: #fff;
}

/* Input Area */
.ce-chat-input-area {
    padding: 16px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
}

.ce-chat-form {
    display: flex;
    gap: 10px;
}

.ce-chat-textarea {
    flex: 1;
    padding: 10px 12px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}

.ce-chat-textarea:focus {
    border-color: #667eea;
}

.ce-chat-btn {
    padding: 10px 20px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.ce-chat-btn:hover {
    background: #5568d3;
}

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

/* User Messages Container */
.ce-messages-container {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.ce-messages-admin {
    max-width: 800px;
}

.ce-messages-admin h3 {
    margin-top: 0;
    color: #333;
}

.ce-messages-user-selector {
    margin-bottom: 20px;
}

.ce-messages-user-selector label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.ce-select {
    width: 100%;
    max-width: 400px;
    padding: 10px 12px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}

.ce-select:focus {
    border-color: #667eea;
}

#ce-direct-chat-area {
    margin-top: 20px;
    border-top: 1px solid #e0e0e0;
    padding-top: 20px;
}

#ce-direct-messages {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 16px;
    padding: 10px 0;
}

.ce-direct-message-form {
    display: flex;
    gap: 10px;
}

/* Error and Info */
.ce-chat-error,
.ce-chat-notice {
    padding: 12px 16px;
    border-radius: 8px;
    margin: 16px 0;
    font-size: 14px;
}

.ce-chat-error {
    background: #ffeaea;
    color: #c0392b;
    border-left: 4px solid #c0392b;
}

.ce-chat-notice {
    background: #e3f2fd;
    color: #1976d2;
    border-left: 4px solid #1976d2;
}

.ce-chat-notice a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

.ce-alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.ce-alert-error {
    background: #ffeaea;
    color: #c0392b;
    border-left: 4px solid #c0392b;
}

.ce-alert-info {
    background: #e3f2fd;
    color: #1976d2;
    border-left: 4px solid #1976d2;
}

/* Responsive */
@media (max-width: 768px) {
    .ce-chat-message-content {
        max-width: 85%;
    }
    
    .ce-chat-container {
        max-height: 400px;
    }
    
    .ce-chat-form {
        flex-direction: column;
    }
    
    .ce-chat-btn {
        width: 100%;
    }
}
