/* Google Chat Inspired Styling for Community Chat */

/* Google Chat Color Palette */
:root {
    --google-blue: #1a73e8;
    --google-blue-hover: #1557b0;
    --google-blue-light: #e8f0fe;
    --google-green: #137333;
    --google-red: #d93025;
    --google-yellow: #f9ab00;
}

/* Light Theme Variables */
:root[data-bs-theme="light"], :root:not([data-bs-theme]) {
    --chat-bg: #f8f9fa;
    --chat-sidebar-bg: #ffffff;
    --chat-main-bg: #ffffff;
    --chat-border: #e8eaed;
    --chat-text-primary: #202124;
    --chat-text-secondary: #5f6368;
    --chat-text-muted: #80868b;
    --chat-input-bg: #f1f3f4;
    --chat-input-border: #dadce0;
    --chat-input-text: #202124;
    --chat-message-bg: #f1f3f4;
    --chat-message-own-bg: #1a73e8;
    --chat-message-own-text: #ffffff;
    --chat-message-time: #5f6368;
    --chat-hover-bg: #f8f9fa;
    --chat-active-bg: #e8f0fe;
    --chat-button-bg: #1a73e8;
    --chat-button-text: #ffffff;
    --chat-button-hover-bg: #1557b0;
    --chat-shadow: rgba(0, 0, 0, 0.1);
    --chat-shadow-hover: rgba(0, 0, 0, 0.15);
}

/* Dark Theme Variables */
:root[data-bs-theme="dark"] {
    --chat-bg: #0d1117;
    --chat-sidebar-bg: #161b22;
    --chat-main-bg: #0d1117;
    --chat-border: #30363d;
    --chat-text-primary: #f0f6fc;
    --chat-text-secondary: #8b949e;
    --chat-text-muted: #6e7681;
    --chat-input-bg: #161b22;
    --chat-input-border: #30363d;
    --chat-input-text: #f0f6fc;
    --chat-message-bg: #21262d;
    --chat-message-own-bg: #1f6feb;
    --chat-message-own-text: #ffffff;
    --chat-message-time: #8b949e;
    --chat-hover-bg: #21262d;
    --chat-active-bg: #1f6feb20;
    --chat-button-bg: #1f6feb;
    --chat-button-text: #ffffff;
    --chat-button-hover-bg: #388bfd;
    --chat-shadow: rgba(0, 0, 0, 0.3);
    --chat-shadow-hover: rgba(0, 0, 0, 0.4);
}

/* Main Container - Google Chat Layout */
.google-chat-container {
    height: calc(100vh - 20px);
    background-color: var(--chat-bg);
    font-family: 'Google Sans', 'Roboto', Arial, sans-serif;
}

/* Sidebar - Google Chat Style */
.google-chat-sidebar {
    width: 280px;
    background: var(--chat-sidebar-bg);
    border-right: 1px solid var(--chat-border);
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.google-chat-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--chat-border);
    background: var(--chat-sidebar-bg);
}

.google-chat-sidebar-title {
    font-size: 22px;
    font-weight: 400;
    color: var(--chat-text-primary);
    margin: 0 0 16px 0;
}

.google-chat-search-container {
    position: relative;
}

.google-chat-search-input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 1px solid var(--chat-input-border);
    border-radius: 24px;
    background: var(--chat-input-bg);
    color: var(--chat-input-text);
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.google-chat-search-input:focus {
    background: var(--chat-sidebar-bg);
    border-color: var(--google-blue);
    box-shadow: 0 1px 6px var(--chat-shadow);
}

.google-chat-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--chat-text-muted);
}

/* New Conversation Button */
.google-chat-new-btn {
    position: absolute;
    right: 16px;
    top: 16px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--chat-button-bg);
    border: none;
    color: var(--chat-button-text);
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 2px 10px var(--chat-shadow);
    transition: all 0.2s ease;
}

.google-chat-new-btn:hover {
    background: var(--chat-button-hover-bg);
    box-shadow: 0 4px 20px var(--chat-shadow-hover);
    transform: scale(1.05);
}

