/* Chat Page Premium Refinement */
.chat-page {
    min-height: 100vh;
    padding-top: 30px;
    padding-bottom: 30px;
    background: #f8fafc !important;
    color: #0f172a !important;
}

.chat-page .container {
    max-width: 1400px;
    height: 100%;
}

/* Locked State */
.chat-locked {
    position: relative;
    height: calc(100vh - 140px);
    border-radius: 24px;
    overflow: hidden;
    background: white !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.locked-blur-bg {
    position: absolute;
    inset: 0;
    padding: 40px;
    filter: blur(10px);
    opacity: 0.6;
    background: #f1f5f9;
}

.fake-message {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.fake-message.right {
    justify-content: flex-end;
}

.fake-avatar {
    width: 44px;
    height: 44px;
    background: #cbd5e1;
    border-radius: 12px;
}

.fake-bubble {
    width: 200px;
    height: 50px;
    background: #e2e8f0;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.fake-message.right .fake-bubble {
    background: #94a3b8;
    border-radius: 16px;
    border-bottom-right-radius: 4px;
}

.locked-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
}

.locked-content {
    text-align: center;
    max-width: 450px;
    padding: 60px;
    background: white !important;
    border-radius: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.lock-icon {
    width: 80px;
    height: 80px;
    background: #fff1f2;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
    color: #e11d48;
    box-shadow: 0 10px 20px rgba(225, 29, 72, 0.15);
}

.locked-content h2 {
    font-size: 1.75rem;
    font-weight: 800;
    color: #0f172a !important;
    margin-bottom: 12px;
}

.locked-content>p {
    color: #64748b !important;
    margin-bottom: 30px;
    font-size: 1.05rem;
    line-height: 1.6;
}

.locked-features {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
    text-align: left;
    background: #f8fafc !important;
    padding: 20px;
    border-radius: 16px;
}

.locked-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #334155 !important;
    font-weight: 500;
}

.locked-feature svg {
    color: #0ea5e9;
}

/* Active Chat Container */
.chat-container {
    display: grid;
    grid-template-columns: 1fr;
    height: calc(100vh - 140px);
    background: white !important;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

@media (min-width: 900px) {
    .chat-container {
        grid-template-columns: 320px 1fr;
    }
}

/* Sidebar */
.chat-sidebar {
    display: none;
    border-right: 1px solid #f1f5f9;
    background: #f8fafc !important;
    flex-direction: column;
}

@media (min-width: 900px) {
    .chat-sidebar {
        display: flex;
    }
}

.sidebar-header {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white !important;
    border-bottom: 1px solid #f1f5f9;
}

.sidebar-header h3 {
    font-size: 1.1rem;
    font-weight: 800;
    color: #0f172a !important;
}

.chat-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b !important;
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 50px;
}

.chat-list {
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px;
    cursor: pointer;
    border-radius: 16px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.chat-item:hover {
    background: white !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.chat-item.active {
    background: white !important;
    box-shadow: 0 10px 20px rgba(14, 165, 233, 0.1);
    border-color: rgba(14, 165, 233, 0.1);
}

.chat-item-avatar {
    width: 50px;
    height: 50px;
    background: #e0f2fe;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.chat-item.active .chat-item-avatar {
    background: #0ea5e9;
    color: white;
}

.chat-item-info {
    flex: 1;
    min-width: 0;
}

.chat-item-name {
    font-weight: 700;
    color: #1e293b !important;
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.chat-item-preview {
    font-size: 0.85rem;
    color: #64748b !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item.active .chat-item-preview {
    color: #0ea5e9 !important;
    font-weight: 500;
}

.unread-badge {
    background: #ef4444;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
}

/* Chat Main Area */
.chat-main {
    display: flex;
    flex-direction: column;
    background: white !important;
}

.chat-header {
    padding: 20px 30px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.chat-header-avatar {
    width: 48px;
    height: 48px;
    background: #f1f5f9;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.chat-header-info h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a !important;
    margin: 0 0 2px 0;
}

.online-count {
    font-size: 0.85rem;
    color: #16a34a !important;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.online-count::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    background: #16a34a;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
}

.chat-header-actions {
    display: flex;
    gap: 10px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    color: #64748b;
}

.btn-icon:hover {
    background: #f1f5f9;
    color: #0f172a;
}

/* Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background-image:
        radial-gradient(#e2e8f0 1px, transparent 1px);
    background-size: 20px 20px;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 70%;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.mine {
    margin-left: auto;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    background: #f1f5f9;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.2rem;
}

.message-content {
    display: flex;
    flex-direction: column;
}

.message.mine .message-content {
    align-items: flex-end;
}

.message-sender {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b !important;
    margin-bottom: 6px;
    margin-left: 4px;
}

.message.mine .message-sender {
    margin-right: 4px;
}

.message-bubble {
    background: white !important;
    padding: 14px 18px;
    border-radius: 20px;
    border-bottom-left-radius: 4px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #1e293b !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
    border: 1px solid #e2e8f0;
}

.message.mine .message-bubble {
    background: linear-gradient(135deg, #0a2351, #1e4ba1) !important;
    color: white !important;
    border-radius: 20px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 10px rgba(10, 35, 81, 0.2);
    border: none;
}

.message-time {
    font-size: 0.7rem;
    color: #94a3b8 !important;
    margin-top: 6px;
    margin-left: 4px;
    font-weight: 500;
}

.message.mine .message-time {
    margin-right: 4px;
}

/* Chat Input */
.chat-input {
    padding: 15px 20px;
    background: white !important;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 10px;
    align-items: center;
    position: sticky;
    bottom: 0;
    z-index: 20;
}

.chat-input input {
    flex: 1;
    width: 100%;
    /* Ensure it takes available space */
    padding: 12px 20px;
    border: 2px solid #f1f5f9;
    border-radius: 50px;
    /* Fully rounded */
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
    background: #f8fafc !important;
    color: #0f172a !important;
    min-width: 0;
    /* Prevent flex overflow */
}

.chat-input input:focus {
    border-color: #0ea5e9;
    background: white !important;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

.chat-input input::placeholder {
    color: #94a3b8;
}

/* Fix button sizing */
.chat-input .btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-primary.btn-icon {
    background: linear-gradient(135deg, #0a2351, #1e4ba1) !important;
    color: white !important;
    border-radius: 50%;
    /* Make send button circular */
    box-shadow: 0 4px 10px rgba(10, 35, 81, 0.2);
}

.btn-primary.btn-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(10, 35, 81, 0.3);
}

.btn-ghost {
    color: #64748b !important;
    background: transparent;
    border-radius: 50%;
}

.btn-ghost:hover {
    background: #f1f5f9;
    color: #0f172a !important;
}

/* Channel List Styles */
.sidebar-section {
    display: flex;
    flex-direction: column;
}

.sidebar-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 10px 24px;
}

.channel-list {
    padding: 0 15px 15px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.channel-item {
    padding: 10px 16px;
    border-radius: 12px;
    color: #64748b;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.channel-item:hover {
    background: #f1f5f9;
    color: #334155;
}

.channel-item.active {
    background: #e0f2fe;
    color: #0284c7;
    font-weight: 600;
}

.channel-item.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.channel-icon {
    margin-right: 8px;
    font-size: 1.1em;
}