/* CONTENT FOR: DollsDollhouse/css/forum.css */

/* --- LAYOUT WRAPPER --- */
/* Fix the height to fill the screen minus the banner/header area */
.chat-app-wrapper {
    display: flex;
    justify-content: center;
    background: var(--light-pink); /* #fdf2f8 */
    height: 100vh;
    padding-top: 80px; /* Space for site header/FAB */
    box-sizing: border-box;
    overflow: hidden;
}

.chat-app-container {
    display: flex;
    width: 100%;
    max-width: 1600px;
    background: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    overflow: hidden;
    position: relative;
    border-top: 1px solid rgba(255,255,255,0.5);
}

/* =========================================
   SIDEBAR (Thread List)
   ========================================= */
.chat-sidebar {
    width: 35%; /* WhatsApp web is approx 30-35% */
    min-width: 320px;
    max-width: 450px;
    border-right: 1px solid #fce7f3;
    display: flex;
    flex-direction: column;
    background: white;
    z-index: 10;
}

/* Header inside sidebar */
.sidebar-header {
    padding: 15px 20px;
    background: #fdf2f8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #fce7f3;
}

.sidebar-header h2 {
    font-family: var(--font-display);
    color: var(--dark-pink);
    margin: 0;
    font-size: 1.5rem;
}