/* Conversation List */
.google-chat-conversations {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.google-chat-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--chat-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.google-chat-section:hover {
    background-color: var(--chat-hover-bg);
}

.google-chat-section-title {
    flex: 1;
    margin: 0;
}

.google-chat-section-toggle {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: var(--chat-text-muted);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.google-chat-section-toggle:hover {
    background: var(--chat-border);
    color: var(--chat-text-secondary);
}

.google-chat-section-toggle.collapsed {
    transform: rotate(-90deg);
}

.google-chat-section-content {
    transition: max-height 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
}

.google-chat-section-content.collapsed {
    max-height: 0;
    opacity: 0;
}

.google-chat-conversation-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    border-radius: 0 24px 24px 0;
    margin-right: 16px;
    transition: all 0.2s ease;
    position: relative;
    color: var(--chat-text-primary);
}

.google-chat-conversation-item:hover {
    background: var(--chat-hover-bg);
}

.google-chat-conversation-item.active {
    background: var(--chat-active-bg);
    font-weight: 600;
}

.google-chat-conversation-item.active .google-chat-conversation-name {
    font-weight: 600;
}

.google-chat-conversation-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--google-blue);
}

.google-chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--google-gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.google-chat-avatar.community {
    background: linear-gradient(135deg, var(--google-blue), var(--google-blue-hover));
    color: white;
}

.google-chat-conversation-info {
    flex: 1;
    min-width: 0;
}

.google-chat-conversation-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--google-gray-900);
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.google-chat-conversation-preview {
    font-size: 13px;
    color: var(--google-gray-600);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.google-chat-conversation-time {
    font-size: 12px;
    color: var(--google-gray-500);
    margin-left: 8px;
}

/* Main Chat Area - Google Chat Style */
.google-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: white;
}

/* Chat Header */
.google-chat-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--chat-border);
    background: var(--chat-main-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.google-chat-header-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.google-chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--google-gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
}

.google-chat-header-details h3 {
    font-size: 16px;
    font-weight: 500;
    color: var(--chat-text-primary);
    margin: 0 0 2px 0;
}

.google-chat-header-details p {
    font-size: 13px;
    color: var(--chat-text-secondary);
    margin: 0;
}

.google-chat-header-actions {
    display: flex;
    gap: 8px;
}

.google-chat-header-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--chat-text-muted);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.google-chat-header-btn:hover {
    background: var(--chat-hover-bg);
    color: var(--chat-text-secondary);
}

/* Messages Container - Google Chat Style */
.google-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    background: var(--chat-main-bg);
}

.google-chat-message {
    display: flex;
    margin-bottom: 16px;
    align-items: flex-end;
}

.google-chat-message.own {
    flex-direction: row-reverse;
}

.google-chat-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--chat-border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 8px;
    flex-shrink: 0;
    font-size: 14px;
    color: var(--chat-text-muted);
}

.google-chat-message-bubble {
    max-width: 60%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
}

.google-chat-message.own .google-chat-message-bubble {
    background: var(--chat-message-own-bg);
    color: var(--chat-message-own-text);
    border-bottom-right-radius: 4px;
}

.google-chat-message:not(.own) .google-chat-message-bubble {
    background: var(--chat-message-bg);
    color: var(--chat-text-primary);
    border-bottom-left-radius: 4px;
}

.google-chat-message-sender {
    font-size: 12px;
    color: var(--google-gray-600);
    margin-bottom: 4px;
    font-weight: 500;
}

.google-chat-message-time {
    font-size: 11px;
    color: var(--chat-text-muted);
    margin-top: 4px;
}

/* Message Input Area - Google Chat Style */
.google-chat-input-area {
    padding: 16px 24px;
    border-top: 1px solid var(--chat-border);
    background: var(--chat-main-bg);
    position: relative;
}

.google-chat-input-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    position: relative;
}

.google-chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    flex: 1;
    background: var(--google-gray-50);
    border-radius: 24px;
    padding: 8px;
    border: 1px solid var(--google-gray-300);
    transition: all 0.2s ease;
}

.google-chat-input-wrapper:focus-within {
    background: white;
    border-color: var(--google-blue);
    box-shadow: 0 1px 6px rgba(32,33,36,.28);
}

.google-chat-input-actions {
    display: flex;
    gap: 4px;
    margin-right: 8px;
    flex-shrink: 0;
}

.google-chat-input-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--google-gray-600);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.google-chat-input-btn:hover {
    background: var(--google-gray-200);
    color: var(--google-gray-800);
}

