/* Modern Chat Card Design - EXACTLY LIKE YOUR IMAGE */

.hero-wrapper {
    position: relative;
    height: 55vh;
    display: flex;
    align-items: center;
    overflow: hidden;
}

/* Gradient Background */
.hero-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #000000, #222222, #f4f4f4);
    background-size: 200% 200%;
    animation: gradientMove 8s ease infinite;
    z-index: 1;
}

/* Soft Floating Shapes */
.hero-bg::before,
.hero-bg::after {
    content: "";
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.25;
}

.hero-bg::before {
    background: #ffffff;
    top: -100px;
    left: -150px;
}

.hero-bg::after {
    background: #999999;
    bottom: -120px;
    right: -150px;
}

/* Text animation */
.hero-content {
    animation: fadeInUp 1s ease-in-out;
}

/* Animations */
@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

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

.modern-chat-card {
    background: white;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: all 0.4s ease;
    border: 1px solid #eee;
}

.modern-chat-card:hover {
    transform: translateY(-12px);
    box-shadow: 0 20px 40px rgba(241, 184, 0, 0.25);
    border-color: #f1b800;
}

.card-banner {
    position: relative;
    height: 180px;
    overflow: hidden;
}

.banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.modern-chat-card:hover .banner-img {
    transform: scale(1.08);
}

/* Status Badge (Top Right) */
.status-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.3);
}

.status-badge.active {
    background: rgba(34, 197, 94, 0.9);
    border-color: #22c55e;
}

.status-badge.inactive {
    background: rgba(239, 68, 68, 0.9);
}

/* Type Badge (Bottom Left) */
.type-badge {
    position: absolute;
    bottom: 16px;
    left: 16px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.type-badge.public {
    background: rgba(59, 130, 246, 0.9);
}

.type-badge.private {
    background: rgba(239, 68, 68, 0.9);
}

/* Card Content */
.card-content {
    padding: 24px;
    text-align: left;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1a1a1a;
    margin-bottom: 12px;
    line-height: 1.2;
}

.card-desc {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.5;
    margin-bottom: 20px;
}

/* Join Buttons */
.join-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-outline-dark {
    border: 2px solid #333;
    color: #333;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-outline-dark:hover:not(:disabled) {
    background: #333;
    color: white;
}

.btn-join-main {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #f1b800, #e0a800);
    color: white;
    border: none;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-join-main:hover:not(:disabled) {
    transform: scale(1.15);
    box-shadow: 0 10px 25px rgba(241, 184, 0, 0.5);
}

.btn-join-main:disabled,
.btn-outline-dark:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
    .card-title { font-size: 1.3rem; }
    .card-banner { height: 160px; }
    .join-actions { justify-content: center; }
}
/* Modal Styles */
.modal-dialog {
    max-width: 400px;
}
.modal-body {
    padding: 1.5rem;
}
.modal-footer {
    padding: 1rem 1.5rem;
    display: flex;
    gap: 0.5rem;
}
.modal-footer .btn {
    flex: 1;
    min-width: 0;
}

/* FIX 1 & 2: Chat Interface Container */
.chat-box {
    /* Set a height for the boxed chat and ensure it starts below the main site header */
    height: 85vh;
    min-height: 550px;
    overflow: hidden; /* Important for the flex layout inside */
}
.chat-container {
    display: flex;
    height: 100%; /* Take full height of the chat-box card */
    background: #f0f2f5;
}

/* Sidebar */
.chat-sidebar {
    min-width: 300px; /* Fixed minimum width for desktop */
    width: 380px;
    background: white;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0; /* Prevent shrinking on larger screens */
}

.sidebar-header {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-avatar {
    color: #0D6EFD;
}

.search-box {
    padding: 10px 15px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.search-box input {
    padding-left: 40px;
    border-radius: 20px;
    border: 1px solid #e0e0e0;
}

.contacts-list {
    overflow-y: auto;
    flex: 1;
}

.contact-item {
    display: flex;
    padding: 15px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
    position: relative;
}

.contact-item:hover {
    background: #f5f5f5;
}

.contact-item.active {
    background: #e7f3ff;
}

.contact-avatar {
    position: relative;
    margin-right: 15px;
}

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

.online-status {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #25d366;
    border: 2px solid white;
    border-radius: 50%;
}

.contact-info {
    flex: 1;
    min-width: 0;
}

.contact-name {
    font-size: 16px;
    font-weight: 600;
    color: #111;
}

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

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

/* Chat Main Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #efeae2;
}

.chat-header {
    padding: 15px 20px;
    background: #f0f2f5;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* Prevent shrinking */
}

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

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #efeae2;
}

.date-divider {
    text-align: center;
    margin: 20px 0;
}

.date-divider span {
    background: #fff;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 13px;
    color: #667781;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message {
    display: flex;
    margin-bottom: 15px;
}

.message.sent {
    justify-content: flex-end;
}

.message-content {
    max-width: 65%;
    padding: 8px 12px;
    border-radius: 8px;
    position: relative;
}

.message.received .message-content {
    background: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message.sent .message-content {
    background: #d9fdd3;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message-content p {
    margin: 0 0 5px 0;
    color: #111;
    font-size: 14.5px;
    line-height: 1.5;
}

.message-time {
    font-size: 11px;
    color: #667781;
    display: flex;
    align-items: center;
    gap: 3px;
    float: right;
}


/* FIX 3: Chat Input styling */
.chat-input {
    padding: 10px 15px; /* Reduced padding slightly for a tighter look */
    background: #f0f2f5;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px; /* Reduced gap slightly */
    align-items: center;
    flex-shrink: 0; /* Prevent shrinking */
}

.chat-input input {
    flex: 1;
    border-radius: 25px;
    border: 1px solid #e0e0e0;
    padding: 10px 20px;
}

.chat-input .btn {
    border-radius: 50%;
    width: 38px; /* Slightly smaller button size */
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* Responsive Design */
@media (max-width: 992px) {
    .chat-box {
        height: 90vh; /* Allow more height on tablets */
    }
}

@media (max-width: 768px) {
    /* On mobile, only one panel is active at a time */
    .chat-container {
        /* Make container full width on small screens when shown */
        width: 100%;
    }
    .chat-sidebar {
        width: 100%;
        /* Hide sidebar by default on mobile */
        display: none;
    }

    .chat-sidebar.active {
        /* Show sidebar when active */
        display: flex;
    }

    .chat-main {
        width: 100%;
        /* Show main chat by default on mobile */
        display: flex;
    }

    .chat-main.hidden {
        /* Hide main chat when sidebar is active */
        display: none;
    }

    /* Make sure the Show Sidebar button is visible on mobile */
    #showSidebarBtn {
        display: block;
    }
}

/* Desktop/Tablet (above 768px) ensure both are visible */
@media (min-width: 769px) {
    .chat-sidebar {
        display: flex !important;
    }
    .chat-main {
        display: flex !important;
    }
    #showSidebarBtn {
        display: none; /* Hide back button on desktop */
    }
}
