/**
 * Live Discussion Rooms CSS
 * Real-time chat interface styling
 */

/* ================================
   DISCUSSION ROOM SECTION
   ================================ */

.discussion-room-section {
    margin-top: 60px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #0ea5e9;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(14, 165, 233, 0.15);
    transition: all 0.3s ease;
}

.discussion-room-section:hover {
    box-shadow: 0 15px 50px rgba(14, 165, 233, 0.2);
    transform: translateY(-2px);
}

/* Header */
.discussion-room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white;
}

.discussion-title-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
}

.discussion-icon {
    color: #bae6fd;
    animation: messageFloat 2s infinite ease-in-out;
}

@keyframes messageFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-4px); }
}

.discussion-title-wrapper h3 {
    margin: 0 0 4px 0;
    font-size: 1.5rem;
    font-weight: 800;
}

.discussion-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #bae6fd;
}

.online-indicator {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.online-count {
    font-weight: 700;
    color: white;
}

.join-discussion-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.join-discussion-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.join-discussion-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Discussion Room Content */
.discussion-room-content {
    padding: 0;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.discussion-room-content.show {
    opacity: 1;
    transform: translateY(0);
}

/* Online Users Section */
.online-users-section {
    padding: 24px 32px;
    border-bottom: 1px solid #e0f2fe;
    background: white;
}

.online-users-section h4 {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #0c4a6e;
}

.online-users-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.online-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #0c4a6e;
}

.online-user img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #0ea5e9;
}

.no-users {
    color: #64748b;
    font-style: italic;
    margin: 0;
}

/* Messages Area */
.discussion-messages {
    height: 400px;
    overflow-y: auto;
    padding: 24px 32px;
    background: white;
    border-bottom: 1px solid #e0f2fe;
    scroll-behavior: smooth;
}

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

.discussion-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.discussion-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.discussion-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* No Messages State */
.no-messages {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #64748b;
}

.no-messages svg {
    color: #0ea5e9;
    margin-bottom: 16px;
}

.no-messages p {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #374151;
}

.no-messages small {
    color: #64748b;
}

/* Messages */
.discussion-message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.3s ease;
}

.discussion-message.new-message {
    opacity: 0;
    transform: translateY(20px);
    animation: messageSlideIn 0.5s ease forwards;
}

@keyframes messageSlideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #e0f2fe;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}

.message-author {
    font-weight: 700;
    color: #0c4a6e;
    font-size: 0.9rem;
}

.message-time {
    font-size: 0.75rem;
    color: #64748b;
}

.message-text {
    color: #374151;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* Input Section */
.discussion-input-section {
    padding: 24px 32px;
    background: #f8fafc;
    border-top: 1px solid #e0f2fe;
}

.current-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e0f2fe;
    border-radius: 12px;
}

.current-user-info img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #0ea5e9;
}

.current-user-name {
    font-weight: 600;
    color: #0c4a6e;
}

.anonymous-user-input {
    margin-bottom: 16px;
}

.anonymous-user-input input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0f2fe;
    border-radius: 12px;
    font-size: 0.9rem;
    background: white;
    transition: all 0.3s ease;
}

.anonymous-user-input input:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.message-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 16px;
}

.message-input-wrapper textarea {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0f2fe;
    border-radius: 12px;
    font-size: 0.9rem;
    font-family: inherit;
    background: white;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    transition: all 0.3s ease;
}

.message-input-wrapper textarea:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.send-message-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.send-message-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4);
}

.send-message-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.2);
}

.discussion-guidelines {
    text-align: center;
    color: #64748b;
    font-size: 0.8rem;
}

.discussion-guidelines strong {
    color: #374151;
}

/* Error Messages */
.discussion-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    margin: 16px 32px;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 1px solid #f87171;
    border-radius: 8px;
    color: #dc2626;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Loading Spinners */
.loading-spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.messages-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #64748b;
}

.messages-loading p {
    margin-top: 16px;
    font-weight: 600;
}

/* Dark Mode */
body.dark-mode .discussion-room-section {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    border-color: #3b82f6;
}

body.dark-mode .discussion-room-header {
    background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%);
}

body.dark-mode .online-users-section,
body.dark-mode .discussion-messages {
    background: #0f172a;
    border-bottom-color: #1e3a8a;
}

body.dark-mode .online-users-section h4 {
    color: #f1f5f9;
}

body.dark-mode .online-user {
    background: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
    color: #cbd5e1;
}

body.dark-mode .message-author {
    color: #f1f5f9;
}

body.dark-mode .message-text {
    color: #e2e8f0;
}

body.dark-mode .discussion-input-section {
    background: #1e293b;
    border-top-color: #334155;
}

body.dark-mode .current-user-info,
body.dark-mode .anonymous-user-input input,
body.dark-mode .message-input-wrapper textarea {
    background: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}

body.dark-mode .current-user-name {
    color: #cbd5e1;
}

body.dark-mode .discussion-guidelines {
    color: #94a3b8;
}

body.dark-mode .discussion-guidelines strong {
    color: #cbd5e1;
}

body.dark-mode .no-messages p {
    color: #e2e8f0;
}

body.dark-mode .no-messages {
    color: #94a3b8;
}

/* Responsive */
@media (max-width: 768px) {
    .discussion-room-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
        padding: 20px 24px;
    }
    
    .discussion-title-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .join-discussion-btn {
        width: 100%;
        justify-content: center;
    }
    
    .online-users-section,
    .discussion-messages,
    .discussion-input-section {
        padding: 20px 24px;
    }
    
    .discussion-messages {
        height: 300px;
    }
    
    .message-input-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    .send-message-btn {
        justify-content: center;
    }
    
    .online-users-list {
        gap: 8px;
    }
    
    .online-user {
        font-size: 0.8rem;
        padding: 6px 10px;
    }
}

@media (max-width: 480px) {
    .discussion-room-header {
        padding: 16px 20px;
    }
    
    .discussion-title-wrapper h3 {
        font-size: 1.3rem;
    }
    
    .online-users-section,
    .discussion-messages,
    .discussion-input-section {
        padding: 16px 20px;
    }
    
    .discussion-messages {
        height: 250px;
    }
    
    .discussion-message {
        margin-bottom: 16px;
    }
    
    .message-avatar img {
        width: 32px;
        height: 32px;
    }
}