.google-chat-textarea {
    width: 100%;
    min-height: 44px;
    max-height: 120px;
    padding: 12px 16px;
    border: 1px solid var(--chat-input-border);
    border-radius: 22px;
    background: var(--chat-input-bg);
    color: var(--chat-text-primary);
    font-size: 14px;
    resize: none;
    outline: none;
    transition: all 0.2s ease;
}

.google-chat-textarea:focus {
    border-color: var(--google-blue);
    background: var(--chat-main-bg);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

.google-chat-send-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--google-blue);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.google-chat-send-btn:hover {
    background: var(--google-blue-hover);
    transform: scale(1.05);
}

.google-chat-send-btn:disabled {
    background: var(--google-gray-300);
    cursor: not-allowed;
    transform: none;
}

/* Welcome Screen - Google Chat Style */
.google-chat-welcome {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: white;
}

.google-chat-welcome-content {
    text-align: center;
    max-width: 400px;
    padding: 32px;
}

.google-chat-welcome-icon {
    width: 120px;
    height: 120px;
    background: var(--chat-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 48px;
    color: var(--chat-text-muted);
}

.google-chat-welcome-title {
    font-size: 24px;
    font-weight: 400;
    color: var(--chat-text-primary);
    margin: 0 0 16px 0;
}

.google-chat-welcome-text {
    font-size: 16px;
    color: var(--chat-text-secondary);
    margin: 0 0 32px 0;
    line-height: 1.5;
}

.google-chat-welcome-btn {
    background: var(--chat-accent-color);
    color: var(--chat-message-own-text);
    border: none;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.google-chat-welcome-btn:hover {
    background: var(--chat-accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--chat-shadow);
}

/* User Search Dropdown */
.google-chat-user-search-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--chat-main-bg);
    border: 1px solid var(--chat-border);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
    z-index: 1001;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.google-chat-user-search-dropdown.show {
    display: block;
}

.google-chat-user-search-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--chat-border);
    background: var(--chat-sidebar-bg);
    border-radius: 12px 12px 0 0;
}

.google-chat-user-search-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--chat-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.google-chat-user-search-results {
    padding: 4px 0;
}

.google-chat-user-search-item {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.google-chat-user-search-item:hover {
    background-color: var(--chat-hover-bg);
}

.google-chat-user-search-item.active {
    background-color: var(--chat-active-bg);
}

.google-chat-user-search-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--chat-accent-color);
    color: var(--chat-message-own-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    margin-right: 8px;
    flex-shrink: 0;
}

.google-chat-user-search-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--chat-text-primary);
    flex-grow: 1;
}

.google-chat-user-search-username {
    font-size: 12px;
    color: var(--chat-text-secondary);
    margin-left: 4px;
}

/* Emoji Picker */
.google-chat-emoji-picker {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--chat-main-bg);
    border: 1px solid var(--chat-border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

/* Status Indicators */
.google-chat-status {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.google-chat-status.online {
    background: #1a73e8;
}

.google-chat-status.away {
    background: #f9ab00;
}

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

/* Typing Indicator */
.google-chat-typing {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    color: var(--chat-text-secondary);
    font-size: 13px;
}

.google-chat-typing-dots {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}

.google-chat-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--chat-text-muted);
    animation: typing 1.4s infinite ease-in-out;
}

.google-chat-typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.google-chat-typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Scrollbar Styling */
.google-chat-messages::-webkit-scrollbar,
.google-chat-conversations::-webkit-scrollbar {
    width: 8px;
}

.google-chat-messages::-webkit-scrollbar-track,
.google-chat-conversations::-webkit-scrollbar-track {
    background: transparent;
}

.google-chat-messages::-webkit-scrollbar-thumb,
.google-chat-conversations::-webkit-scrollbar-thumb {
    background: var(--chat-scrollbar-thumb);
    border-radius: 4px;
}

.google-chat-messages::-webkit-scrollbar-thumb:hover,
.google-chat-conversations::-webkit-scrollbar-thumb:hover {
    background: var(--chat-scrollbar-thumb-hover);
}

/* Responsive Design */
@media (max-width: 768px) {
    .google-chat-sidebar {
        width: 100%;
        position: fixed;
        left: -100%;
        top: 0;
        z-index: 1000;
        transition: left 0.3s ease;
    }
    
    .google-chat-sidebar.show {
        left: 0;
    }
    
    .google-chat-main {
        width: 100%;
    }
    
    .google-chat-message-bubble {
        max-width: 80%;
    }
}