.new-chat-btn {
    background: transparent;
    border: none;
    color: var(--dark-pink);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.new-chat-btn:hover {
    background: rgba(219, 39, 119, 0.1);
}

/* Search Bar */
.sidebar-search {
    padding: 10px 15px;
    background: white;
    border-bottom: 1px solid #fce7f3;
}

.search-bar-wrapper {
    background: #fdf2f8;
    border-radius: 8px;
    display: flex;
    align-items: center;
    padding: 8px 12px;
}

.search-icon {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-right: 10px;
}

.search-bar-wrapper input {
    border: none;
    background: transparent;
    width: 100%;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    color: var(--text-dark);
}

.search-bar-wrapper input:focus {
    outline: none;
}

/* Filter Chips */
.sidebar-filters {
    display: flex;
    gap: 8px;
    padding: 10px 15px;
    overflow-x: auto;
    border-bottom: 1px solid #fce7f3;
    -webkit-overflow-scrolling: touch;
}

.filter-chip {
    background: #f3f4f6;
    border: none;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 0.85rem;
    color: var(--text-light);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-chip.active {
    background: var(--dark-pink);
    color: white;
}

/* The List Itself */
.thread-list {
    flex-grow: 1;
    overflow-y: auto;
}

/* Individual Thread Item */
.thread-item {
    display: flex;
    padding: 15px;
    cursor: pointer;
    border-bottom: 1px solid #fdf2f8;
    transition: background 0.2s;
    position: relative;
}

.thread-item:hover {
    background: #fff0f5; /* Very light pink hover */
}

.thread-item.active {
    background: #fce7f3; /* Selected state */
}

.thread-content {
    flex-grow: 1;
    min-width: 0; /* Fix flex text overflow */
}

.thread-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.thread-title {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--font-sans);
}

.thread-time {
    font-size: 0.75rem;
    color: #9ca3af;
    white-space: nowrap;
    margin-left: 10px;
}

.thread-preview {
    color: var(--text-light);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thread-item.unread .thread-title {
    font-weight: 800;
}

.unread-badge {
    background: var(--dark-pink);
    color: white;
    font-size: 0.7rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

/* =========================================
   MAIN CHAT WINDOW
   ========================================= */
.chat-window {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: #efeae2; /* WhatsApp default bg color base, we'll override with image/color */
    background-image: linear-gradient(rgba(255,255,255,0.92), rgba(255,255,255,0.92)), url('../assets/pattern-bg.png'); /* Subtle pattern if available, else plain */
    background-color: #fdfcfd;
    position: relative;
}

/* Placeholder (No chat selected) */
.chat-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    border-bottom: 6px solid var(--dark-pink); /* Branding accent */
    background: #fdf2f8;
}

.placeholder-content h1 {
    font-family: var(--font-script);
    font-size: 4rem;
    color: var(--dark-pink);
    margin-bottom: 1rem;
}

.placeholder-content p {
    color: var(--text-light);
    font-size: 1.1rem;
}

/* Active View */
.chat-active-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

/* Header */
.chat-header {
    padding: 10px 20px;
    background: #fdf2f8;
    border-bottom: 1px solid #fce7f3;
    display: flex;
    align-items: center;
    gap: 15px;
}

.back-btn {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    color: var(--dark-pink);
    cursor: pointer;
}

.header-info h3 {
    margin: 0;
    color: var(--text-dark);
    font-size: 1.1rem;
    font-family: var(--font-sans);
    font-weight: 600;
}

.header-category {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Messages Area */
.chat-messages-area {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23db2777' fill-opacity='0.03' fill-rule='evenodd'/%3E%3C/svg%3E");
}

/* Bubbles */
.message-bubble {
    max-width: 65%;
    padding: 8px 12px;
    border-radius: 7.5px;
    font-size: 0.95rem;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    font-family: var(--font-sans);
}

/* My Messages (Right) */
.message-bubble.mine {
    background-color: #fbcfe8; /* Light Pink */
    align-self: flex-end;
    border-top-right-radius: 0;
    color: #501533;
}

/* Others Messages (Left) */
.message-bubble.theirs {
    background-color: white;
    align-self: flex-start;
    border-top-left-radius: 0;
    color: #1f2937;
}

.msg-author {
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--dark-pink);
    margin-bottom: 2px;
    display: block;
}

.msg-meta {
    display: block;
    text-align: right;
    font-size: 0.65rem;
    color: rgba(0,0,0,0.45);
    margin-top: 4px;
}

.message-bubble.mine .msg-meta {
    color: rgba(80, 21, 51, 0.5);
}

.msg-media img, .msg-media video {
    max-width: 100%;
    border-radius: 6px;
    margin-top: 5px;
    cursor: pointer;
}

/* Admin/System Messages */
.message-bubble.admin {
    background-color: #fdf2f8;
    border: 1px solid var(--dark-pink);
    align-self: center;
    text-align: center;
    width: 80%;
    border-radius: 8px;
}

/* Input Area */
.chat-input-area {
    padding: 10px 16px;
    background: #fdf2f8;
    border-top: 1px solid #fce7f3;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 5px 10px;
    border-radius: 24px;
    border: 1px solid #fce7f3;
}

.input-wrapper input {
    flex-grow: 1;
    border: none;
    padding: 10px;
    font-family: var(--font-sans);
    font-size: 1rem;
}

.input-wrapper input:focus {
    outline: none;
}

.attach-btn, .send-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    transition: color 0.2s;
}

.attach-btn:hover { color: var(--dark-pink); }
.send-btn { color: var(--dark-pink); }
.send-btn:hover { transform: scale(1.1); }

/* Upload Preview */
.upload-preview {
    background: #fff;
    padding: 8px 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--dark-pink);
}

#clear-upload {
    background: none; border: none; font-weight: bold; cursor: pointer; color: red;
}

/* =========================================
   RESPONSIVE (Mobile)
   ========================================= */
@media (max-width: 768px) {
    .chat-app-wrapper {
        padding-top: 60px; /* Reduced header space on mobile */
        height: 100vh; /* Full viewport height */
    }

    .chat-sidebar {
        width: 100%; /* Full width initially */
        max-width: none;
        border-right: none;
    }

    .chat-window {
        position: fixed; /* Overlay on top of sidebar */
        top: 60px; /* Match header height */
        left: 0;
        width: 100%;
        height: calc(100% - 60px);
        transform: translateX(100%); /* Hidden by default */
        transition: transform 0.3s ease-in-out;
        z-index: 20;
    }

    /* When chat is active, slide it in */
    .chat-window.mobile-active {
        transform: translateX(0);
    }

    .back-btn {
        display: block; /* Show back button on mobile */
    }

    .chat-placeholder {
        display: none; /* No placeholder on mobile, just list or chat */
    }
    
    .message-bubble {
        max-width: 80%;
    }
}