/* ========================================
   CHAT GROUPS - Group chat styling
   ======================================== */

/* Group/Contact Tabs */
.conversation-tabs {
    display: flex;
    gap: 0;
    padding: 8px 16px;
    background: #242424;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: rgba(255, 255, 255, 0.9);
}

.tab-btn.active {
    color: #fff;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Create Group Button */
.create-group-btn {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.create-group-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}

/* Group Item in List */
.group-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    position: relative;
}

.group-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.group-item.selected {
    background: rgba(102, 126, 234, 0.15);
}

.group-avatar {
    width: 54px;
    height: 54px;
    min-width: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin-left: 12px;
    position: relative;
    flex-shrink: 0;
}

.group-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    border: 2px solid #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
}

.group-badge svg {
    width: 12px;
    height: 12px;
    color: #fff;
}

/* Group Info Modal */
.group-info-section {
    text-align: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.group-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 600;
    color: #fff;
    margin: 0 auto 16px;
}

.group-name-display {
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 12px 0;
}

.btn-sm {
    padding: 6px 16px;
    font-size: 13px;
}

/* Group Members Section */
.group-members-section {
    padding: 20px;
}

.group-members-section h5 {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.members-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.member-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: background 0.2s ease;
}

.member-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.member-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-left: 12px;
}

.member-name {
    flex: 1;
    font-size: 14px;
    color: #fff;
}

.admin-badge {
    padding: 2px 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    margin-left: 8px;
}

.btn-icon-remove {
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(239, 68, 68, 0.2);
    border-radius: 50%;
    color: #ef4444;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-remove:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: scale(1.1);
}

/* Member Selection */
.member-selection {
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* FIXED: Increased specificity to override .form-group label */
label.member-checkbox {
    display: flex;
    align-items: center;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s ease;
    margin-bottom: 4px;
    width: 100%;
    box-sizing: border-box;
}

label.member-checkbox:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Ensure flex items are aligned */
label.member-checkbox>* {
    display: block;
}

/* Stronger selector for input inside member-checkbox */
label.member-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-left: 12px;
    cursor: pointer;
    accent-color: #667eea;
    flex-shrink: 0;
}

/* Stronger selector for avatar inside member-checkbox */
label.member-checkbox .member-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 13px;
    flex-shrink: 0;
    display: flex;
    /* Ensure it stays flex */
}

/* Stronger selector for name inside member-checkbox */
label.member-checkbox .member-name {
    font-size: 14px;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* New/Add Member Selection Item */
.member-select-item {
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s;
    cursor: pointer;
    margin-bottom: 4px;
}

.member-select-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Stronger specificity for label */
.member-select-item>label {
    display: flex;
    align-items: center;
    cursor: pointer;
    width: 100%;
}

.member-select-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-left: 12px;
    accent-color: #667eea;
    flex-shrink: 0;
}

.member-select-item .member-info {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.member-select-item .member-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 14px;
    margin-left: 12px;
    flex-shrink: 0;
    display: flex;
}

.member-select-item span {
    font-size: 14px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.no-contacts {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 14px;
}

/* Group Message Bubble */
.group-message-sender {
    font-size: 12px;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 4px;
}

/* Scrollbar for members list */
.members-list::-webkit-scrollbar,
.member-selection::-webkit-scrollbar {
    width: 6px;
}

.members-list::-webkit-scrollbar-track,
.member-selection::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.members-list::-webkit-scrollbar-thumb,
.member-selection::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.members-list::-webkit-scrollbar-thumb:hover,
.member-selection::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Group indicator in chat header */
.group-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.group-indicator svg {
    width: 14px;
    height: 14px;
}