/* Core Chat Styling - SocialCore */

/* ===========================================
   CHAT APP CONTAINER
   =========================================== */
.chat-app {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    height: calc(100vh - 160px);
    min-height: 500px;
}

.chat-container {
    display: flex;
    height: 100%;
}

/* ===========================================
   CHAT SIDEBAR (Gesprekkenlijst)
   =========================================== */
.chat-sidebar {
    width: 360px;
    min-width: 300px;
    border-right: 1px solid #e1e5e9;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
}

.chat-header {
    padding: 16px 20px;
    background: white;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-title h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
}

.back-button {
    display: none;
    /* Verborgen op desktop */
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f1f3f4;
    color: #1a1a1a;
    text-decoration: none;
    font-size: 18px;
    align-items: center;
    justify-content: center;
}

.back-button:hover {
    background: #e8eaed;
}

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

.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    background: #f1f3f4;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-icon:hover {
    background: #e8eaed;
}

/* Conversations List */
.conversations-list,
.quick-conversations {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #e1e5e9;
}

.conversation-item:hover {
    background: #ffffff;
}

.conversation-item.active {
    background: #e3f2fd;
    border-left: 3px solid #1976d2;
}

.conversation-avatar {
    position: relative;
}

.conversation-avatar .avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
}

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

.friend-name {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
}

.message-time {
    font-size: 12px;
    color: #667781;
}

.last-message {
    margin: 0;
    font-size: 13px;
    color: #667781;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.last-message.no-messages {
    color: #999;
    font-style: italic;
}

/* No Conversations State */
.no-conversations {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 20px;
}

.no-conversations-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

/* ===========================================
   CHAT MAIN (Conversatie/Welkom)
   =========================================== */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f0f2f5;
}

/* Chat Welcome (geen gesprek geselecteerd) */
.chat-welcome {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
}

.welcome-icon {
    font-size: 80px;
    margin-bottom: 24px;
}

.welcome-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* ===========================================
   RECHTER SIDEBAR (Main site sidebar)
   =========================================== */
.main-sidebar {
    width: 300px;
}

/* ===========================================
   RESPONSIVE: TABLET (max 1024px)
   =========================================== */
@media (max-width: 1024px) {

    /* Verberg de rechter site-sidebar */
    .main-sidebar {
        display: none !important;
    }

    /* Maak de main grid single column */
    .sc-container>div {
        grid-template-columns: 1fr !important;
    }

    .chat-sidebar {
        width: 320px;
        min-width: 280px;
    }
}

/* ===========================================
   RESPONSIVE: MOBIEL (max 768px)
   =========================================== */
@media (max-width: 768px) {

    /* Container aanpassingen */
    .sc-container {
        padding: 10px !important;
    }

    .chat-app {
        height: calc(100vh - 100px) !important;
        min-height: 400px;
        border-radius: 8px;
    }

    /* ====== CHAT INDEX: Toon gesprekkenlijst, verberg welkom ====== */
    .chat-container:not(.has-active-conversation) .chat-sidebar {
        width: 100% !important;
        min-width: 100% !important;
        border-right: none;
    }

    .chat-container:not(.has-active-conversation) .chat-main {
        display: none !important;
    }

    /* ====== CHAT CONVERSATION: Toon gesprek, verberg lijst ====== */
    .chat-container.has-active-conversation .chat-sidebar {
        display: none !important;
    }

    .chat-container.has-active-conversation .chat-main {
        width: 100% !important;
    }

    /* Toon terug-knop op mobiel */
    .back-button {
        display: flex !important;
    }

    /* Conversation header aanpassingen */
    .conversation-header {
        padding: 12px 16px !important;
    }

    .conversation-avatar {
        width: 40px !important;
        height: 40px !important;
    }

    .conversation-details h2 {
        font-size: 16px !important;
    }

    /* Message bubbles iets breder op mobiel */
    .message-bubble {
        max-width: 90% !important;
    }

    /* Input container */
    .message-input-container {
        padding: 10px !important;
    }

    /* Welcome actions verticaal op mobiel */
    .welcome-actions {
        flex-direction: column !important;
    }

    /* Friends grid 3 kolommen */
    .friends-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* ===========================================
   RESPONSIVE: KLEINE MOBIEL (max 480px)
   =========================================== */
@media (max-width: 480px) {
    .chat-header {
        padding: 12px 16px;
    }

    .chat-title h1 {
        font-size: 18px;
    }

    .conversation-item {
        padding: 10px 16px;
    }

    .conversation-avatar .avatar {
        width: 44px;
        height: 44px;
    }
}
